Skip to content

Commit 6b2210f

Browse files
author
MarcoFalke
committed
Merge #16713: Ignore old versionbit activations to avoid 'unknown softforks' warning
fdb3e8f Ignore old versionbit activations (Anthony Towns) Pull request description: PR 16060 removed the CSV and Segwit BIP9 softfork definitions and hard-coded ('buried') the activation heights. The versionbits code will warn users if an undefined softfork has been signalled in block header versions, and removing the CSV/Segwit definitions caused those warnings to be triggered. Change the BIP 9 warning code to only check for unknown softforks after the segwit activation height. ACKs for top commit: MarcoFalke: ACK fdb3e8f ajtowns: ACK fdb3e8f for what it's worth achow101: ACK fdb3e8f Sjors: ACK fdb3e8f. It makes the bit 0 warning go away in mainnet and testnet QT when a new block arrives. I think the code is clear enough. jonatack: ACK fdb3e8f Tree-SHA512: e6fd34e8902f8c7affb28e8951803e47d542710d5f1229000746656a37ee59d754439fc33e36b7eef87544262e5aac374645db91b74cb507e73514003ca7a67f
2 parents a6c8aed + fdb3e8f commit 6b2210f

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/chainparams.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class CMainParams : public CChainParams {
7171
consensus.BIP66Height = 363725; // 00000000000000000379eaa19dce8c9b722d46ae6a57c2f1a988119488b50931
7272
consensus.CSVHeight = 419328; // 000000000000000004a1b34462cb8aeebd5799177f7a29cf28f2d1961716b5b5
7373
consensus.SegwitHeight = 481824; // 0000000000000000001c8018d9cb3b742ef25114f27563e3fc4a1902167f9893
74+
consensus.MinBIP9WarningHeight = consensus.SegwitHeight + consensus.nMinerConfirmationWindow;
7475
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
7576
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
7677
consensus.nPowTargetSpacing = 10 * 60;
@@ -177,6 +178,7 @@ class CTestNetParams : public CChainParams {
177178
consensus.BIP66Height = 330776; // 000000002104c8c45e99a8853285a3b592602a3ccde2b832481da85e9e4ba182
178179
consensus.CSVHeight = 770112; // 00000000025e930139bac5c6c31a403776da130831ab85be56578f3fa75369bb
179180
consensus.SegwitHeight = 834624; // 00000000002b980fcd729daaa248fd9316a5200e9b367f4ff2c42453e84201ca
181+
consensus.MinBIP9WarningHeight = consensus.SegwitHeight + consensus.nMinerConfirmationWindow;
180182
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
181183
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
182184
consensus.nPowTargetSpacing = 10 * 60;
@@ -261,6 +263,7 @@ class CRegTestParams : public CChainParams {
261263
consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in functional tests)
262264
consensus.CSVHeight = 432; // CSV activated on regtest (Used in rpc activation tests)
263265
consensus.SegwitHeight = 0; // SEGWIT is always activated on regtest unless overridden
266+
consensus.MinBIP9WarningHeight = 0;
264267
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
265268
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
266269
consensus.nPowTargetSpacing = 10 * 60;

src/consensus/params.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ struct Params {
6262
* Note that segwit v0 script rules are enforced on all blocks except the
6363
* BIP 16 exception blocks. */
6464
int SegwitHeight;
65+
/** Don't warn about unknown BIP 9 activations below this height.
66+
* This prevents us from warning about the CSV and segwit activations. */
67+
int MinBIP9WarningHeight;
6568
/**
6669
* Minimum blocks including miner confirmation of the total of 2016 blocks in a retargeting period,
6770
* (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments.

src/validation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,8 @@ class WarningBitsConditionChecker : public AbstractThresholdConditionChecker
18211821

18221822
bool Condition(const CBlockIndex* pindex, const Consensus::Params& params) const override
18231823
{
1824-
return ((pindex->nVersion & VERSIONBITS_TOP_MASK) == VERSIONBITS_TOP_BITS) &&
1824+
return pindex->nHeight >= params.MinBIP9WarningHeight &&
1825+
((pindex->nVersion & VERSIONBITS_TOP_MASK) == VERSIONBITS_TOP_BITS) &&
18251826
((pindex->nVersion >> bit) & 1) != 0 &&
18261827
((ComputeBlockVersion(pindex->pprev, params) >> bit) & 1) == 0;
18271828
}

0 commit comments

Comments
 (0)