mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-25 08:21:24 +02:00
consensus: enable BIP94 on regtest
This commit is contained in:
parent
dd154b0568
commit
e85f386c4b
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 */
|
/** Proof of work parameters */
|
||||||
uint256 powLimit;
|
uint256 powLimit;
|
||||||
bool fPowAllowMinDifficultyBlocks;
|
bool fPowAllowMinDifficultyBlocks;
|
||||||
|
/**
|
||||||
|
* Enfore BIP94 timewarp attack mitigation. On testnet4 this also enforces
|
||||||
|
* the block storm mitigation.
|
||||||
|
*/
|
||||||
bool enforce_BIP94;
|
bool enforce_BIP94;
|
||||||
bool fPowNoRetargeting;
|
bool fPowNoRetargeting;
|
||||||
int64_t nPowTargetSpacing;
|
int64_t nPowTargetSpacing;
|
||||||
|
@ -540,7 +540,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 = false;
|
consensus.enforce_BIP94 = true;
|
||||||
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)
|
||||||
|
@ -4189,7 +4189,7 @@ static bool ContextualCheckBlockHeader(const CBlockHeader& block, BlockValidatio
|
|||||||
if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast())
|
if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast())
|
||||||
return state.Invalid(BlockValidationResult::BLOCK_INVALID_HEADER, "time-too-old", "block's timestamp is too early");
|
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).
|
// blocks to prevent timewarp attacks (see https://github.com/bitcoin/bitcoin/pull/15482).
|
||||||
if (consensusParams.enforce_BIP94) {
|
if (consensusParams.enforce_BIP94) {
|
||||||
// Check timestamp for the first block of each difficulty adjustment
|
// Check timestamp for the first block of each difficulty adjustment
|
||||||
|
Loading…
x
Reference in New Issue
Block a user