aboutsummaryrefslogtreecommitdiff
path: root/src/versionbits.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2017-10-11 20:25:05 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2017-11-06 19:19:10 -0800
commitd07ee77ab9e62560c8bbd167207d42aa7686cd7a (patch)
treec4e3e5c1620f3fc22bbb5fb04587385537347731 /src/versionbits.cpp
parent18e071841e83044b47aa45c3e98c0796a407d445 (diff)
downloadbitcoin-d07ee77ab9e62560c8bbd167207d42aa7686cd7a.tar.xz
Always-active versionbits support
Diffstat (limited to 'src/versionbits.cpp')
-rw-r--r--src/versionbits.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/versionbits.cpp b/src/versionbits.cpp
index 64ae939672..fc1acb3258 100644
--- a/src/versionbits.cpp
+++ b/src/versionbits.cpp
@@ -27,6 +27,11 @@ ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex*
int64_t nTimeStart = BeginTime(params);
int64_t nTimeTimeout = EndTime(params);
+ // Check if this deployment is always active.
+ if (nTimeStart == Consensus::BIP9Deployment::ALWAYS_ACTIVE) {
+ return THRESHOLD_ACTIVE;
+ }
+
// 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));
@@ -136,6 +141,11 @@ 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) {
+ return 0;
+ }
+
const ThresholdState initialState = GetStateFor(pindexPrev, params, cache);
// BIP 9 about state DEFINED: "The genesis block is by definition in this state for each deployment."