@@ -273,20 +273,6 @@ BOOST_AUTO_TEST_CASE(versionbits_sanity)
273
273
if (mainnetParams.vDeployments [i].nStartTime == Consensus::BIP9Deployment::ALWAYS_ACTIVE || mainnetParams.vDeployments [i].nStartTime == Consensus::BIP9Deployment::NEVER_ACTIVE) {
274
274
BOOST_CHECK_EQUAL (mainnetParams.vDeployments [i].min_activation_height , 0 );
275
275
}
276
-
277
- // Verify that the deployment windows of different deployment using the
278
- // same bit are disjoint.
279
- // This test may need modification at such time as a new deployment
280
- // is proposed that reuses the bit of an activated soft fork, before the
281
- // end time of that soft fork. (Alternatively, the end time of that
282
- // activated soft fork could be later changed to be earlier to avoid
283
- // overlap.)
284
- for (int j=i+1 ; j<(int ) Consensus::MAX_VERSION_BITS_DEPLOYMENTS; j++) {
285
- if (VersionBitsMask (mainnetParams, static_cast <Consensus::DeploymentPos>(j)) == bitmask) {
286
- BOOST_CHECK (mainnetParams.vDeployments [j].nStartTime > mainnetParams.vDeployments [i].nTimeout ||
287
- mainnetParams.vDeployments [i].nStartTime > mainnetParams.vDeployments [j].nTimeout );
288
- }
289
- }
290
276
}
291
277
}
292
278
@@ -443,8 +429,18 @@ BOOST_AUTO_TEST_CASE(versionbits_computeblockversion)
443
429
// ACTIVE and FAILED states in roughly the way we expect
444
430
for (const auto & chain_name : {CBaseChainParams::MAIN, CBaseChainParams::TESTNET, CBaseChainParams::SIGNET, CBaseChainParams::REGTEST}) {
445
431
const auto chainParams = CreateChainParams (*m_node.args , chain_name);
432
+ uint32_t chain_all_vbits{0 };
446
433
for (int i = 0 ; i < (int )Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++i) {
447
- check_computeblockversion (chainParams->GetConsensus (), static_cast <Consensus::DeploymentPos>(i));
434
+ const auto dep = static_cast <Consensus::DeploymentPos>(i);
435
+ // Check that no bits are re-used (within the same chain). This is
436
+ // disallowed because the transition to FAILED (on timeout) does
437
+ // not take precedence over STARTED/LOCKED_IN. So all softforks on
438
+ // the same bit might overlap, even when non-overlapping start-end
439
+ // times are picked.
440
+ const uint32_t dep_mask{VersionBitsMask (chainParams->GetConsensus (), dep)};
441
+ BOOST_CHECK (!(chain_all_vbits & dep_mask));
442
+ chain_all_vbits |= dep_mask;
443
+ check_computeblockversion (chainParams->GetConsensus (), dep);
448
444
}
449
445
}
450
446
0 commit comments