diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index 5e99c2e8cd..185f575584 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -21,7 +21,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman) argsman.AddArg("-devnet=", "Use devnet chain with provided name", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-dip3params=:", "Override DIP3 activation and enforcement heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-dip8params=", "Override DIP8 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); - argsman.AddArg("-highsubsidyblocks=", "The number of blocks with a higher than normal subsidy to mine at the start of a chain (default: 0, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); + argsman.AddArg("-highsubsidyblocks=", "The number of blocks with a higher than normal subsidy to mine at the start of a chain. Block after that height will have fixed subsidy base. (default: 0, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-highsubsidyfactor=", "The factor to multiply the normal block subsidy by while in the highsubsidyblocks window of a chain (default: 1, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-llmqchainlocks=", "Override the default LLMQ type used for ChainLocks. Allows using ChainLocks with smaller LLMQs. (default: llmq_devnet, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-llmqdevnetparams=:", "Override the default LLMQ size for the LLMQ_DEVNET quorum (default: 3:2, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); diff --git a/src/validation.cpp b/src/validation.cpp index 9dee048144..d7cc2123e0 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1129,11 +1129,15 @@ static std::pair GetBlockSubsidyHelper(int nPrevBits, int nPre dDiff = ConvertBitsToDouble(nPrevBits); } - if (fV20Active) { - // Starting from V20 Activation, subsidybase should be stable. - // Currently, nSubsidyBase calculate relies on difficulty. - // Once Platform is live, it must constantly get blocks difficulty in order to calculate platformReward. - // This can not be continued so we set the nSubsidyBase to a fixed value. + const bool isDevnet = Params().NetworkIDString() == CBaseChainParams::DEVNET; + const bool force_fixed_base_subsidy = fV20Active || (isDevnet && nPrevHeight >= consensusParams.nHighSubsidyBlocks); + if (force_fixed_base_subsidy) { + // Originally, nSubsidyBase calculations relied on difficulty. Once Platform is live, + // it must be able to calculate platformReward. However, we don't want it to constantly + // get blocks difficulty from the payment chain, so we set the nSubsidyBase to a fixed + // value starting from V20 activation. Note, that it doesn't affect mainnet really + // because blocks difficulty there is very high already. + // Devnets get fixed nSubsidyBase starting from nHighSubsidyBlocks to better mimic mainnet. nSubsidyBase = 5; } else if (nPrevHeight < 5465) { // Early ages... @@ -1162,8 +1166,8 @@ static std::pair GetBlockSubsidyHelper(int nPrevBits, int nPre nSubsidy -= nSubsidy/14; } - // this is only active on devnets if (nPrevHeight < consensusParams.nHighSubsidyBlocks) { + assert(isDevnet); nSubsidy *= consensusParams.nHighSubsidyFactor; }