Dash Core  0.12.2.1
P2P Digital Currency
dsnotificationinterface.cpp
Go to the documentation of this file.
1 // Copyright (c) 2014-2017 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 
6 #include "instantx.h"
7 #include "governance.h"
8 #include "masternodeman.h"
9 #include "masternode-payments.h"
10 #include "masternode-sync.h"
11 #include "privatesend-client.h"
12 #include "txmempool.h"
13 
15 {
16  LOCK(cs_main);
18 }
19 
21 {
23 }
24 
25 void CDSNotificationInterface::NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload)
26 {
27  masternodeSync.NotifyHeaderTip(pindexNew, fInitialDownload, connman);
28 }
29 
30 void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload)
31 {
32  if (pindexNew == pindexFork) // blocks were disconnected without any new ones
33  return;
34 
35  masternodeSync.UpdatedBlockTip(pindexNew, fInitialDownload, connman);
36 
37  // DIP0001 updates
38 
39  bool fDIP0001ActiveAtTipTmp = fDIP0001ActiveAtTip;
40  // Update global flags
43 
44  // Update min fees only if activation changed and we are using default fees
45  if (fDIP0001ActiveAtTipTmp != fDIP0001ActiveAtTip) {
46  if (!mapArgs.count("-minrelaytxfee")) {
49  }
50  if (!mapArgs.count("-mintxfee")) {
52  }
53  if (!mapArgs.count("-fallbackfee")) {
55  }
56  }
57 
58  if (fInitialDownload)
59  return;
60 
61  mnodeman.UpdatedBlockTip(pindexNew);
63  instantsend.UpdatedBlockTip(pindexNew);
66 }
67 
69 {
70  instantsend.SyncTransaction(tx, pblock);
72 }
CMasternodeMan mnodeman
CMasternodeSync masternodeSync
void AcceptedBlockHeader(const CBlockIndex *pindexNew)
void SyncTransaction(const CTransaction &tx, const CBlock *pblock) override
static const unsigned int DEFAULT_DIP0001_MIN_RELAY_TX_FEE
Definition: validation.h:62
void UpdatedBlockTip(const CBlockIndex *pindex)
void UpdatedBlockTip(const CBlockIndex *pindex)
Definition: instantx.cpp:841
CCriticalSection cs_main
Definition: validation.cpp:62
static void SyncTransaction(const CTransaction &tx, const CBlock *pblock)
static const CAmount DEFAULT_DIP0001_FALLBACK_FEE
Definition: wallet.h:52
void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman &connman)
void UpdatedBlockTip(const CBlockIndex *pindex, CConnman &connman)
static const CAmount DEFAULT_DIP0001_TRANSACTION_MINFEE
Definition: wallet.h:60
static CFeeRate minTxFee
Definition: wallet.h:909
std::atomic< bool > fDIP0001WasLockedIn
Definition: validation.cpp:88
CMasternodePayments mnpayments
void UpdateMinFee(const CFeeRate &_minReasonableRelayFee)
Definition: txmempool.cpp:1100
CFeeRate minRelayTxFee
Definition: validation.cpp:94
#define LOCK(cs)
Definition: sync.h:168
static CFeeRate fallbackFee
Definition: wallet.h:910
void UpdatedBlockTip(const CBlockIndex *pindex, CConnman &connman)
bool IsInitialBlockDownload()
CInstantSend instantsend
Definition: instantx.cpp:30
std::atomic< bool > fDIP0001ActiveAtTip
Definition: validation.cpp:89
void NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload) override
static const CAmount DEFAULT_LEGACY_TRANSACTION_MINFEE
-mintxfee default
Definition: wallet.h:59
CChain chainActive
Definition: validation.cpp:65
void AcceptedBlockHeader(const CBlockIndex *pindexNew) override
static const CAmount DEFAULT_LEGACY_FALLBACK_FEE
-fallbackfee default
Definition: wallet.h:51
VersionBitsCache versionbitscache
CPrivateSendClient privateSendClient
CTxMemPool mempool
void NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman &connman)
const CChainParams & Params()
CBlockIndex * Tip() const
Definition: chain.h:366
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override
CGovernanceManager governance
Definition: governance.cpp:17
void SyncTransaction(const CTransaction &tx, const CBlock *pblock)
Definition: instantx.cpp:846
static const unsigned int DEFAULT_LEGACY_MIN_RELAY_TX_FEE
Definition: validation.h:61
Definition: block.h:73
ThresholdState VersionBitsState(const CBlockIndex *pindexPrev, const Consensus::Params &params, Consensus::DeploymentPos pos, VersionBitsCache &cache)
void UpdatedBlockTip(const CBlockIndex *pindex)
map< string, string > mapArgs
Definition: util.cpp:122