chore: Testnet re-organization required changes (#5619)

## 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)_
This commit is contained in:
Odysseas Gabrielides 2023-10-23 20:35:15 +03:00 committed by GitHub
parent 5c08afd80e
commit 5f7d5fee1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 13 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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.
@ -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};
@ -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.
@ -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());
}