mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 08:13:52 +02:00
RPC: getblockchaininfo: BIP9 stats
add RPC tests for BIP9 counting stats
This commit is contained in:
@@ -37,6 +37,14 @@ struct BIP9DeploymentInfo {
|
||||
bool gbt_force;
|
||||
};
|
||||
|
||||
struct BIP9Stats {
|
||||
int period;
|
||||
int threshold;
|
||||
int elapsed;
|
||||
int count;
|
||||
bool possible;
|
||||
};
|
||||
|
||||
extern const struct BIP9DeploymentInfo VersionBitsDeploymentInfo[];
|
||||
|
||||
/**
|
||||
@@ -51,6 +59,7 @@ protected:
|
||||
virtual int Threshold(const Consensus::Params& params) const =0;
|
||||
|
||||
public:
|
||||
BIP9Stats GetStateStatisticsFor(const CBlockIndex* pindex, const Consensus::Params& params) const;
|
||||
// Note that the functions below take a pindexPrev as input: they compute information for block B based on its parent.
|
||||
ThresholdState GetStateFor(const CBlockIndex* pindexPrev, const Consensus::Params& params, ThresholdConditionCache& cache) const;
|
||||
int GetStateSinceHeightFor(const CBlockIndex* pindexPrev, const Consensus::Params& params, ThresholdConditionCache& cache) const;
|
||||
@@ -64,6 +73,7 @@ struct VersionBitsCache
|
||||
};
|
||||
|
||||
ThresholdState VersionBitsState(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos, VersionBitsCache& cache);
|
||||
BIP9Stats VersionBitsStatistics(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos);
|
||||
int VersionBitsStateSinceHeight(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos, VersionBitsCache& cache);
|
||||
uint32_t VersionBitsMask(const Consensus::Params& params, Consensus::DeploymentPos pos);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user