Only allow block to pass as a budget superblock if it came at or after Params().GetConsensus().nBudgetPaymentsStartBlock

Closes #715
This commit is contained in:
UdjinM6 2016-03-06 17:37:32 +03:00 committed by Holger Schinzel
parent b0064145db
commit c40fccce9a

View File

@ -204,7 +204,8 @@ bool IsBlockValueValid(const CBlock& block, CAmount nExpectedValue){
if(!masternodeSync.IsSynced()) { //there is no budget data to use to check anything if(!masternodeSync.IsSynced()) { //there is no budget data to use to check anything
//super blocks will always be on these blocks, max Params().GetConsensus().nBudgetPaymentsWindowBlocks per budgeting //super blocks will always be on these blocks, max Params().GetConsensus().nBudgetPaymentsWindowBlocks per budgeting
if(nHeight % Params().GetConsensus().nBudgetPaymentsCycleBlocks < Params().GetConsensus().nBudgetPaymentsWindowBlocks){ if(nHeight >= Params().GetConsensus().nBudgetPaymentsStartBlock &&
nHeight % Params().GetConsensus().nBudgetPaymentsCycleBlocks < Params().GetConsensus().nBudgetPaymentsWindowBlocks){
return true; return true;
} else { } else {
if(block.vtx[0].GetValueOut() > nExpectedValue) return false; if(block.vtx[0].GetValueOut() > nExpectedValue) return false;
@ -216,7 +217,8 @@ bool IsBlockValueValid(const CBlock& block, CAmount nExpectedValue){
return block.vtx[0].GetValueOut() <= nExpectedValue; return block.vtx[0].GetValueOut() <= nExpectedValue;
} }
if(budget.IsBudgetPaymentBlock(nHeight)){ if(nHeight >= Params().GetConsensus().nBudgetPaymentsStartBlock &&
budget.IsBudgetPaymentBlock(nHeight)){
//the value of the block is evaluated in CheckBlock //the value of the block is evaluated in CheckBlock
return true; return true;
} else { } else {