From ac4dc7f4a6d73e835c35d57c3c82e55afe92d348 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Sun, 12 Dec 2021 20:32:48 +0530 Subject: [PATCH] merge bitcoin#16713: Ignore old versionbit activations to avoid 'unknown softforks' warning --- src/chainparams.cpp | 4 ++++ src/consensus/params.h | 3 +++ src/validation.cpp | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index b589144fb5..46e791f477 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -152,6 +152,7 @@ public: consensus.DIP0003EnforcementHeight = 1047200; consensus.DIP0003EnforcementHash = uint256S("000000000000002d1734087b4c5afc3133e4e1c3e1a89218f62bcd9bb3d17f81"); consensus.DIP0008Height = 1088640; // 00000000000000112e41e4b3afda8b233b8cc07c532d2eac5de097b68358c43e + consensus.MinBIP9WarningHeight = consensus.DIP0008Height + consensus.nMinerConfirmationWindow; consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20 consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes @@ -370,6 +371,7 @@ public: consensus.DIP0003EnforcementHeight = 7300; consensus.DIP0003EnforcementHash = uint256S("00000055ebc0e974ba3a3fb785c5ad4365a39637d4df168169ee80d313612f8f"); consensus.DIP0008Height = 78800; // 000000000e9329d964d80e7dab2e704b43b6bd2b91fea1e9315d38932e55fb55 + consensus.MinBIP9WarningHeight = consensus.DIP0008Height + consensus.nMinerConfirmationWindow; consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20 consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes @@ -561,6 +563,7 @@ public: consensus.DIP0003EnforcementHeight = 2; // DIP0003 activated immediately on devnet consensus.DIP0003EnforcementHash = uint256(); consensus.DIP0008Height = 2; // DIP0008 activated immediately on devnet + consensus.MinBIP9WarningHeight = consensus.DIP0008Height + consensus.nMinerConfirmationWindow; consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1 consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes @@ -795,6 +798,7 @@ public: consensus.DIP0003EnforcementHeight = 500; consensus.DIP0003EnforcementHash = uint256(); consensus.DIP0008Height = 432; + consensus.MinBIP9WarningHeight = 0; consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1 consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes diff --git a/src/consensus/params.h b/src/consensus/params.h index 4f66dc9fd3..51d8cac106 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -85,6 +85,9 @@ struct Params { uint256 DIP0003EnforcementHash; /** Block height at which DIP0008 becomes active */ int DIP0008Height; + /** Don't warn about unknown BIP 9 activations below this height. + * This prevents us from warning about the CSV and DIP activations. */ + int MinBIP9WarningHeight; /** * Minimum blocks including miner confirmation of the total of nMinerConfirmationWindow blocks in a retargeting period, * (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments. diff --git a/src/validation.cpp b/src/validation.cpp index 021323b17d..4db43b8744 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1894,7 +1894,8 @@ public: bool Condition(const CBlockIndex* pindex, const Consensus::Params& params) const override { - return ((pindex->nVersion & VERSIONBITS_TOP_MASK) == VERSIONBITS_TOP_BITS) && + return pindex->nHeight >= params.MinBIP9WarningHeight && + ((pindex->nVersion & VERSIONBITS_TOP_MASK) == VERSIONBITS_TOP_BITS) && ((pindex->nVersion >> bit) & 1) != 0 && ((ComputeBlockVersion(pindex->pprev, params) >> bit) & 1) == 0; }