diff --git a/src/consensus/consensus.h b/src/consensus/consensus.h --- a/src/consensus/consensus.h +++ b/src/consensus/consensus.h @@ -36,8 +36,6 @@ /** Flags for nSequence and nLockTime locks */ /** Interpret sequence numbers as relative lock-time constraints. */ static constexpr unsigned int LOCKTIME_VERIFY_SEQUENCE = (1 << 0); -/** Use GetMedianTimePast() instead of nTime for end point timestamp. */ -static constexpr unsigned int LOCKTIME_MEDIAN_TIME_PAST = (1 << 1); /** * Compute the maximum number of sigchecks that can be contained in a block diff --git a/src/node/miner.h b/src/node/miner.h --- a/src/node/miner.h +++ b/src/node/miner.h @@ -63,8 +63,7 @@ // Chain context for the block int nHeight; - int64_t nLockTimeCutoff; - int64_t nMedianTimePast; + int64_t m_lock_time_cutoff; const CChainParams &chainParams; const CTxMemPool &m_mempool; diff --git a/src/node/miner.cpp b/src/node/miner.cpp --- a/src/node/miner.cpp +++ b/src/node/miner.cpp @@ -150,11 +150,7 @@ } pblock->nTime = GetAdjustedTime(); - nMedianTimePast = pindexPrev->GetMedianTimePast(); - nLockTimeCutoff = - (STANDARD_LOCKTIME_VERIFY_FLAGS & LOCKTIME_MEDIAN_TIME_PAST) - ? nMedianTimePast - : pblock->GetBlockTime(); + m_lock_time_cutoff = pindexPrev->GetMedianTimePast(); addTxs(); @@ -284,7 +280,7 @@ bool BlockAssembler::CheckTx(const CTransaction &tx) const { TxValidationState state; return ContextualCheckTransaction(chainParams.GetConsensus(), tx, state, - nHeight, nLockTimeCutoff); + nHeight, m_lock_time_cutoff); } /** diff --git a/src/policy/policy.h b/src/policy/policy.h --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -109,7 +109,7 @@ * code. */ static constexpr uint32_t STANDARD_LOCKTIME_VERIFY_FLAGS{ - LOCKTIME_VERIFY_SEQUENCE | LOCKTIME_MEDIAN_TIME_PAST}; + LOCKTIME_VERIFY_SEQUENCE}; Amount GetDustThreshold(const CTxOut &txout, const CFeeRate &dustRelayFee); diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -405,7 +405,7 @@ // non-final txs in mempool SetMockTime(m_node.chainman->ActiveTip()->GetMedianTimePast() + 1); - const uint32_t flags{LOCKTIME_VERIFY_SEQUENCE | LOCKTIME_MEDIAN_TIME_PAST}; + const uint32_t flags{LOCKTIME_VERIFY_SEQUENCE}; // height map std::vector prevheights; diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -4025,18 +4025,18 @@ const int nHeight = pindexPrev == nullptr ? 0 : pindexPrev->nHeight + 1; // Enforce BIP113 (Median Time Past). - int nLockTimeFlags = 0; + bool enforce_locktime_median_time_past{false}; if (DeploymentActiveAfter(pindexPrev, params, Consensus::DEPLOYMENT_CSV)) { assert(pindexPrev != nullptr); - nLockTimeFlags |= LOCKTIME_MEDIAN_TIME_PAST; + enforce_locktime_median_time_past = true; } const int64_t nMedianTimePast = pindexPrev == nullptr ? 0 : pindexPrev->GetMedianTimePast(); - const int64_t nLockTimeCutoff = (nLockTimeFlags & LOCKTIME_MEDIAN_TIME_PAST) - ? nMedianTimePast - : block.GetBlockTime(); + const int64_t nLockTimeCutoff{enforce_locktime_median_time_past + ? nMedianTimePast + : block.GetBlockTime()}; const bool fIsMagneticAnomalyEnabled = IsMagneticAnomalyEnabled(params, pindexPrev);