aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/blockchain.cpp
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2021-11-12 07:14:21 +1000
committerAnthony Towns <aj@erisian.com.au>2022-01-15 04:37:56 +1000
commit240cad09baefcf363cce36a4b2795122adfce27f (patch)
tree3ca74e49bb15731b8649405d1060367d425b6696 /src/rpc/blockchain.cpp
parent376c0c6dae2bebbb3e1352377e71fb1996d09f64 (diff)
downloadbitcoin-240cad09baefcf363cce36a4b2795122adfce27f.tar.xz
rpc: getdeploymentinfo: include signalling info
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r--src/rpc/blockchain.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 32cb65679e..c1a73944de 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1448,7 +1448,8 @@ static void SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniValue&
// BIP9 signalling status, if applicable
if (has_signal) {
UniValue statsUV(UniValue::VOBJ);
- BIP9Stats statsStruct = g_versionbitscache.Statistics(active_chain_tip, consensusParams, id);
+ std::vector<bool> signals;
+ BIP9Stats statsStruct = g_versionbitscache.Statistics(active_chain_tip, consensusParams, id, &signals);
statsUV.pushKV("period", statsStruct.period);
statsUV.pushKV("elapsed", statsStruct.elapsed);
statsUV.pushKV("count", statsStruct.count);
@@ -1457,6 +1458,13 @@ static void SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniValue&
statsUV.pushKV("possible", statsStruct.possible);
}
bip9.pushKV("statistics", statsUV);
+
+ std::string sig;
+ sig.reserve(signals.size());
+ for (const bool s : signals) {
+ sig.push_back(s ? '#' : '-');
+ }
+ bip9.pushKV("signalling", sig);
}
UniValue rv(UniValue::VOBJ);
@@ -1585,6 +1593,7 @@ const std::vector<RPCResult> RPCHelpForDeployment{
{RPCResult::Type::NUM, "count", "the number of blocks with the version bit set in the current period"},
{RPCResult::Type::BOOL, "possible", /*optional=*/true, "returns false if there are not enough blocks left in this period to pass activation threshold (only for \"started\" status)"},
}},
+ {RPCResult::Type::STR, "signalling", "indicates blocks that signalled with a # and blocks that did not with a -"},
}},
};