Skip to content

Commit 4577fb2

Browse files
committed
rpc: have getdeploymentinfo report script verify flags
1 parent a398693 commit 4577fb2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/rpc/blockchain.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,9 @@ RPCHelpMan getdeploymentinfo()
14531453
RPCResult::Type::OBJ, "", "", {
14541454
{RPCResult::Type::STR, "hash", "requested block hash (or tip)"},
14551455
{RPCResult::Type::NUM, "height", "requested block height (or tip)"},
1456+
{RPCResult::Type::ARR, "script_flags", "script verify flags for the block", {
1457+
{RPCResult::Type::STR, "flag", "a script verify flag"},
1458+
}},
14561459
{RPCResult::Type::OBJ_DYN, "deployments", "", {
14571460
{RPCResult::Type::OBJ, "xxxx", "name of the deployment", RPCHelpForDeployment}
14581461
}},
@@ -1479,6 +1482,12 @@ RPCHelpMan getdeploymentinfo()
14791482
UniValue deploymentinfo(UniValue::VOBJ);
14801483
deploymentinfo.pushKV("hash", blockindex->GetBlockHash().ToString());
14811484
deploymentinfo.pushKV("height", blockindex->nHeight);
1485+
{
1486+
const auto flagnames = GetScriptFlagNames(GetBlockScriptFlags(*blockindex, chainman));
1487+
UniValue uv_flagnames(UniValue::VARR);
1488+
uv_flagnames.push_backV(flagnames.begin(), flagnames.end());
1489+
deploymentinfo.pushKV("script_flags", uv_flagnames);
1490+
}
14821491
deploymentinfo.pushKV("deployments", DeploymentInfo(blockindex, chainman));
14831492
return deploymentinfo;
14841493
},

test/functional/rpc_blockchain.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ def check_signalling_deploymentinfo_result(self, gdi_result, height, blockhash,
213213
assert_equal(gdi_result, {
214214
"hash": blockhash,
215215
"height": height,
216+
"script_flags": ["CHECKLOCKTIMEVERIFY","CHECKSEQUENCEVERIFY","DERSIG","NULLDUMMY","P2SH","TAPROOT","WITNESS"],
216217
"deployments": {
217218
'bip34': {'type': 'buried', 'active': True, 'height': 2},
218219
'bip66': {'type': 'buried', 'active': True, 'height': 3},

0 commit comments

Comments
 (0)