mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
rpc: getdeploymentinfo: include signalling info
This commit is contained in:
@@ -51,7 +51,7 @@ public:
|
||||
|
||||
ThresholdState GetStateFor(const CBlockIndex* pindexPrev) const { return AbstractThresholdConditionChecker::GetStateFor(pindexPrev, dummy_params, m_cache); }
|
||||
int GetStateSinceHeightFor(const CBlockIndex* pindexPrev) const { return AbstractThresholdConditionChecker::GetStateSinceHeightFor(pindexPrev, dummy_params, m_cache); }
|
||||
BIP9Stats GetStateStatisticsFor(const CBlockIndex* pindex) const { return AbstractThresholdConditionChecker::GetStateStatisticsFor(pindex, dummy_params); }
|
||||
BIP9Stats GetStateStatisticsFor(const CBlockIndex* pindex, std::vector<bool>* signals=nullptr) const { return AbstractThresholdConditionChecker::GetStateStatisticsFor(pindex, dummy_params, signals); }
|
||||
|
||||
bool Condition(int32_t version) const
|
||||
{
|
||||
@@ -227,6 +227,7 @@ FUZZ_TARGET_INIT(versionbits, initialize)
|
||||
last_stats.threshold = threshold;
|
||||
last_stats.count = last_stats.elapsed = 0;
|
||||
last_stats.possible = (period >= threshold);
|
||||
std::vector<bool> last_signals{};
|
||||
|
||||
int prev_next_height = (prev == nullptr ? 0 : prev->nHeight + 1);
|
||||
assert(exp_since <= prev_next_height);
|
||||
@@ -248,13 +249,24 @@ FUZZ_TARGET_INIT(versionbits, initialize)
|
||||
assert(since == exp_since);
|
||||
|
||||
// check that after mining this block stats change as expected
|
||||
const BIP9Stats stats = checker.GetStateStatisticsFor(current_block);
|
||||
std::vector<bool> signals;
|
||||
const BIP9Stats stats = checker.GetStateStatisticsFor(current_block, &signals);
|
||||
const BIP9Stats stats_no_signals = checker.GetStateStatisticsFor(current_block);
|
||||
assert(stats.period == stats_no_signals.period && stats.threshold == stats_no_signals.threshold
|
||||
&& stats.elapsed == stats_no_signals.elapsed && stats.count == stats_no_signals.count
|
||||
&& stats.possible == stats_no_signals.possible);
|
||||
|
||||
assert(stats.period == period);
|
||||
assert(stats.threshold == threshold);
|
||||
assert(stats.elapsed == b);
|
||||
assert(stats.count == last_stats.count + (signal ? 1 : 0));
|
||||
assert(stats.possible == (stats.count + period >= stats.elapsed + threshold));
|
||||
last_stats = stats;
|
||||
|
||||
assert(signals.size() == last_signals.size() + 1);
|
||||
assert(signals.back() == signal);
|
||||
last_signals.push_back(signal);
|
||||
assert(signals == last_signals);
|
||||
}
|
||||
|
||||
if (exp_state == ThresholdState::STARTED) {
|
||||
|
||||
Reference in New Issue
Block a user