6#include <chainparams.h>
46 std::vector<std::unique_ptr<CBlockIndex>> m_blocks;
56 size_t size()
const {
return m_blocks.size(); }
60 return m_blocks.empty() ?
nullptr : m_blocks.back().get();
67 header.
nTime = m_start_time + m_blocks.size() * m_interval;
68 header.
nBits = 0x1d00ffff;
79std::unique_ptr<const CChainParams>
g_params;
153 TestConditionChecker checker(dep);
183 for (
uint32_t b = 0; b < period; ++b) {
214 for (
uint32_t b = 1; b < period; ++b) {
225 const int since = checker.GetStateSinceHeightFor(
current_block);
230 std::vector<bool> signals;
270 const int since = checker.GetStateSinceHeightFor(
current_block);
273 assert(since % period == 0);
std::unique_ptr< const CChainParams > CreateChainParams(const ArgsManager &args, const ChainType chain)
Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.
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 ...
The block chain is a tree shaped structure starting with the genesis block at the root,...
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
const CBlock & GenesisBlock() const
const Consensus::Params & GetConsensus() const
T ConsumeIntegralInRange(T min, T max)
Class to implement versionbits logic.
Display status of an in-progress BIP9 softfork.
uint32_t count
Number of blocks with the version bit set since the beginning of the current period.
uint32_t threshold
Number of blocks with the version bit set required to activate the softfork.
uint32_t elapsed
Number of blocks elapsed since the beginning of the current period.
bool possible
False if there are not enough blocks left in this period to pass activation threshold.
uint32_t period
Length of blocks of the BIP9 signalling period.
Struct for each individual consensus rule change using BIP9.
int min_activation_height
If lock in occurs, delay activation until at least this block height.
int bit
Bit position to select the particular bit in nVersion.
static constexpr int64_t ALWAYS_ACTIVE
Special value for nStartTime indicating that the deployment is always active.
static constexpr int64_t NEVER_ACTIVE
Special value for nStartTime indicating that the deployment is never active.
uint32_t period
Period of blocks to check signalling in (usually retarget period, ie params.DifficultyAdjustmentInter...
uint32_t threshold
Minimum blocks including miner confirmation of the total of 2016 blocks in a retargeting period,...
int64_t nTimeout
Timeout/expiry MedianTime for the deployment attempt.
static constexpr int64_t NO_TIMEOUT
Constant for nTimeout very far in the future.
int64_t nStartTime
Start MedianTime for version bits miner confirmation.
int64_t nPowTargetSpacing
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
std::map< const CBlockIndex *, ThresholdState > ThresholdConditionCache
static const int32_t VERSIONBITS_NUM_BITS
Total bits available for versionbits.
static const int32_t VERSIONBITS_LAST_OLD_BLOCK_VERSION
What block version to use for new blocks (pre versionbits)
ThresholdState
BIP 9 defines a finite-state-machine to deploy a softfork in multiple stages.
FuzzedDataProvider & fuzzed_data_provider