Skip to content

Commit 3d67e7d

Browse files
committed
fix: require v20 fork activated for reallocation block reward to credit pool
It is appliable for test networks which could have custom height of forks
1 parent 641f889 commit 3d67e7d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/evo/creditpool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ CCreditPoolDiff::CCreditPoolDiff(CCreditPool starter, const CBlockIndex* pindexP
243243
assert(pindexPrev);
244244

245245
if (DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_MN_RR)) {
246-
// We consider V20 active if mn_rr is active
246+
// No credit pool exists before V20.
247247
platformReward = PlatformShare(GetMasternodePayment(pindexPrev->nHeight + 1, blockSubsidy, /*fV20Active=*/ true));
248248
}
249249
}

src/masternode/payments.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ CAmount PlatformShare(const CAmount reward)
4141
bool fV20Active = DeploymentActiveAfter(pindexPrev, m_consensus_params, Consensus::DEPLOYMENT_V20);
4242
CAmount masternodeReward = GetMasternodePayment(nBlockHeight, blockSubsidy + feeReward, fV20Active);
4343

44-
if (DeploymentActiveAfter(pindexPrev, m_consensus_params, Consensus::DEPLOYMENT_MN_RR)) {
44+
// Credit Pool doesn't exist before V20. If any part of reward will re-allocated to credit pool before v20
45+
// activation these fund will be just permanently lost. Applyable for devnets, regtest, testnet
46+
if (fV20Active && DeploymentActiveAfter(pindexPrev, m_consensus_params, Consensus::DEPLOYMENT_MN_RR)) {
4547
CAmount masternodeSubsidyReward = GetMasternodePayment(nBlockHeight, blockSubsidy, fV20Active);
4648
const CAmount platformReward = PlatformShare(masternodeSubsidyReward);
4749
masternodeReward -= platformReward;

0 commit comments

Comments
 (0)