Skip to content

Instantly share code, notes, and snippets.

@nelruk
Created November 14, 2017 22:44
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nelruk/d00d785f84e47288b0ab734d4aab5f49 to your computer and use it in GitHub Desktop.
Save nelruk/d00d785f84e47288b0ab734d4aab5f49 to your computer and use it in GitHub Desktop.
Bitcoin halving (line 1093)
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
int halvings = nHeight / 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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment