Skip to content

Commit b2773c7

Browse files
committed
rpc: add period_start to version bits statistics
1 parent a273e3c commit b2773c7

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/rpc/blockchain.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,7 @@ static void SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniValue&
13891389
UniValue statsUV(UniValue::VOBJ);
13901390
BIP9Stats statsStruct = g_versionbitscache.Statistics(active_chain_tip, consensusParams, id);
13911391
statsUV.pushKV("period", statsStruct.period);
1392+
statsUV.pushKV("period_start", active_chain_tip->nHeight + 1 - statsStruct.elapsed);
13921393
statsUV.pushKV("elapsed", statsStruct.elapsed);
13931394
statsUV.pushKV("count", statsStruct.count);
13941395
if (ThresholdState::LOCKED_IN != thresholdState) {
@@ -1449,6 +1450,7 @@ RPCHelpMan getblockchaininfo()
14491450
{RPCResult::Type::OBJ, "statistics", "numeric statistics about signalling for a softfork (only for \"started\" and \"locked_in\" status)",
14501451
{
14511452
{RPCResult::Type::NUM, "period", "the length in blocks of the signalling period"},
1453+
{RPCResult::Type::NUM, "period_start", "height of the first block of this signalling period"},
14521454
{RPCResult::Type::NUM, "threshold", "the number of blocks with the version bit set required to activate the feature (only for \"started\" status)"},
14531455
{RPCResult::Type::NUM, "elapsed", "the number of blocks elapsed since the beginning of the current period"},
14541456
{RPCResult::Type::NUM, "count", "the number of blocks with the version bit set in the current period"},

test/functional/rpc_blockchain.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ def _test_getblockchaininfo(self):
147147
'since': 144,
148148
'statistics': {
149149
'period': 144,
150+
'period_start': 144,
150151
'threshold': 108,
151152
'elapsed': 57,
152153
'count': 57,

0 commit comments

Comments
 (0)