Skip to content

Commit

Permalink
chore: Testnet re-organization required changes (#5619)
Browse files Browse the repository at this point in the history
## Issue being fixed or feature implemented
Dropped all changes made so far to be able to sync Testnet.

## What was done?


## How Has This Been Tested?


## Breaking Changes
Testnet syncing obviously

## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added or updated relevant unit/integration/functional/e2e
tests
- [x] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
  • Loading branch information
ogabrielides authored Oct 23, 2023
1 parent 5c08afd commit 5f7d5fe
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/llmq/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,6 @@ bool IsMNRewardReallocationActive(const CBlockIndex* pindex)
{
assert(pindex);
if (!IsV20Active(pindex)) return false;
if (Params().NetworkIDString() == CBaseChainParams::TESTNET) return IsV20Active(pindex); // TODO remove this before re-hardforking testnet to check EHF

LOCK(cs_llmq_vbc);
return VersionBitsState(pindex, Params().GetConsensus(), Consensus::DEPLOYMENT_MN_RR, llmq_versionbitscache) == ThresholdState::ACTIVE;
Expand Down
4 changes: 0 additions & 4 deletions src/masternode/payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@

if (llmq::utils::IsMNRewardReallocationActive(pindexPrev)) {
CAmount masternodeSubsidyReward = GetMasternodePayment(nBlockHeight, blockSubsidy, fV20Active);
// TODO remove this when we re-organize testnet
if (Params().NetworkIDString() == CBaseChainParams::TESTNET) {
masternodeSubsidyReward = masternodeReward;
}
const CAmount platformReward = MasternodePayments::PlatformShare(masternodeSubsidyReward);
masternodeReward -= platformReward;

Expand Down
10 changes: 2 additions & 8 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1129,8 +1129,7 @@ static std::pair<CAmount, CAmount> GetBlockSubsidyHelper(int nPrevBits, int nPre
dDiff = ConvertBitsToDouble(nPrevBits);
}

// TODO remove "not testnet" condition when we re-organize testnet
if (fV20Active && Params().NetworkIDString() != CBaseChainParams::TESTNET) {
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.
Expand Down Expand Up @@ -1172,8 +1171,6 @@ static std::pair<CAmount, CAmount> GetBlockSubsidyHelper(int nPrevBits, int nPre
// Hard fork to reduce the block reward by 10 extra percent (allowing budget/superblocks)
if (nPrevHeight > consensusParams.nBudgetPaymentsStartBlock) {
// Once v20 is active, the treasury is 20% instead of 10%
// TODO remove this when we re-organize testnet
if (Params().NetworkIDString() == CBaseChainParams::TESTNET) fV20Active = false;
nSuperblockPart = nSubsidy / (fV20Active ? 5 : 10);
}
return {nSubsidy - nSuperblockPart, nSuperblockPart};
Expand Down Expand Up @@ -1231,8 +1228,6 @@ CAmount GetMasternodePayment(int nHeight, CAmount blockValue, bool fV20Active)
return ret;
}

// TODO remove this when we re-organize testnet
if (Params().NetworkIDString() == CBaseChainParams::TESTNET) fV20Active = false;
if (fV20Active) {
// Once MNRewardReallocated activates, block reward is 80% of block subsidy (+ tx fees) since treasury is 20%
// Since the MN reward needs to be equal to 60% of the block subsidy (according to the proposal), MN reward is set to 75% of the block reward.
Expand Down Expand Up @@ -2400,8 +2395,7 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
int64_t nTime5_2 = GetTimeMicros(); nTimeSubsidy += nTime5_2 - nTime5_1;
LogPrint(BCLog::BENCHMARK, " - GetBlockSubsidy: %.2fms [%.2fs (%.2fms/blk)]\n", MILLI * (nTime5_2 - nTime5_1), nTimeSubsidy * MICRO, nTimeSubsidy * MILLI / nBlocksTotal);

// TODO remove "if testnet" condition when we re-organize testnet
if (!CheckCreditPoolDiffForBlock(block, pindex, m_params.GetConsensus(), (m_params.NetworkIDString() == CBaseChainParams::TESTNET) ? (blockSubsidy + feeReward) : blockSubsidy, state)) {
if (!CheckCreditPoolDiffForBlock(block, pindex, m_params.GetConsensus(), blockSubsidy, state)) {
return error("ConnectBlock(DASH): CheckCreditPoolDiffForBlock for block %s failed with %s",
pindex->GetBlockHash().ToString(), state.ToString());
}
Expand Down

0 comments on commit 5f7d5fe

Please sign in to comment.