Skip to content

Commit e85f386

Browse files
committed
consensus: enable BIP94 on regtest
1 parent dd154b0 commit e85f386

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

doc/release-notes-30647.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Tests
2+
-----
3+
4+
- The BIP94 timewarp attack mitigation is now active on the `regtest` network

src/consensus/params.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ struct Params {
108108
/** Proof of work parameters */
109109
uint256 powLimit;
110110
bool fPowAllowMinDifficultyBlocks;
111+
/**
112+
* Enfore BIP94 timewarp attack mitigation. On testnet4 this also enforces
113+
* the block storm mitigation.
114+
*/
111115
bool enforce_BIP94;
112116
bool fPowNoRetargeting;
113117
int64_t nPowTargetSpacing;

src/kernel/chainparams.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ class CRegTestParams : public CChainParams
540540
consensus.nPowTargetTimespan = 24 * 60 * 60; // one day
541541
consensus.nPowTargetSpacing = 10 * 60;
542542
consensus.fPowAllowMinDifficultyBlocks = true;
543-
consensus.enforce_BIP94 = false;
543+
consensus.enforce_BIP94 = true;
544544
consensus.fPowNoRetargeting = true;
545545
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
546546
consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4189,7 +4189,7 @@ static bool ContextualCheckBlockHeader(const CBlockHeader& block, BlockValidatio
41894189
if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast())
41904190
return state.Invalid(BlockValidationResult::BLOCK_INVALID_HEADER, "time-too-old", "block's timestamp is too early");
41914191

4192-
// Testnet4 only: Check timestamp against prev for difficulty-adjustment
4192+
// Testnet4 and regtest only: Check timestamp against prev for difficulty-adjustment
41934193
// blocks to prevent timewarp attacks (see https://github.com/bitcoin/bitcoin/pull/15482).
41944194
if (consensusParams.enforce_BIP94) {
41954195
// Check timestamp for the first block of each difficulty adjustment

0 commit comments

Comments
 (0)