Skip to content

Commit

Permalink
Fix for GetBlockValue() after block 13,440,000
Browse files Browse the repository at this point in the history
Forces the block reward to zero when right shift in GetBlockValue() is
undefined, after 64 reward halvings (block height 13,440,000).
  • Loading branch information
ditto-b committed Mar 11, 2014
1 parent a63f8b7 commit c5a9d2c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1176,9 +1176,14 @@ void static PruneOrphanBlocks()
int64_t GetBlockValue(int nHeight, int64_t nFees)
{
int64_t nSubsidy = 50 * COIN;
int halvings = nHeight / Params().SubsidyHalvingInterval();

// Force block reward to zero when right shift is undefined.
if (halvings >= 64)
return nFees;

// Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
nSubsidy >>= (nHeight / Params().SubsidyHalvingInterval());
nSubsidy >>= halvings;

return nSubsidy + nFees;
}
Expand Down

0 comments on commit c5a9d2c

Please sign in to comment.