39 LogPrint(
"mnsync",
"CMasternodeSync::BumpAssetLastTime -- %s\n", strFuncName);
53 default:
return "UNKNOWN";
62 throw std::runtime_error(
"Can't switch to next asset from failed, should use Reset() first!");
99 LogPrintf(
"CMasternodeSync::SwitchToNextAsset -- Sync has finished\n");
131 vRecv >> nItemID >> nCount;
133 LogPrintf(
"SYNCSTATUSCOUNT -- got inventory count: nItemID=%d nCount=%d peer=%d\n", nItemID, nCount, pfrom->
id);
154 static int nTick = 0;
158 static int64_t nTimeLastProcess =
GetTime();
159 if(
GetTime() - nTimeLastProcess > 60*60) {
160 LogPrintf(
"CMasternodeSync::HasSyncFailures -- WARNING: no actions for too long, restarting sync...\n");
171 LogPrintf(
"CMasternodeSync::HasSyncFailures -- WARNING: failed to sync, trying again...\n");
193 BOOST_FOREACH(
CNode* pnode, vNodesCopy)
226 LogPrintf(
"CMasternodeSync::ProcessTick -- disconnecting from recently synced peer %d\n", pnode->
id);
355 static int64_t nTimeNoObjectsLeft = 0;
357 if(nObjsLeftToAsk == 0) {
358 static int nLastTick = 0;
359 static int nLastVotes = 0;
360 if(nTimeNoObjectsLeft == 0) {
362 nTimeNoObjectsLeft =
GetTime();
365 if(nLastTick == nTick)
continue;
375 nTimeNoObjectsLeft = 0;
416 LogPrint(
"mnsync",
"CMasternodeSync::AcceptedBlockHeader -- pindexNew->nHeight: %d\n", pindexNew->
nHeight);
426 LogPrint(
"mnsync",
"CMasternodeSync::NotifyHeaderTip -- pindexNew->nHeight: %d fInitialDownload=%d\n", pindexNew->
nHeight, fInitialDownload);
439 LogPrint(
"mnsync",
"CMasternodeSync::UpdatedBlockTip -- pindexNew->nHeight: %d fInitialDownload=%d\n", pindexNew->
nHeight, fInitialDownload);
449 if (fInitialDownload) {
460 static bool fReachedBestHeader =
false;
463 if (fReachedBestHeader && !fReachedBestHeaderNew) {
468 fReachedBestHeader =
false;
472 fReachedBestHeader = fReachedBestHeaderNew;
474 LogPrint(
"mnsync",
"CMasternodeSync::UpdatedBlockTip -- pindexNew->nHeight: %d pindexBestHeader->nHeight: %d fInitialDownload=%d fReachedBestHeader=%d\n",
int RequestGovernanceObjectVotes(CNode *pnode, CConnman &connman)
CMasternodeSync masternodeSync
void AcceptedBlockHeader(const CBlockIndex *pindexNew)
void PushMessageWithVersion(CNode *pnode, int nVersion, const std::string &sCommand, Args &&... args)
CActiveMasternode activeMasternode
void AddFulfilledRequest(CAddress addr, std::string strRequest)
static const int MIN_GOVERNANCE_PEER_PROTO_VERSION
void ProcessTick(CConnman &connman)
const char * SYNCSTATUSCOUNT
int nRequestedMasternodeAssets
int64_t nTimeAssetSyncStarted
static const int MASTERNODE_SYNC_FINISHED
void RequestLowDataPaymentBlocks(CNode *pnode, CConnman &connman)
static const int MASTERNODE_SYNC_GOVERNANCE
bool HasFulfilledRequest(CAddress addr, std::string strRequest)
void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman &connman)
static const int MASTERNODE_SYNC_MNW
void SendGovernanceSyncRequest(CNode *pnode, CConnman &connman)
const char * MNGOVERNANCESYNC
int nRequestedMasternodeAttempt
void ReleaseNodeVector(const std::vector< CNode *> &vecNodes)
CMasternodePayments mnpayments
static const int MASTERNODE_SYNC_INITIAL
static int LogPrint(const char *category, const char *format)
CBlockIndex * pindexBestHeader
std::string GetSyncStatus()
static const int MASTERNODE_SYNC_TIMEOUT_SECONDS
std::string GetAssetName()
static const int INIT_PROTO_VERSION
initial proto version, to be increased after version/verack negotiation
CClientUIInterface uiInterface
static const int MASTERNODE_SYNC_LIST
int CountMasternodes(int nProtocolVersion=-1)
std::vector< CNode * > CopyNodeVector()
static const int GOVERNANCE_FILTER_PROTO_VERSION
static const int MASTERNODE_SYNC_WAITING
void ProcessMessage(CNode *pfrom, std::string &strCommand, CDataStream &vRecv)
void ManageState(CConnman &connman)
Manage state of active Masternode.
static const int MASTERNODE_SYNC_TICK_SECONDS
void NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman &connman)
void SwitchToNextAsset(CConnman &connman)
const CChainParams & Params()
void RemoveFulfilledRequest(CAddress addr, std::string strRequest)
bool IsBlockchainSynced()
uint256 GetBlockHash() const
CNetFulfilledRequestManager netfulfilledman
void ClearFulfilledRequests(CConnman &connman)
int64_t GetTime()
For unit testing.
const char * MASTERNODEPAYMENTSYNC
CGovernanceManager governance
void BumpAssetLastTime(std::string strFuncName)
boost::signals2::signal< void(double nSyncProgress)> NotifyAdditionalDataSyncProgressChanged
int GetMinMasternodePaymentsProto()
static constexpr const CAllNodes AllNodes
int nHeight
height of the entry in the chain. The genesis block has height 0
void DsegUpdate(CNode *pnode, CConnman &connman)
Count Masternodes by network type - NET_IPV4, NET_IPV6, NET_TOR.
void ForEachNode(const Condition &cond, Callable &&func)
static const int MASTERNODE_SYNC_FAILED
void PushMessage(CNode *pnode, const std::string &sCommand, Args &&... args)
std::atomic< int > nVersion
std::string _(const char *psz)
static const std::string REGTEST