5#ifndef BITCOIN_VERSIONBITS_IMPL_H
6#define BITCOIN_VERSIONBITS_IMPL_H
63 int64_t
EndTime()
const override {
return dep.nTimeout; }
77 uint32_t
Mask()
const {
return (uint32_t{1}) <<
dep.bit; }
Abstract class that implements BIP9-style threshold logic, and caches results.
virtual bool Condition(const CBlockIndex *pindex) const =0
ThresholdState GetStateFor(const CBlockIndex *pindexPrev, ThresholdConditionCache &cache) const
Returns the state for pindex A based on parent pindexPrev B.
int GetStateSinceHeightFor(const CBlockIndex *pindexPrev, ThresholdConditionCache &cache) const
Returns the height since when the ThresholdState has started for pindex A based on parent pindexPrev ...
virtual int MinActivationHeight() const
BIP9Stats GetStateStatisticsFor(const CBlockIndex *pindex, std::vector< bool > *signalling_blocks=nullptr) const
Returns the numerical statistics of an in-progress BIP9 softfork in the period including pindex If pr...
virtual int Period() const =0
virtual ~AbstractThresholdConditionChecker()=default
virtual int Threshold() const =0
virtual int64_t BeginTime() const =0
virtual int64_t EndTime() const =0
The block chain is a tree shaped structure starting with the genesis block at the root,...
int32_t nVersion
block header
int Threshold() const override
int64_t EndTime() const override
bool Condition(const CBlockIndex *pindex) const override
const Consensus::BIP9Deployment & dep
VersionBitsConditionChecker(const Consensus::BIP9Deployment &dep)
int Period() const override
VersionBitsConditionChecker(const Consensus::Params ¶ms, Consensus::DeploymentPos id)
int64_t BeginTime() const override
bool Condition(int32_t nVersion) const
int MinActivationHeight() const override
Display status of an in-progress BIP9 softfork.
Struct for each individual consensus rule change using BIP9.
Parameters that influence chain consensus.
std::map< const CBlockIndex *, ThresholdState > ThresholdConditionCache
static const int32_t VERSIONBITS_TOP_BITS
What bits to set in version for versionbits blocks.
static const int32_t VERSIONBITS_TOP_MASK
What bitmask determines whether versionbits is in use.
ThresholdState
BIP 9 defines a finite-state-machine to deploy a softfork in multiple stages.
std::string StateName(ThresholdState state)
Get a string with the state name.