Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

dsnotificationinterface.cpp
Go to the documentation of this file.
1 // Copyright (c) 2014-2019 The Dash Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <chainparams.h>
11 #ifdef ENABLE_WALLET
13 #endif // ENABLE_WALLET
14 #include <validation.h>
15 
16 #include <evo/deterministicmns.h>
17 #include <evo/mnauth.h>
18 
19 #include <llmq/quorums.h>
23 
25 {
26  LOCK(cs_main);
29 }
30 
32 {
35 }
36 
37 void CDSNotificationInterface::NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload)
38 {
39  masternodeSync.NotifyHeaderTip(pindexNew, fInitialDownload, connman);
40 }
41 
42 void CDSNotificationInterface::SynchronousUpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload)
43 {
44  if (pindexNew == pindexFork) // blocks were disconnected without any new ones
45  return;
46 
47  deterministicMNManager->UpdatedBlockTip(pindexNew);
48 }
49 
50 void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload)
51 {
52  if (pindexNew == pindexFork) // blocks were disconnected without any new ones
53  return;
54 
55  masternodeSync.UpdatedBlockTip(pindexNew, fInitialDownload, connman);
56 
57  // Update global DIP0001 activation status
59 
60  if (fInitialDownload)
61  return;
62 
64 #ifdef ENABLE_WALLET
66 #endif // ENABLE_WALLET
67 
70 
71  llmq::quorumManager->UpdatedBlockTip(pindexNew, fInitialDownload);
72  llmq::quorumDKGSessionManager->UpdatedBlockTip(pindexNew, fInitialDownload);
73 
75 }
76 
78 {
82 }
83 
84 void CDSNotificationInterface::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex, const std::vector<CTransactionRef>& vtxConflicted)
85 {
86  // TODO: Tempoarily ensure that mempool removals are notified before
87  // connected transactions. This shouldn't matter, but the abandoned
88  // state of transactions in our wallet is currently cleared when we
89  // receive another notification and there is a race condition where
90  // notification of a connected conflict might cause an outside process
91  // to abandon a transaction and then have it inadvertantly cleared by
92  // the notification that the conflicted transaction was evicted.
93 
94  llmq::quorumInstantSendManager->BlockConnected(pblock, pindex, vtxConflicted);
95  llmq::chainLocksHandler->BlockConnected(pblock, pindex, vtxConflicted);
96  CPrivateSend::BlockConnected(pblock, pindex, vtxConflicted);
97 }
98 
99 void CDSNotificationInterface::BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected)
100 {
101  llmq::quorumInstantSendManager->BlockDisconnected(pblock, pindexDisconnected);
102  llmq::chainLocksHandler->BlockDisconnected(pblock, pindexDisconnected);
103  CPrivateSend::BlockDisconnected(pblock, pindexDisconnected);
104 }
105 
107 {
108  CMNAuth::NotifyMasternodeListChanged(undo, oldMNList, diff);
110 }
111 
113 {
116 }
void UpdatedBlockTip(const CBlockIndex *pindexNew)
static void UpdatedBlockTip(const CBlockIndex *pindex)
void TransactionAddedToMempool(const CTransactionRef &tx, int64_t nAcceptTime)
void NotifyChainLock(const CBlockIndex *pindex, const llmq::CChainLockSig &clsig) override
CMasternodeSync masternodeSync
void UpdatedBlockTip(const CBlockIndex *pindex)
void BlockDisconnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexDisconnected) override
Notifies listeners of a block being disconnected.
void SynchronousUpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override
Same as UpdatedBlockTip, but called from the caller&#39;s thread.
static void BlockConnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindex, const std::vector< CTransactionRef > &vtxConflicted)
void BlockDisconnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexDisconnected)
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override
Notifies listeners of updated block chain tip.
void TransactionAddedToMempool(const CTransactionRef &tx)
void UpdateCachesAndClean()
Definition: governance.cpp:351
CDKGSessionManager * quorumDKGSessionManager
void BlockConnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindex, const std::vector< CTransactionRef > &vtxConflicted) override
Notifies listeners of a block being connected.
CCriticalSection cs_main
Definition: validation.cpp:213
void NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman &connman)
void NotifyMasternodeListChanged(bool undo, const CDeterministicMNList &oldMNList, const CDeterministicMNListDiff &diff) override
static void NotifyChainLock(const CBlockIndex *pindex)
static void NotifyMasternodeListChanged(bool undo, const CDeterministicMNList &oldMNList, const CDeterministicMNListDiff &diff)
Definition: mnauth.cpp:194
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:345
std::unique_ptr< CDeterministicMNManager > deterministicMNManager
void NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload) override
CQuorumManager * quorumManager
Definition: quorums.cpp:30
static void BlockDisconnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexDisconnected)
CInstantSendManager * quorumInstantSendManager
CGovernanceManager governance
Definition: governance.cpp:23
CChainLocksHandler * chainLocksHandler
void AcceptedBlockHeader(const CBlockIndex *pindexNew) override
void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload)
Definition: quorums.cpp:165
#define LOCK(cs)
Definition: sync.h:178
void AcceptedBlockHeader(const CBlockIndex *pindexNew)
void BlockDisconnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexDisconnected)
void TransactionAddedToMempool(const CTransactionRef &tx, int64_t nAcceptTime) override
Notifies listeners of a transaction having been added to mempool.
bool IsInitialBlockDownload()
Check whether we are doing an initial block download (synchronizing from disk or network) ...
std::atomic< bool > fDIP0001ActiveAtTip
Definition: validation.cpp:240
static void TransactionAddedToMempool(const CTransactionRef &tx)
void UpdatedBlockTip(const CBlockIndex *pindex, CConnman &connman)
void UpdatedBlockTip(const CBlockIndex *pindexNew)
void NotifyChainLock(const CBlockIndex *pindexChainLock)
CPrivateSendClientManager privateSendClient
void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload)
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:170
const CChainParams & Params()
Return the currently selected parameters.
void BlockConnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindex, const std::vector< CTransactionRef > &vtxConflicted)
void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman &connman)
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
Definition: chain.h:453
int nHeight
height of the entry in the chain. The genesis block has height 0
Definition: chain.h:183
const Consensus::Params & GetConsensus() const
Definition: chainparams.h:54
bool fDisableGovernance
Definition: util.cpp:94
CChain & chainActive
The currently-connected chain of blocks (protected by cs_main).
Definition: validation.cpp:217
void BlockConnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindex, const std::vector< CTransactionRef > &vtxConflicted)
int DIP0001Height
Block height at which DIP0001 becomes active.
Definition: params.h:156
void AcceptedBlockHeader(const CBlockIndex *pindexNew)
Released under the MIT license