From 733fa0b0a140fc1e40c644a29953db090baa2890 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Tue, 26 Nov 2024 12:47:13 -0500 Subject: [PATCH] miner: never create a template which exploits the timewarp bug --- src/node/miner.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/node/miner.cpp b/src/node/miner.cpp index 790ee1c146653..2f949f288499e 100644 --- a/src/node/miner.cpp +++ b/src/node/miner.cpp @@ -33,12 +33,10 @@ int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParam int64_t nOldTime = pblock->nTime; int64_t nNewTime{std::max(pindexPrev->GetMedianTimePast() + 1, TicksSinceEpoch(NodeClock::now()))}; - if (consensusParams.enforce_BIP94) { - // Height of block to be mined. - const int height{pindexPrev->nHeight + 1}; - if (height % consensusParams.DifficultyAdjustmentInterval() == 0) { - nNewTime = std::max(nNewTime, pindexPrev->GetBlockTime() - MAX_TIMEWARP); - } + // Height of block to be mined. + const int height{pindexPrev->nHeight + 1}; + if (height % consensusParams.DifficultyAdjustmentInterval() == 0) { + nNewTime = std::max(nNewTime, pindexPrev->GetBlockTime() - MAX_TIMEWARP); } if (nOldTime < nNewTime) {