mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-20 14:05:23 +01:00
consensus: enable BIP94 on regtest
This commit is contained in:
parent
dd154b0568
commit
e85f386c4b
4 changed files with 10 additions and 2 deletions
4
doc/release-notes-30647.md
Normal file
4
doc/release-notes-30647.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
Tests
|
||||
-----
|
||||
|
||||
- The BIP94 timewarp attack mitigation is now active on the `regtest` network
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue