mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-25 16:31:29 +02:00
Merge bitcoin/bitcoin#31156: test: Don't enforce BIP94 on regtest unless specified by arg
e60cecc8115d3b28be076792baa5e4ea26d353a6 doc: add release note for 31156 (Martin Zumsande) fc7dfb3df5b932cc015817c4461e7017601d607f test: Don't enforce BIP94 on regtest unless specified by arg (Martin Zumsande) Pull request description: The added arg `-test=bip94` is only used in a functional test for BIP94. This is done because the default regtest consensus rules should follow mainnet, not testnet. Fixes #31137. ACKs for top commit: achow101: ACK e60cecc8115d3b28be076792baa5e4ea26d353a6 tdb3: cr and light test ACK e60cecc8115d3b28be076792baa5e4ea26d353a6 rkrux: tACK e60cecc8115d3b28be076792baa5e4ea26d353a6 BrandonOdiwuor: utACK e60cecc8115d3b28be076792baa5e4ea26d353a6 laanwj: Code review ACK e60cecc8115d3b28be076792baa5e4ea26d353a6 Tree-SHA512: ca2f322f89d8808dfc3565fe020d2615cfcc110e188a02128ad7108fef51c735b33d55b5e6a70c505d78f7291f3c635dc7dfbcd78be1348d4d6e483883be4216
This commit is contained in:
commit
4a31f8ccc9
4
doc/release-notes-31156.md
Normal file
4
doc/release-notes-31156.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Test
|
||||||
|
------
|
||||||
|
|
||||||
|
The BIP94 timewarp attack mitigation (designed for testnet4) is no longer active on the regtest network. (#31156)
|
@ -44,6 +44,7 @@ void ReadSigNetArgs(const ArgsManager& args, CChainParams::SigNetOptions& option
|
|||||||
void ReadRegTestArgs(const ArgsManager& args, CChainParams::RegTestOptions& options)
|
void ReadRegTestArgs(const ArgsManager& args, CChainParams::RegTestOptions& options)
|
||||||
{
|
{
|
||||||
if (auto value = args.GetBoolArg("-fastprune")) options.fastprune = *value;
|
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")) {
|
for (const std::string& arg : args.GetArgs("-testactivationheight")) {
|
||||||
const auto found{arg.find('@')};
|
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{
|
const std::vector<std::string> TEST_OPTIONS_DOC{
|
||||||
"addrman (use deterministic addrman)",
|
"addrman (use deterministic addrman)",
|
||||||
|
"bip94 (enforce BIP94 consensus rules)",
|
||||||
};
|
};
|
||||||
|
|
||||||
bool HasTestOption(const ArgsManager& args, const std::string& test_option)
|
bool HasTestOption(const ArgsManager& args, const std::string& test_option)
|
||||||
|
@ -542,7 +542,7 @@ public:
|
|||||||
consensus.nPowTargetTimespan = 24 * 60 * 60; // one day
|
consensus.nPowTargetTimespan = 24 * 60 * 60; // one day
|
||||||
consensus.nPowTargetSpacing = 10 * 60;
|
consensus.nPowTargetSpacing = 10 * 60;
|
||||||
consensus.fPowAllowMinDifficultyBlocks = true;
|
consensus.fPowAllowMinDifficultyBlocks = true;
|
||||||
consensus.enforce_BIP94 = true;
|
consensus.enforce_BIP94 = opts.enforce_bip94;
|
||||||
consensus.fPowNoRetargeting = true;
|
consensus.fPowNoRetargeting = true;
|
||||||
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
|
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
|
||||||
consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
|
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::DeploymentPos, VersionBitsParameters> version_bits_parameters{};
|
||||||
std::unordered_map<Consensus::BuriedDeployment, int> activation_heights{};
|
std::unordered_map<Consensus::BuriedDeployment, int> activation_heights{};
|
||||||
bool fastprune{false};
|
bool fastprune{false};
|
||||||
|
bool enforce_bip94{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::unique_ptr<const CChainParams> RegTest(const RegTestOptions& options);
|
static std::unique_ptr<const CChainParams> RegTest(const RegTestOptions& options);
|
||||||
|
@ -122,6 +122,7 @@ class MiningTest(BitcoinTestFramework):
|
|||||||
def test_timewarp(self):
|
def test_timewarp(self):
|
||||||
self.log.info("Test timewarp attack mitigation (BIP94)")
|
self.log.info("Test timewarp attack mitigation (BIP94)")
|
||||||
node = self.nodes[0]
|
node = self.nodes[0]
|
||||||
|
self.restart_node(0, extra_args=['-test=bip94'])
|
||||||
|
|
||||||
self.log.info("Mine until the last block of the retarget period")
|
self.log.info("Mine until the last block of the retarget period")
|
||||||
blockchain_info = self.nodes[0].getblockchaininfo()
|
blockchain_info = self.nodes[0].getblockchaininfo()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user