diff options
author | Matthew Zipkin <pinheadmz@gmail.com> | 2017-01-13 17:06:50 -0800 |
---|---|---|
committer | Matthew Zipkin <pinheadmz@gmail.com> | 2017-03-24 16:57:05 -0700 |
commit | 557c9a68fb72aeb535f2efe3cc82d3f5e66c6ad3 (patch) | |
tree | b347a1975468bcae82ee6c1bb051f001973c6408 /src/versionbits.h | |
parent | a0b1e57b20a17177ed5a9a54e4a8aab597a546b4 (diff) |
RPC: getblockchaininfo: BIP9 stats
add RPC tests for BIP9 counting stats
Diffstat (limited to 'src/versionbits.h')
-rw-r--r-- | src/versionbits.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/versionbits.h b/src/versionbits.h index 7a929266aa..f1d31ea0af 100644 --- a/src/versionbits.h +++ b/src/versionbits.h @@ -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); |