Fixed HaveBudget, allow failure after 3 tries
This commit is contained in:
parent
a069a5df5e
commit
8acfd77750
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user