mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 04:12:36 -03:00
Remove LOCKTIME_MEDIAN_TIME_PAST constant
This commit is contained in:
parent
e3b06e8dd8
commit
fa1fe2e500
4 changed files with 8 additions and 11 deletions
|
@ -26,7 +26,5 @@ static const size_t MIN_SERIALIZABLE_TRANSACTION_WEIGHT = WITNESS_SCALE_FACTOR *
|
||||||
/** Flags for nSequence and nLockTime locks */
|
/** Flags for nSequence and nLockTime locks */
|
||||||
/** Interpret sequence numbers as relative lock-time constraints. */
|
/** Interpret sequence numbers as relative lock-time constraints. */
|
||||||
static constexpr unsigned int LOCKTIME_VERIFY_SEQUENCE = (1 << 0);
|
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);
|
|
||||||
|
|
||||||
#endif // BITCOIN_CONSENSUS_CONSENSUS_H
|
#endif // BITCOIN_CONSENSUS_CONSENSUS_H
|
||||||
|
|
|
@ -101,8 +101,7 @@ static constexpr unsigned int STANDARD_SCRIPT_VERIFY_FLAGS{MANDATORY_SCRIPT_VERI
|
||||||
static constexpr unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS{STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS};
|
static constexpr unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS{STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS};
|
||||||
|
|
||||||
/** Used as the flags parameter to sequence and nLocktime checks in non-consensus code. */
|
/** Used as the flags parameter to sequence and nLocktime checks in non-consensus code. */
|
||||||
static constexpr unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS{LOCKTIME_VERIFY_SEQUENCE |
|
static constexpr unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS{LOCKTIME_VERIFY_SEQUENCE};
|
||||||
LOCKTIME_MEDIAN_TIME_PAST};
|
|
||||||
|
|
||||||
CAmount GetDustThreshold(const CTxOut& txout, const CFeeRate& dustRelayFee);
|
CAmount GetDustThreshold(const CTxOut& txout, const CFeeRate& dustRelayFee);
|
||||||
|
|
||||||
|
|
|
@ -369,8 +369,8 @@ void MinerTestingSetup::TestBasicMining(const CChainParams& chainparams, const C
|
||||||
}
|
}
|
||||||
|
|
||||||
// non-final txs in mempool
|
// non-final txs in mempool
|
||||||
SetMockTime(m_node.chainman->ActiveChain().Tip()->GetMedianTimePast()+1);
|
SetMockTime(m_node.chainman->ActiveChain().Tip()->GetMedianTimePast() + 1);
|
||||||
const int flags{LOCKTIME_VERIFY_SEQUENCE | LOCKTIME_MEDIAN_TIME_PAST};
|
const int flags{LOCKTIME_VERIFY_SEQUENCE};
|
||||||
// height map
|
// height map
|
||||||
std::vector<int> prevheights;
|
std::vector<int> prevheights;
|
||||||
|
|
||||||
|
|
|
@ -3491,15 +3491,15 @@ static bool ContextualCheckBlock(const CBlock& block, BlockValidationState& stat
|
||||||
const int nHeight = pindexPrev == nullptr ? 0 : pindexPrev->nHeight + 1;
|
const int nHeight = pindexPrev == nullptr ? 0 : pindexPrev->nHeight + 1;
|
||||||
|
|
||||||
// Enforce BIP113 (Median Time Past).
|
// Enforce BIP113 (Median Time Past).
|
||||||
int nLockTimeFlags = 0;
|
bool enforce_locktime_median_time_past{false};
|
||||||
if (DeploymentActiveAfter(pindexPrev, chainman, Consensus::DEPLOYMENT_CSV)) {
|
if (DeploymentActiveAfter(pindexPrev, chainman, Consensus::DEPLOYMENT_CSV)) {
|
||||||
assert(pindexPrev != nullptr);
|
assert(pindexPrev != nullptr);
|
||||||
nLockTimeFlags |= LOCKTIME_MEDIAN_TIME_PAST;
|
enforce_locktime_median_time_past = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t nLockTimeCutoff = (nLockTimeFlags & LOCKTIME_MEDIAN_TIME_PAST)
|
const int64_t nLockTimeCutoff{enforce_locktime_median_time_past ?
|
||||||
? pindexPrev->GetMedianTimePast()
|
pindexPrev->GetMedianTimePast() :
|
||||||
: block.GetBlockTime();
|
block.GetBlockTime()};
|
||||||
|
|
||||||
// Check that all transactions are finalized
|
// Check that all transactions are finalized
|
||||||
for (const auto& tx : block.vtx) {
|
for (const auto& tx : block.vtx) {
|
||||||
|
|
Loading…
Reference in a new issue