mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
rpc: add signet_challenge field to getblockchaininfo and getmininginfo
This commit is contained in:
@@ -1307,6 +1307,7 @@ RPCHelpMan getblockchaininfo()
|
||||
{RPCResult::Type::NUM, "pruneheight", /*optional=*/true, "height of the last block pruned, plus one (only present if pruning is enabled)"},
|
||||
{RPCResult::Type::BOOL, "automatic_pruning", /*optional=*/true, "whether automatic pruning is enabled (only present if pruning is enabled)"},
|
||||
{RPCResult::Type::NUM, "prune_target_size", /*optional=*/true, "the target size used by pruning (only present if automatic pruning is enabled)"},
|
||||
{RPCResult::Type::STR_HEX, "signet_challenge", /*optional=*/true, "the block challenge (aka. block script), in hexadecimal (only present if the current network is a signet)"},
|
||||
(IsDeprecatedRPCEnabled("warnings") ?
|
||||
RPCResult{RPCResult::Type::STR, "warnings", "any network and blockchain warnings (DEPRECATED)"} :
|
||||
RPCResult{RPCResult::Type::ARR, "warnings", "any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)",
|
||||
@@ -1351,6 +1352,11 @@ RPCHelpMan getblockchaininfo()
|
||||
obj.pushKV("prune_target_size", chainman.m_blockman.GetPruneTarget());
|
||||
}
|
||||
}
|
||||
if (chainman.GetParams().GetChainType() == ChainType::SIGNET) {
|
||||
const std::vector<uint8_t>& signet_challenge =
|
||||
chainman.GetParams().GetConsensus().signet_challenge;
|
||||
obj.pushKV("signet_challenge", HexStr(signet_challenge));
|
||||
}
|
||||
|
||||
NodeContext& node = EnsureAnyNodeContext(request.context);
|
||||
obj.pushKV("warnings", node::GetWarningsForRpc(*CHECK_NONFATAL(node.warnings), IsDeprecatedRPCEnabled("warnings")));
|
||||
|
||||
Reference in New Issue
Block a user