Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
masternode-sync.cpp
Go to the documentation of this file.
58 LogPrintf("CMasternodeSync::SwitchToNextAsset -- Completed %s in %llds\n", GetAssetName(), GetTime() - nTimeAssetSyncStarted);
63 LogPrintf("CMasternodeSync::SwitchToNextAsset -- Completed %s in %llds\n", GetAssetName(), GetTime() - nTimeAssetSyncStarted);
89 void CMasternodeSync::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv)
100 LogPrintf("SYNCSTATUSCOUNT -- got inventory count: nItemID=%d nCount=%d peer=%d\n", nItemID, nCount, pfrom->GetId());
112 // reset the sync process if the last call to this function was more than 60 minutes ago (client was in sleep mode)
115 LogPrintf("CMasternodeSync::ProcessTick -- WARNING: no actions for too long, restarting sync...\n");
138 LogPrintf("CMasternodeSync::ProcessTick -- nTick %d nCurrentAsset %d nTriedPeerCount %d nSyncProgress %f\n", nTick, nCurrentAsset, nTriedPeerCount, nSyncProgress);
169 if ((pnode->fWhitelisted || pnode->m_manual_connection) && !netfulfilledman.HasFulfilledRequest(pnode->addr, strAllow)) {
172 LogPrintf("CMasternodeSync::ProcessTick -- skipping mnsync restrictions for peer=%d\n", pnode->GetId());
179 LogPrintf("CMasternodeSync::ProcessTick -- disconnecting from recently synced peer=%d\n", pnode->GetId());
190 LogPrintf("CMasternodeSync::ProcessTick -- nTick %d nCurrentAsset %d -- requesting sporks from peer=%d\n", nTick, nCurrentAsset, pnode->GetId());
194 int64_t nTimeSyncTimeout = vNodesCopy.size() > 3 ? MASTERNODE_SYNC_TICK_SECONDS : MASTERNODE_SYNC_TIMEOUT_SECONDS;
209 // Now that the blockchain is synced request the mempool from the connected outbound nodes if possible
215 LogPrintf("CMasternodeSync::ProcessTick -- nTick %d nCurrentAsset %d -- syncing mempool from peer=%d\n", nTick, nCurrentAsset, pNodeTmp->GetId());
230 LogPrint(BCLog::GOBJECT, "CMasternodeSync::ProcessTick -- nTick %d nCurrentAsset %d nTimeLastBumped %lld GetTime() %lld diff %lld\n", nTick, nCurrentAsset, nTimeLastBumped, GetTime(), GetTime() - nTimeLastBumped);
234 LogPrintf("CMasternodeSync::ProcessTick -- nTick %d nCurrentAsset %d -- timeout\n", nTick, nCurrentAsset);
259 governance.GetVoteCount() - nLastVotes < std::max(int(0.0001 * nLastVotes), MASTERNODE_SYNC_TICK_SECONDS)
265 LogPrintf("CMasternodeSync::ProcessTick -- nTick %d nCurrentAsset %d -- asked for all objects, nothing to do\n", nTick, nCurrentAsset);
285 return; //this will cause each peer to get one request each six seconds for the various assets we need
310 LogPrint(BCLog::MNSYNC, "CMasternodeSync::AcceptedBlockHeader -- pindexNew->nHeight: %d\n", pindexNew->nHeight);
318 void CMasternodeSync::NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman& connman)
320 LogPrint(BCLog::MNSYNC, "CMasternodeSync::NotifyHeaderTip -- pindexNew->nHeight: %d fInitialDownload=%d\n", pindexNew->nHeight, fInitialDownload);
331 void CMasternodeSync::UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman& connman)
333 LogPrint(BCLog::MNSYNC, "CMasternodeSync::UpdatedBlockTip -- pindexNew->nHeight: %d fInitialDownload=%d\n", pindexNew->nHeight, fInitialDownload);
359 // Switching from true to false means that we previousely stuck syncing headers for some reason,
367 LogPrint(BCLog::MNSYNC, "CMasternodeSync::UpdatedBlockTip -- pindexNew->nHeight: %d pindexBestHeader->nHeight: %d fInitialDownload=%d fReachedBestHeader=%d\n",
void SwitchToNextAsset(CConnman &connman)
Definition: masternode-sync.cpp:53
bool HasFulfilledRequest(const CService &addr, const std::string &strRequest)
Definition: netfulfilledman.cpp:19
std::string NetworkIDString() const
Return the BIP70 network string (main, test or regtest)
Definition: chainparams.h:76
int64_t nTimeLastUpdateBlockTip
Last time UpdateBlockTip has been called.
Definition: masternode-sync.h:44
static const int MASTERNODE_SYNC_RESET_SECONDS
Definition: masternode-sync.h:20
static const int MIN_GOVERNANCE_PEER_PROTO_VERSION
Definition: governance-object.h:26
BloomFilter is a probabilistic filter which SPV clients provide so that we can filter the transaction...
Definition: bloom.h:46
void PushMessage(CNode *pnode, CSerializedNetMsg &&msg)
Definition: net.cpp:3733
void NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman &connman)
Definition: masternode-sync.cpp:318
static const int MASTERNODE_SYNC_BLOCKCHAIN
Definition: masternode-sync.h:12
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:103
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Definition: util.cpp:824
Definition: util.h:141
static const int MASTERNODE_SYNC_GOVERNANCE
Definition: masternode-sync.h:13
static constexpr const CFullyConnectedOnly FullyConnectedOnly
Definition: net.h:219
Definition: masternode-sync.h:28
boost::signals2::signal< void(double nSyncProgress)> NotifyAdditionalDataSyncProgressChanged
Additional data sync progress changed.
Definition: ui_interface.h:114
CBlockIndex * pindexBestHeader
Best header we've seen so far (used for getheaders queries' starting points).
Definition: validation.cpp:218
static const int MASTERNODE_SYNC_TIMEOUT_SECONDS
Definition: masternode-sync.h:19
void BumpAssetLastTime(const std::string &strFuncName)
Definition: masternode-sync.cpp:35
void AcceptedBlockHeader(const CBlockIndex *pindexNew)
Definition: masternode-sync.cpp:308
int RequestGovernanceObjectVotes(CNode *pnode, CConnman &connman)
Definition: governance.cpp:959
const char * MEMPOOL
The mempool message requests the TXIDs of transactions that the receiving node has verified as valid ...
Definition: protocol.cpp:30
Definition: util.h:134
void DoMaintenance(CConnman &connman)
Definition: masternode-sync.cpp:371
static const int GOVERNANCE_FILTER_PROTO_VERSION
Definition: governance-object.h:27
static const int MASTERNODE_SYNC_TICK_SECONDS
Definition: masternode-sync.h:18
void ProcessMessage(CNode *pfrom, const std::string &strCommand, CDataStream &vRecv)
Definition: masternode-sync.cpp:89
void ReleaseNodeVector(const std::vector< CNode *> &vecNodes)
Definition: net.cpp:3850
bool fReachedBestHeader
Set to true if best header is reached in CMasternodeSync::UpdatedBlockTip.
Definition: masternode-sync.h:42
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.
Definition: chainparams.cpp:947
void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman &connman)
Definition: masternode-sync.cpp:331
Definition: netmessagemaker.h:12
std::vector< CNode * > CopyNodeVector(std::function< bool(const CNode *pnode)> cond)
Definition: net.cpp:3830
void SendGovernanceSyncRequest(CNode *pnode, CConnman &connman)
Definition: masternode-sync.cpp:293
std::string _(const char *psz)
Translation function: Call Translate signal on UI interface, which returns a boost::optional result...
Definition: util.h:92
void AddFulfilledRequest(const CService &addr, const std::string &strRequest)
Definition: netfulfilledman.cpp:12
void RemoveAllFulfilledRequests(const CService &addr)
Definition: netfulfilledman.cpp:41
void Reset(bool fForce=false, bool fNotifyReset=true)
Definition: masternode-sync.cpp:19