diff --git a/src/darksend.cpp b/src/darksend.cpp index 6e775b6753..937a5347da 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -2356,25 +2356,32 @@ void ThreadCheckDarkSendPool() if(c % 5 == 0 && RequestedMasternodeAssets <= 2){ bool fIsInitialDownload = IsInitialBlockDownload(); if(!fIsInitialDownload) { - LOCK(cs_vNodes); - BOOST_FOREACH(CNode* pnode, vNodes) - { - if (pnode->nVersion >= MIN_POOL_PEER_PROTO_VERSION) { + CBlockIndex* pindexPrev = chainActive.Tip(); + if(pindexPrev != NULL) { + if(pindexPrev->nTime > GetAdjustedTime() - (60*24)) + { - //keep track of who we've asked for the list - if(pnode->HasFulfilledRequest("mnsync")) continue; - pnode->FulfilledRequest("mnsync"); + LOCK(cs_vNodes); + BOOST_FOREACH(CNode* pnode, vNodes) + { + if (pnode->nVersion >= MIN_POOL_PEER_PROTO_VERSION) { - LogPrintf("Successfully synced, asking for Masternode list and payment list\n"); + //keep track of who we've asked for the list + if(pnode->HasFulfilledRequest("mnsync")) continue; + pnode->FulfilledRequest("mnsync"); - //request full mn list only if Masternodes.dat was updated quite a long time ago - mnodeman.DsegUpdate(pnode); + LogPrintf("Successfully synced, asking for Masternode list and payment list\n"); - pnode->PushMessage("mnget"); //sync payees - pnode->PushMessage("mnvs"); //sync masternode votes - pnode->PushMessage("getsporks"); //get current network sporks - RequestedMasternodeAssets++; - break; + //request full mn list only if Masternodes.dat was updated quite a long time ago + mnodeman.DsegUpdate(pnode); + + pnode->PushMessage("mnget"); //sync payees + pnode->PushMessage("mnvs"); //sync masternode votes + pnode->PushMessage("getsporks"); //get current network sporks + RequestedMasternodeAssets++; + break; + } + } } } } diff --git a/src/masternode-budget.h b/src/masternode-budget.h index cc93f77197..782f32b1f6 100644 --- a/src/masternode-budget.h +++ b/src/masternode-budget.h @@ -85,6 +85,9 @@ public: mapFinalizedBudgets.clear(); } + int sizeFinalized() {return (int)mapFinalizedBudgets.size();} + int sizeProposals() {return (int)mapProposals.size();} + void Sync(CNode* node); void Calculate(); diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index 78448be28e..eec1fb8112 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -23,15 +23,14 @@ bool IsBlockValueValid(int64_t nBlockValue, int64_t nExpectedValue){ CBlockIndex* pindexPrev = chainActive.Tip(); if(pindexPrev == NULL) return true; - //while syncing take the longest chain - if (fImporting || fReindex || pindexPrev->nHeight+1 < Checkpoints::GetTotalBlocksEstimate()) { + if(budget.sizeFinalized() == 0 && budget.sizeProposals() == 0) { //there is no budget data to use to check anything //super blocks will always be on these blocks, max 100 per budgeting if((pindexPrev->nHeight+1) % GetBudgetPaymentCycleBlocks() < 100){ return true; } else { if(nBlockValue > nExpectedValue) return false; } - } else { // we're synced so check the budget schedule + } else { // we're synced and have data so check the budget schedule if(budget.IsBudgetPaymentBlock(pindexPrev->nHeight+1)){ //the value of the block is evaluated in CheckBlock return true;