From cbdbacf8076f93d9facc70f49748e25a430cde09 Mon Sep 17 00:00:00 2001 From: Michel van Kessel Date: Sun, 20 Dec 2020 14:26:00 +0100 Subject: [PATCH] versionbits header update --- src/versionbits.cpp | 11 +++++++---- src/versionbits.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/versionbits.cpp b/src/versionbits.cpp index 307212302..4eedc68f3 100644 --- a/src/versionbits.cpp +++ b/src/versionbits.cpp @@ -2,9 +2,11 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "versionbits.h" +#include -#include "consensus/params.h" +#include +#include +#include const struct BIP9DeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS] = { { @@ -25,14 +27,14 @@ ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex* int64_t nTimeTimeout = EndTime(params); // 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 != NULL) { + if (pindexPrev != nullptr) { pindexPrev = pindexPrev->GetAncestor(pindexPrev->nHeight - ((pindexPrev->nHeight + 1) % nPeriod)); } // Walk backwards in steps of nPeriod to find a pindexPrev whose information is known std::vector vToCompute; while (cache.count(pindexPrev) == 0) { - if (pindexPrev == NULL) { + if (pindexPrev == nullptr) { // The genesis block is by definition defined. cache[pindexPrev] = THRESHOLD_DEFINED; break; @@ -79,6 +81,7 @@ ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex* } pindexCount = pindexCount->pprev; } + if (count >= nThreshold) { stateNext = THRESHOLD_LOCKED_IN; } diff --git a/src/versionbits.h b/src/versionbits.h index e94d5d5e1..3a1feec7a 100644 --- a/src/versionbits.h +++ b/src/versionbits.h @@ -5,7 +5,7 @@ #ifndef BITCOIN_CONSENSUS_VERSIONBITS #define BITCOIN_CONSENSUS_VERSIONBITS -#include "chain.h" +#include #include /** What block version to use for new blocks (pre versionbits) */