aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSjors Provoost <sjors@sprovoost.nl>2024-08-15 17:13:33 +0200
committerSjors Provoost <sjors@sprovoost.nl>2024-08-20 13:25:00 +0200
commite85f386c4b157b7d1ac16aface9bd2c614e62b46 (patch)
treed73744dd7d40f8d64cc2961f8fcf9da6f760316d /src
parentdd154b05689c60fad45df0df6d31cec12e09ab21 (diff)
downloadbitcoin-e85f386c4b157b7d1ac16aface9bd2c614e62b46.tar.xz
consensus: enable BIP94 on regtest
Diffstat (limited to 'src')
-rw-r--r--src/consensus/params.h4
-rw-r--r--src/kernel/chainparams.cpp2
-rw-r--r--src/validation.cpp2
3 files changed, 6 insertions, 2 deletions
diff --git a/src/consensus/params.h b/src/consensus/params.h
index d970e41637..eadfe2ba90 100644
--- a/src/consensus/params.h
+++ b/src/consensus/params.h
@@ -108,6 +108,10 @@ struct Params {
/** Proof of work parameters */
uint256 powLimit;
bool fPowAllowMinDifficultyBlocks;
+ /**
+ * Enfore BIP94 timewarp attack mitigation. On testnet4 this also enforces
+ * the block storm mitigation.
+ */
bool enforce_BIP94;
bool fPowNoRetargeting;
int64_t nPowTargetSpacing;
diff --git a/src/kernel/chainparams.cpp b/src/kernel/chainparams.cpp
index bf0415667e..e7cf56ecbc 100644
--- a/src/kernel/chainparams.cpp
+++ b/src/kernel/chainparams.cpp
@@ -540,7 +540,7 @@ public:
consensus.nPowTargetTimespan = 24 * 60 * 60; // one day
consensus.nPowTargetSpacing = 10 * 60;
consensus.fPowAllowMinDifficultyBlocks = true;
- consensus.enforce_BIP94 = false;
+ consensus.enforce_BIP94 = true;
consensus.fPowNoRetargeting = true;
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
diff --git a/src/validation.cpp b/src/validation.cpp
index bf2b4b315e..8c80e35c01 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -4189,7 +4189,7 @@ static bool ContextualCheckBlockHeader(const CBlockHeader& block, BlockValidatio
if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast())
return state.Invalid(BlockValidationResult::BLOCK_INVALID_HEADER, "time-too-old", "block's timestamp is too early");
- // Testnet4 only: Check timestamp against prev for difficulty-adjustment
+ // Testnet4 and regtest only: Check timestamp against prev for difficulty-adjustment
// blocks to prevent timewarp attacks (see https://github.com/bitcoin/bitcoin/pull/15482).
if (consensusParams.enforce_BIP94) {
// Check timestamp for the first block of each difficulty adjustment