From b20544c499fef3d1ac411016cd2355b4969e4feb Mon Sep 17 00:00:00 2001 From: NotRin7 Date: Mon, 24 Nov 2025 00:03:44 +0100 Subject: [PATCH] add params to chainparams.cpp --- src/chainparams.cpp | 3 +++ src/consensus/params.h | 1 + src/pow.cpp | 3 ++- src/validation.cpp | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index df29ec1..ebb6168 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -65,6 +65,7 @@ public: CMainParams() { strNetworkID = CBaseChainParams::MAIN; consensus.nSubsidyHalvingInterval = 210000; + consensus.nResilienceForkHeight = 340000; consensus.BIP16Exception = uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"); consensus.BIP34Height = 29000; @@ -184,6 +185,7 @@ public: CTestNetParams() { strNetworkID = CBaseChainParams::TESTNET; consensus.nSubsidyHalvingInterval = 210000; + consensus.nResilienceForkHeight = 2000; consensus.BIP34Height = 1700; consensus.BIP34Hash = uint256(); @@ -273,6 +275,7 @@ public: explicit CRegTestParams(const ArgsManager& args) { strNetworkID = CBaseChainParams::REGTEST; consensus.nSubsidyHalvingInterval = 150; + consensus.nResilienceForkHeight = 200; consensus.BIP16Exception = uint256(); consensus.BIP34Height = 0; consensus.BIP34Hash = uint256(); diff --git a/src/consensus/params.h b/src/consensus/params.h index 7cc7890..1cd2c66 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -45,6 +45,7 @@ struct BIP9Deployment { struct Params { uint256 hashGenesisBlock; int nSubsidyHalvingInterval; + int nResilienceForkHeight; /* Block hash that is excepted from BIP16 enforcement */ uint256 BIP16Exception; /** Block height and hash at which BIP34 becomes active */ diff --git a/src/pow.cpp b/src/pow.cpp index 6a4e2a0..1c5e8a1 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -5,6 +5,7 @@ #include +#include #include #include #include @@ -29,7 +30,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead return LwmaCalculateNextWorkRequired(pindexLast, params); // Palladium: Hard Fork at 350,000 for fast difficulty adjustment - if (pindexLast->nHeight + 1 >= 340000) { + if (pindexLast->nHeight + 1 >= params.nResilienceForkHeight) { int64_t nIntervalNew = 60; if ((pindexLast->nHeight + 1) % nIntervalNew != 0) return pindexLast->nBits; diff --git a/src/validation.cpp b/src/validation.cpp index 8ef53d4..bd12a8c 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -564,7 +564,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws) return state.Invalid(TxValidationResult::TX_NOT_STANDARD, reason); // Check OP_RETURN size based on activation height - if (ChainActive().Height() < 340000) { + if (ChainActive().Height() < Params().GetConsensus().nResilienceForkHeight) { for (const CTxOut& txout : tx.vout) { if (txout.scriptPubKey.IsUnspendable() && txout.scriptPubKey.size() > 83) { return state.Invalid(TxValidationResult::TX_NOT_STANDARD, "bad-txns-oversize-opreturn-prefork");