aboutsummaryrefslogtreecommitdiff
path: root/src/versionbits.h
diff options
context:
space:
mode:
authorMatthew Zipkin <[email protected]>2017-01-13 17:06:50 -0800
committerMatthew Zipkin <[email protected]>2017-03-24 16:57:05 -0700
commit557c9a68fb72aeb535f2efe3cc82d3f5e66c6ad3 (patch)
treeb347a1975468bcae82ee6c1bb051f001973c6408 /src/versionbits.h
parentMerge #10052: [test] Run extended tests once daily in Travis (diff)
downloaddiscoin-557c9a68fb72aeb535f2efe3cc82d3f5e66c6ad3.tar.xz
discoin-557c9a68fb72aeb535f2efe3cc82d3f5e66c6ad3.zip
RPC: getblockchaininfo: BIP9 stats
add RPC tests for BIP9 counting stats
Diffstat (limited to 'src/versionbits.h')
-rw-r--r--src/versionbits.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/versionbits.h b/src/versionbits.h
index 7a929266a..f1d31ea0a 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);