Fixed bug with AutoCheck finalbudget voting

This commit is contained in:
Evan Duffield 2015-08-03 12:54:54 -07:00
parent c7077dc9d4
commit 92be1268bb

View File

@ -1500,7 +1500,9 @@ void CFinalizedBudget::AutoCheck()
if(!fMasterNode || fAutoChecked) return;
//do this 1 in 20 blocks -- spread out the voting activity on mainnet
if(Params().NetworkID() == CBaseChainParams::MAIN && rand() % 20 != 0) return;
if(Params().NetworkID() == CBaseChainParams::MAIN && rand() % 20 != 0) {
return;
}
fAutoChecked = true; //we only need to check this once
@ -1513,6 +1515,12 @@ void CFinalizedBudget::AutoCheck()
return;
}
if(vBudgetProposals.size() != vecBudgetPayments.size()) {
LogPrintf("CFinalizedBudget::AutoCheck - Budget length doesn't match\n");
return;
}
for(unsigned int i = 0; i < vecBudgetPayments.size(); i++){
if(i > vBudgetProposals.size() - 1) {
LogPrintf("CFinalizedBudget::AutoCheck - Vector size mismatch, aborting\n");
@ -1533,11 +1541,11 @@ void CFinalizedBudget::AutoCheck()
LogPrintf("CFinalizedBudget::AutoCheck - item #%d payee doesn't match %s %s\n", i, vecBudgetPayments[i].payee.ToString(), vBudgetProposals[i]->GetPayee().ToString());
return;
}
LogPrintf("CFinalizedBudget::AutoCheck - Finalized Budget Matches! Submitting Vote.\n");
SubmitVote();
}
LogPrintf("CFinalizedBudget::AutoCheck - Finalized Budget Matches! Submitting Vote.\n");
SubmitVote();
}
}
// If masternode voted for a proposal, but is now invalid -- remove the vote