diff --git a/src/masternode-budget.cpp b/src/masternode-budget.cpp index 0aaccaa4d..8af4ffeef 100644 --- a/src/masternode-budget.cpp +++ b/src/masternode-budget.cpp @@ -516,10 +516,12 @@ bool CBudgetManager::HasNextFinalizedBudget() if(!pindexPrev) return false; int nBlockStart = pindexPrev->nHeight - pindexPrev->nHeight % GetBudgetPaymentCycleBlocks() + GetBudgetPaymentCycleBlocks(); - if(nBlockStart - pindexPrev->nHeight > 576*2) return false; //we wouldn't have the budget yet + if(nBlockStart - pindexPrev->nHeight > 576*2) return true; //we wouldn't have the budget yet if(budget.IsBudgetPaymentBlock(nBlockStart)) return true; + LogPrintf("CBudgetManager::HasNextFinalizedBudget() - Client is missing budget\n"); + return false; } diff --git a/src/masternode-sync.cpp b/src/masternode-sync.cpp index 57cb2f8de..71c162f96 100644 --- a/src/masternode-sync.cpp +++ b/src/masternode-sync.cpp @@ -199,13 +199,14 @@ void CMasternodeSync::Process() if(RequestedMasternodeAssets == MASTERNODE_SYNC_BUDGET){ //we'll start rejecting votes if we accidentally get set as synced too soon if(lastBudgetItem > 0 && lastBudgetItem < GetTime() - MASTERNODE_SYNC_TIMEOUT*3 && RequestedMasternodeAttempt >= 4){ //hasn't received a new item in the last five seconds, so we'll move to the - if(budget.HasNextFinalizedBudget()) { + if(budget.HasNextFinalizedBudget() || nCountFailures >= 2) { GetNextAsset(); } else { //we've failed to sync, this state will reject the next budget block LogPrintf("CMasternodeSync::Process - ERROR - Sync has failed, will retry later\n"); RequestedMasternodeAssets = MASTERNODE_SYNC_FAILED; RequestedMasternodeAttempt = 0; lastFailure = GetTime(); + nCountFailures++; } return; } diff --git a/src/masternode-sync.h b/src/masternode-sync.h index d90eb8a51..abfa50a9e 100644 --- a/src/masternode-sync.h +++ b/src/masternode-sync.h @@ -29,6 +29,7 @@ public: int64_t lastMasternodeWinner; int64_t lastBudgetItem; int64_t lastFailure; + int64_t nCountFailures; // Count peers we've requested the list from int RequestedMasternodeAssets;