diff options
| author | ditto-b <[email protected]> | 2014-03-10 19:02:36 -0500 |
|---|---|---|
| committer | ditto-b <[email protected]> | 2014-03-10 19:02:36 -0500 |
| commit | c5a9d2ca9e3234db9687c8cbec4b5b93ec161190 (patch) | |
| tree | 44c8e5a4841a2b16c7d40f79cc99ee6a81ef4e94 /src/main.cpp | |
| parent | Merge pull request #3717 from djpnewton/wallet-txcount (diff) | |
| download | discoin-c5a9d2ca9e3234db9687c8cbec4b5b93ec161190.tar.xz discoin-c5a9d2ca9e3234db9687c8cbec4b5b93ec161190.zip | |
Fix for GetBlockValue() after block 13,440,000
Forces the block reward to zero when right shift in GetBlockValue() is
undefined, after 64 reward halvings (block height 13,440,000).
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 2d8ac0c9b..305d7045b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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; } |