mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-18 13:27:33 +01:00
test: Don't enforce BIP94 on regtest unless specified by arg
The added regtest option -test=bip94 is only used in the functional test for BIP94. This is done because the default regtest consensus rules should aim to follow to mainnet, not testnet.
This commit is contained in:
parent
9a7206a34e
commit
fc7dfb3df5
@ -44,6 +44,7 @@ void ReadSigNetArgs(const ArgsManager& args, CChainParams::SigNetOptions& option
|
||||
void ReadRegTestArgs(const ArgsManager& args, CChainParams::RegTestOptions& options)
|
||||
{
|
||||
if (auto value = args.GetBoolArg("-fastprune")) options.fastprune = *value;
|
||||
if (HasTestOption(args, "bip94")) options.enforce_bip94 = true;
|
||||
|
||||
for (const std::string& arg : args.GetArgs("-testactivationheight")) {
|
||||
const auto found{arg.find('@')};
|
||||
|
@ -709,6 +709,7 @@ std::string HelpMessageOpt(const std::string &option, const std::string &message
|
||||
|
||||
const std::vector<std::string> TEST_OPTIONS_DOC{
|
||||
"addrman (use deterministic addrman)",
|
||||
"bip94 (enforce BIP94 consensus rules)",
|
||||
};
|
||||
|
||||
bool HasTestOption(const ArgsManager& args, const std::string& test_option)
|
||||
|
@ -542,7 +542,7 @@ public:
|
||||
consensus.nPowTargetTimespan = 24 * 60 * 60; // one day
|
||||
consensus.nPowTargetSpacing = 10 * 60;
|
||||
consensus.fPowAllowMinDifficultyBlocks = true;
|
||||
consensus.enforce_BIP94 = true;
|
||||
consensus.enforce_BIP94 = opts.enforce_bip94;
|
||||
consensus.fPowNoRetargeting = true;
|
||||
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
|
||||
consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
|
||||
|
@ -155,6 +155,7 @@ public:
|
||||
std::unordered_map<Consensus::DeploymentPos, VersionBitsParameters> version_bits_parameters{};
|
||||
std::unordered_map<Consensus::BuriedDeployment, int> activation_heights{};
|
||||
bool fastprune{false};
|
||||
bool enforce_bip94{false};
|
||||
};
|
||||
|
||||
static std::unique_ptr<const CChainParams> RegTest(const RegTestOptions& options);
|
||||
|
@ -122,6 +122,7 @@ class MiningTest(BitcoinTestFramework):
|
||||
def test_timewarp(self):
|
||||
self.log.info("Test timewarp attack mitigation (BIP94)")
|
||||
node = self.nodes[0]
|
||||
self.restart_node(0, extra_args=['-test=bip94'])
|
||||
|
||||
self.log.info("Mine until the last block of the retarget period")
|
||||
blockchain_info = self.nodes[0].getblockchaininfo()
|
||||
|
Loading…
Reference in New Issue
Block a user