File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1176,9 +1176,14 @@ void static PruneOrphanBlocks()
1176
1176
int64_t GetBlockValue (int nHeight, int64_t nFees)
1177
1177
{
1178
1178
int64_t nSubsidy = 50 * COIN;
1179
+ int halvings = nHeight / Params ().SubsidyHalvingInterval ();
1180
+
1181
+ // Force block reward to zero when right shift is undefined.
1182
+ if (halvings >= 64 )
1183
+ return nFees;
1179
1184
1180
1185
// Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
1181
- nSubsidy >>= (nHeight / Params (). SubsidyHalvingInterval ()) ;
1186
+ nSubsidy >>= halvings ;
1182
1187
1183
1188
return nSubsidy + nFees;
1184
1189
}
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ BOOST_AUTO_TEST_SUITE(main_tests)
12
12
BOOST_AUTO_TEST_CASE(subsidy_limit_test)
13
13
{
14
14
uint64_t nSum = 0 ;
15
- for (int nHeight = 0 ; nHeight < 7000000 ; nHeight += 1000 ) {
15
+ for (int nHeight = 0 ; nHeight < 14000000 ; nHeight += 1000 ) {
16
16
uint64_t nSubsidy = GetBlockValue (nHeight, 0 );
17
17
BOOST_CHECK (nSubsidy <= 50 * COIN);
18
18
nSum += nSubsidy * 1000 ;
You can’t perform that action at this time.
0 commit comments