Add founders reward to ChainParams.

Fix bug where subsidy slow shift was ignored.
This commit is contained in:
Simon
2016-09-21 12:02:36 -07:00
parent d5dce9342b
commit db0f931570
9 changed files with 226 additions and 11 deletions

View File

@@ -335,17 +335,14 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
txNew.vout[0].scriptPubKey = scriptPubKeyIn;
txNew.vout[0].nValue = GetBlockSubsidy(nHeight, chainparams.GetConsensus());
if ((nHeight > 0) && (nHeight < chainparams.GetConsensus().nSubsidyHalvingInterval)) {
if ((nHeight > 0) && (nHeight < chainparams.GetConsensus().GetLastFoundersRewardBlockHeight())) {
// Founders reward is 20% of the block subsidy
auto vFoundersReward = txNew.vout[0].nValue / 5;
// Take some reward away from us
txNew.vout[0].nValue -= vFoundersReward;
auto rewardScript = ParseHex(FOUNDERS_REWARD_SCRIPT);
// And give it to the founders
txNew.vout.push_back(CTxOut(vFoundersReward, CScript(rewardScript.begin(),
rewardScript.end())));
txNew.vout.push_back(CTxOut(vFoundersReward, chainparams.GetFoundersRewardScript(nHeight)));
}
// Add fees