I see the
GetBlockValue() function:
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 >>= halvings;
return nSubsidy + nFees;
}
I understand that the bitwise right shift once
nHeight is large enough will halve the block reward. What I am confused about is
Why nSubsidy is 50 (initial reward) multiplied by 100 million? -- I realized that COIN is 100million satoshis.halvings will be 0 until nHeight is more than Params().SubsidyHalvingInterval(), but why won't nSubsidy halve with every subsequent nHeight, until nHeight is 2 x Params().SubsidyHalvingInterval() ? -- nSubsidy is always then reset to 50 BTC, and then the bitwise right shift is performed. Can't believe I missed that haha.
Sorry if these have been answered or seem trivial. Looking at this code for the first time can be a little overwhelming when you aren't familiar with it. Thank you.
--Update: Figured it out. Maybe it will be useful for someone else in the future. Mods please close.