diff options
author | Anthony Towns <aj@erisian.com.au> | 2021-03-27 23:00:14 +1000 |
---|---|---|
committer | Anthony Towns <aj@erisian.com.au> | 2021-04-12 11:14:49 +1000 |
commit | 55ac5f568a3b73d6f1ef4654617fb76e8bcbccdf (patch) | |
tree | 2119c25550db38ca3befd8030dbae8338bd65aad /src/versionbits.cpp | |
parent | dd07e6da48040dc7eae46bc7941db48d98a669fd (diff) |
versionbits: Add explicit NEVER_ACTIVE deployments
Previously we used deployments that would timeout prior to Bitcoin's
invention, which allowed the deployment to still be activated in unit
tests. This switches those deployments to be truly never active.
Diffstat (limited to 'src/versionbits.cpp')
-rw-r--r-- | src/versionbits.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/versionbits.cpp b/src/versionbits.cpp index 11da729596..df666c963f 100644 --- a/src/versionbits.cpp +++ b/src/versionbits.cpp @@ -18,6 +18,11 @@ ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex* return ThresholdState::ACTIVE; } + // Check if this deployment is never active. + if (nTimeStart == Consensus::BIP9Deployment::NEVER_ACTIVE) { + return ThresholdState::FAILED; + } + // A block's state is always the same as that of the first of its period, so it is computed based on a pindexPrev whose height equals a multiple of nPeriod - 1. if (pindexPrev != nullptr) { pindexPrev = pindexPrev->GetAncestor(pindexPrev->nHeight - ((pindexPrev->nHeight + 1) % nPeriod)); @@ -129,7 +134,7 @@ BIP9Stats AbstractThresholdConditionChecker::GetStateStatisticsFor(const CBlockI int AbstractThresholdConditionChecker::GetStateSinceHeightFor(const CBlockIndex* pindexPrev, const Consensus::Params& params, ThresholdConditionCache& cache) const { int64_t start_time = BeginTime(params); - if (start_time == Consensus::BIP9Deployment::ALWAYS_ACTIVE) { + if (start_time == Consensus::BIP9Deployment::ALWAYS_ACTIVE || start_time == Consensus::BIP9Deployment::NEVER_ACTIVE) { return 0; } |