mirror of https://github.com/bitcoin/bitcoin.git
rpc: have getdeploymentinfo report script verify flags
This commit is contained in:
parent
a3986935f0
commit
4577fb2b1e
|
@ -1453,6 +1453,9 @@ RPCHelpMan getdeploymentinfo()
|
||||||
RPCResult::Type::OBJ, "", "", {
|
RPCResult::Type::OBJ, "", "", {
|
||||||
{RPCResult::Type::STR, "hash", "requested block hash (or tip)"},
|
{RPCResult::Type::STR, "hash", "requested block hash (or tip)"},
|
||||||
{RPCResult::Type::NUM, "height", "requested block height (or tip)"},
|
{RPCResult::Type::NUM, "height", "requested block height (or tip)"},
|
||||||
|
{RPCResult::Type::ARR, "script_flags", "script verify flags for the block", {
|
||||||
|
{RPCResult::Type::STR, "flag", "a script verify flag"},
|
||||||
|
}},
|
||||||
{RPCResult::Type::OBJ_DYN, "deployments", "", {
|
{RPCResult::Type::OBJ_DYN, "deployments", "", {
|
||||||
{RPCResult::Type::OBJ, "xxxx", "name of the deployment", RPCHelpForDeployment}
|
{RPCResult::Type::OBJ, "xxxx", "name of the deployment", RPCHelpForDeployment}
|
||||||
}},
|
}},
|
||||||
|
@ -1479,6 +1482,12 @@ RPCHelpMan getdeploymentinfo()
|
||||||
UniValue deploymentinfo(UniValue::VOBJ);
|
UniValue deploymentinfo(UniValue::VOBJ);
|
||||||
deploymentinfo.pushKV("hash", blockindex->GetBlockHash().ToString());
|
deploymentinfo.pushKV("hash", blockindex->GetBlockHash().ToString());
|
||||||
deploymentinfo.pushKV("height", blockindex->nHeight);
|
deploymentinfo.pushKV("height", blockindex->nHeight);
|
||||||
|
{
|
||||||
|
const auto flagnames = GetScriptFlagNames(GetBlockScriptFlags(*blockindex, chainman));
|
||||||
|
UniValue uv_flagnames(UniValue::VARR);
|
||||||
|
uv_flagnames.push_backV(flagnames.begin(), flagnames.end());
|
||||||
|
deploymentinfo.pushKV("script_flags", uv_flagnames);
|
||||||
|
}
|
||||||
deploymentinfo.pushKV("deployments", DeploymentInfo(blockindex, chainman));
|
deploymentinfo.pushKV("deployments", DeploymentInfo(blockindex, chainman));
|
||||||
return deploymentinfo;
|
return deploymentinfo;
|
||||||
},
|
},
|
||||||
|
|
|
@ -213,6 +213,7 @@ class BlockchainTest(BitcoinTestFramework):
|
||||||
assert_equal(gdi_result, {
|
assert_equal(gdi_result, {
|
||||||
"hash": blockhash,
|
"hash": blockhash,
|
||||||
"height": height,
|
"height": height,
|
||||||
|
"script_flags": ["CHECKLOCKTIMEVERIFY","CHECKSEQUENCEVERIFY","DERSIG","NULLDUMMY","P2SH","TAPROOT","WITNESS"],
|
||||||
"deployments": {
|
"deployments": {
|
||||||
'bip34': {'type': 'buried', 'active': True, 'height': 2},
|
'bip34': {'type': 'buried', 'active': True, 'height': 2},
|
||||||
'bip66': {'type': 'buried', 'active': True, 'height': 3},
|
'bip66': {'type': 'buried', 'active': True, 'height': 3},
|
||||||
|
|
Loading…
Reference in New Issue