rpc: have getdeploymentinfo report script verify flags
What changed, and why it matters
This commit adds a new read-only field called 'script_flags' to the getdeploymentinfo RPC response. It simply reports which Bitcoin script verification rules are active for a given block. There is no code change that modifies how transactions or blocks are validated, accepted, or relayed. It is an informational API enhancement with no apparent security impact.
No security action required. Treat as a normal feature/test update during review.
Security signals we found
No security signal: change is read-only RPC output only
No consensus, validation, or networking code modified
No memory safety, input parsing, or authentication changes observed
Evidence from the diff
The patch extends the getdeploymentinfo RPC to include the script verification flags (from GetBlockScriptFlags) in its JSON output. It updates the RPC help documentation and adds a functional test assertion. The change is purely additive to RPC output and does not alter consensus, mempool policy, net processing, or wallet behavior.
Changed components
src/rpc/blockchain.cpptest/functional/rpc_blockchain.pyInspect captured patch +10 / −0
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index cfc0379f..ddaa4ead 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1453,6 +1453,9 @@ RPCHelpMan getdeploymentinfo()
RPCResult::Type::OBJ, "", "", {
{RPCResult::Type::STR, "hash", "requested block hash (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, "xxxx", "name of the deployment", RPCHelpForDeployment}
}},
@@ -1479,6 +1482,12 @@ RPCHelpMan getdeploymentinfo()
UniValue deploymentinfo(UniValue::VOBJ);
deploymentinfo.pushKV("hash", blockindex->GetBlockHash().ToString());
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));
return deploymentinfo;
},
diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py
index 84fa8ebc..3c011c09 100755
--- a/test/functional/rpc_blockchain.py
+++ b/test/functional/rpc_blockchain.py
@@ -213,6 +213,7 @@ class BlockchainTest(BitcoinTestFramework):
assert_equal(gdi_result, {
"hash": blockhash,
"height": height,
+ "script_flags": ["CHECKLOCKTIMEVERIFY","CHECKSEQUENCEVERIFY","DERSIG","NULLDUMMY","P2SH","TAPROOT","WITNESS"],
"deployments": {
'bip34': {'type': 'buried', 'active': True, 'height': 2},
'bip66': {'type': 'buried', 'active': True, 'height': 3},
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.