@@ -59,8 +59,7 @@ class TestAlwaysActiveConditionChecker : public TestConditionChecker
59
59
class TestNeverActiveConditionChecker : public TestConditionChecker
60
60
{
61
61
public:
62
- int64_t BeginTime (const Consensus::Params& params) const override { return 0 ; }
63
- int64_t EndTime (const Consensus::Params& params) const override { return 1230768000 ; }
62
+ int64_t BeginTime (const Consensus::Params& params) const override { return Consensus::BIP9Deployment::NEVER_ACTIVE; }
64
63
};
65
64
66
65
#define CHECKERS 6
@@ -134,10 +133,7 @@ class VersionBitsTester
134
133
BOOST_CHECK_MESSAGE (checker[i].GetStateSinceHeightFor (tip) == height, strprintf (" Test %i for StateSinceHeight" , num));
135
134
BOOST_CHECK_MESSAGE (checker_delayed[i].GetStateSinceHeightFor (tip) == height_delayed, strprintf (" Test %i for StateSinceHeight (delayed)" , num));
136
135
BOOST_CHECK_MESSAGE (checker_always[i].GetStateSinceHeightFor (tip) == 0 , strprintf (" Test %i for StateSinceHeight (always active)" , num));
137
-
138
- // never active may go from DEFINED -> FAILED at the first period
139
- const auto never_height = checker_never[i].GetStateSinceHeightFor (tip);
140
- BOOST_CHECK_MESSAGE (never_height == 0 || never_height == checker_never[i].Period (paramsDummy), strprintf (" Test %i for StateSinceHeight (never active)" , num));
136
+ BOOST_CHECK_MESSAGE (checker_never[i].GetStateSinceHeightFor (tip) == 0 , strprintf (" Test %i for StateSinceHeight (never active)" , num));
141
137
}
142
138
}
143
139
num++;
@@ -170,7 +166,7 @@ class VersionBitsTester
170
166
BOOST_CHECK_MESSAGE (got == exp, strprintf (" Test %i for %s height %d (got %s)" , num, StateName (exp), height, StateName (got)));
171
167
BOOST_CHECK_MESSAGE (got_delayed == exp_delayed, strprintf (" Test %i for %s height %d (got %s; delayed case)" , num, StateName (exp_delayed), height, StateName (got_delayed)));
172
168
BOOST_CHECK_MESSAGE (got_always == ThresholdState::ACTIVE, strprintf (" Test %i for ACTIVE height %d (got %s; always active case)" , num, height, StateName (got_always)));
173
- BOOST_CHECK_MESSAGE (got_never == ThresholdState::DEFINED|| got_never == ThresholdState:: FAILED, strprintf (" Test %i for DEFINED/ FAILED height %d (got %s; never active case)" , num, height, StateName (got_never)));
169
+ BOOST_CHECK_MESSAGE (got_never == ThresholdState::FAILED, strprintf (" Test %i for FAILED height %d (got %s; never active case)" , num, height, StateName (got_never)));
174
170
}
175
171
}
176
172
num++;
@@ -270,7 +266,7 @@ BOOST_AUTO_TEST_CASE(versionbits_sanity)
270
266
// Check min_activation_height is on a retarget boundary
271
267
BOOST_CHECK_EQUAL (mainnetParams.vDeployments [i].min_activation_height % mainnetParams.nMinerConfirmationWindow , 0 );
272
268
// Check min_activation_height is 0 for ALWAYS_ACTIVE and never active deployments
273
- if (mainnetParams.vDeployments [i].nStartTime == Consensus::BIP9Deployment::ALWAYS_ACTIVE || mainnetParams.vDeployments [i].nTimeout <= 1230768000 ) {
269
+ if (mainnetParams.vDeployments [i].nStartTime == Consensus::BIP9Deployment::ALWAYS_ACTIVE || mainnetParams.vDeployments [i].nStartTime == Consensus::BIP9Deployment::NEVER_ACTIVE ) {
274
270
BOOST_CHECK_EQUAL (mainnetParams.vDeployments [i].min_activation_height , 0 );
275
271
}
276
272
@@ -304,8 +300,9 @@ static void check_computeblockversion(const Consensus::Params& params, Consensus
304
300
// should not be any signalling for first block
305
301
BOOST_CHECK_EQUAL (ComputeBlockVersion (nullptr , params), VERSIONBITS_TOP_BITS);
306
302
307
- // always active deployments shouldn't need to be tested further
303
+ // always/never active deployments shouldn't need to be tested further
308
304
if (nStartTime == Consensus::BIP9Deployment::ALWAYS_ACTIVE) return ;
305
+ if (nStartTime == Consensus::BIP9Deployment::NEVER_ACTIVE) return ;
309
306
310
307
BOOST_REQUIRE (nStartTime < nTimeout);
311
308
BOOST_REQUIRE (nStartTime >= 0 );
@@ -447,6 +444,15 @@ BOOST_AUTO_TEST_CASE(versionbits_computeblockversion)
447
444
}
448
445
}
449
446
447
+ {
448
+ // Use regtest/testdummy to ensure we always exercise some
449
+ // deployment that's not always/never active
450
+ ArgsManager args;
451
+ args.ForceSetArg (" -vbparams" , " testdummy:1199145601:1230767999" ); // January 1, 2008 - December 31, 2008
452
+ const auto chainParams = CreateChainParams (args, CBaseChainParams::REGTEST);
453
+ check_computeblockversion (chainParams->GetConsensus (), Consensus::DEPLOYMENT_TESTDUMMY);
454
+ }
455
+
450
456
{
451
457
// Use regtest/testdummy to ensure we always exercise the
452
458
// min_activation_height test, even if we're not using that in a
0 commit comments