|
|
@ -1324,12 +1324,27 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex) |
|
|
|
|
|
|
|
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) |
|
|
|
{ |
|
|
|
int halvings = nHeight / consensusParams.nSubsidyHalvingInterval; |
|
|
|
CAmount nSubsidy = 50 * COIN; |
|
|
|
|
|
|
|
// Mining slow start
|
|
|
|
// The subsidy is ramped up linearly, skipping the middle payout of
|
|
|
|
// MAX_SUBSIDY/2 to keep the monetary curve consistent with no slow start.
|
|
|
|
if (nHeight < consensusParams.nSubsidySlowStartInterval / 2) { |
|
|
|
nSubsidy /= consensusParams.nSubsidySlowStartInterval; |
|
|
|
nSubsidy *= nHeight; |
|
|
|
return nSubsidy; |
|
|
|
} else if (nHeight < consensusParams.nSubsidySlowStartInterval) { |
|
|
|
nSubsidy /= consensusParams.nSubsidySlowStartInterval; |
|
|
|
nSubsidy *= (nHeight+1); |
|
|
|
return nSubsidy; |
|
|
|
} |
|
|
|
|
|
|
|
assert(nHeight > consensusParams.SubsidySlowStartShift()); |
|
|
|
int halvings = (nHeight - consensusParams.SubsidySlowStartShift()) / consensusParams.nSubsidyHalvingInterval; |
|
|
|
// Force block reward to zero when right shift is undefined.
|
|
|
|
if (halvings >= 64) |
|
|
|
return 0; |
|
|
|
|
|
|
|
CAmount nSubsidy = 50 * COIN; |
|
|
|
// Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
|
|
|
|
nSubsidy >>= halvings; |
|
|
|
return nSubsidy; |
|
|
|