Skip to content

Commit

Permalink
Only allow block to pass as a budget superblock if it came at or afte…
Browse files Browse the repository at this point in the history
…r Params().GetConsensus().nBudgetPaymentsStartBlock

Closes #715
  • Loading branch information
UdjinM6 authored and schinzelh committed Mar 6, 2016
1 parent b006414 commit c40fccc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/masternode-payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ bool IsBlockValueValid(const CBlock& block, CAmount nExpectedValue){

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
if(nHeight % Params().GetConsensus().nBudgetPaymentsCycleBlocks < Params().GetConsensus().nBudgetPaymentsWindowBlocks){
if(nHeight >= Params().GetConsensus().nBudgetPaymentsStartBlock &&
nHeight % Params().GetConsensus().nBudgetPaymentsCycleBlocks < Params().GetConsensus().nBudgetPaymentsWindowBlocks){
return true;
} else {
if(block.vtx[0].GetValueOut() > nExpectedValue) return false;
Expand All @@ -216,7 +217,8 @@ bool IsBlockValueValid(const CBlock& block, CAmount 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
return true;
} else {
Expand Down

0 comments on commit c40fccc

Please sign in to comment.