Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rpc): return activation_height in getblockchaininfo for BIP9 softforks #5624

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/release-notes-5624.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Updated RPCs
------------

- `getblockchaininfo` RPC returns the field `activation_height` for each softforks in `locked_in` status: indicating the expected activation height.
4 changes: 4 additions & 0 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,9 @@ static void BIP9SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniVal
statsUV.pushKV("possible", statsStruct.possible);
bip9.pushKV("statistics", statsUV);
}
else if (ThresholdState::LOCKED_IN == thresholdState) {
bip9.pushKV("activation_height", since_height + static_cast<int>(consensusParams.vDeployments[id].nWindowSize));
}

UniValue rv(UniValue::VOBJ);
rv.pushKV("type", "bip9");
Expand Down Expand Up @@ -1673,6 +1676,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
{RPCResult::Type::NUM_TIME, "start_time", "the minimum median time past of a block at which the bit gains its meaning"},
{RPCResult::Type::NUM_TIME, "timeout", "the median time past of a block at which the deployment is considered failed if not yet locked in"},
{RPCResult::Type::NUM, "since", "height of the first block to which the status applies"},
{RPCResult::Type::NUM, "activation_height", "expected activation height for this softfork (only for \"locked_in\" status)"},
{RPCResult::Type::OBJ, "statistics", "numeric statistics about BIP9 signalling for a softfork",
{
{RPCResult::Type::NUM, "period", "the length in blocks of the BIP9 signalling period"},
Expand Down
Loading