Merge bitcoin/bitcoin#36297: rpc: Correct invalid OpenRPC defaults
What changed, and why it matters
This is a documentation-only fix for Bitcoin Core's machine-readable RPC help data. It changes several default values from literal strings to 'hint' labels (because the real default depends on context) and corrects one boolean default from the string "false" to the actual value false. It does not change how Bitcoin Core processes transactions, validates blocks, or handles money. The only risk is that tools reading the OpenRPC metadata could previously receive invalid schema examples; this patch makes those examples valid.
No urgent action required. Treat as a normal documentation/schema correctness fix. Reviewers may verify that getopenrpcinfo now validates against the OpenRPC schema and that no functional RPC behavior changed.
Security signals we found
OpenRPC schema/default mismatch correction
RPC help metadata type correction (string 'false' to boolean false)
No executable code path changes
Evidence from the diff
The commit modifies RPC argument metadata in src/rpc/blockchain.cpp, src/rpc/rawtransaction.cpp, and src/wallet/rpc/spend.cpp. It replaces RPCArg::Default{…} with RPCArg::DefaultHint{…} for arguments whose default is context-dependent or descriptive (e.g., ‘hash of current chain tip’, ‘DEFAULT for Taproot, ALL otherwise’). It also changes send.options.include_watching from RPCArg::Default{“false”} (a string) to RPCArg::Default{false} (a boolean). These changes affect the OpenRPC document emitted by getopenrpcinfo so that declared defaults satisfy their declared schemas. No consensus, networking, wallet spending, or validation logic is altered.
Changed components
RPC argument metadata generationgetopenrpcinfo outputgetdeploymentinfo help metadatasignrawtransactionwithkey help metadatadescriptorprocesspsbt help metadatasignrawtransactionwithwallet help metadatasend wallet RPC help metadatawalletprocesspsbt help metadataInspect captured patch +6 / −6
### src/rpc/blockchain.cpp
@@ -1548,7 +1548,7 @@ RPCMethod getdeploymentinfo()
"Returns an object containing various state info regarding deployments of consensus changes.\n"
"Consensus changes for which the new rules are enforced from genesis are not listed in \"deployments\".",
{
- {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Default{"hash of current chain tip"}, "The block hash at which to query deployment state"},
+ {"blockhash", RPCArg::Type::STR_HEX, RPCArg::DefaultHint{"hash of current chain tip"}, "The block hash at which to query deployment state"},
},
RPCResult{
RPCResult::Type::OBJ, "", "", {
### src/rpc/rawtransaction.cpp
@@ -743,7 +743,7 @@ static RPCMethod signrawtransactionwithkey()
},
},
},
- {"sighashtype", RPCArg::Type::STR, RPCArg::Default{"DEFAULT for Taproot, ALL otherwise"}, "The signature hash type. Must be one of:\n"
+ {"sighashtype", RPCArg::Type::STR, RPCArg::DefaultHint{"DEFAULT for Taproot, ALL otherwise"}, "The signature hash type. Must be one of:\n"
" \"DEFAULT\"\n"
" \"ALL\"\n"
" \"NONE\"\n"
@@ -2095,7 +2095,7 @@ RPCMethod descriptorprocesspsbt()
{"range", RPCArg::Type::RANGE, RPCArg::Default{1000}, "Up to what index HD chains should be explored (either end or [begin,end])"},
}},
}},
- {"sighashtype", RPCArg::Type::STR, RPCArg::Default{"DEFAULT for Taproot, ALL otherwise"}, "The signature hash type to sign with if not specified by the PSBT. Must be one of\n"
+ {"sighashtype", RPCArg::Type::STR, RPCArg::DefaultHint{"DEFAULT for Taproot, ALL otherwise"}, "The signature hash type to sign with if not specified by the PSBT. Must be one of\n"
" \"DEFAULT\"\n"
" \"ALL\"\n"
" \"NONE\"\n"
### src/wallet/rpc/spend.cpp
@@ -864,7 +864,7 @@ RPCMethod signrawtransactionwithwallet()
},
},
},
- {"sighashtype", RPCArg::Type::STR, RPCArg::Default{"DEFAULT for Taproot, ALL otherwise"}, "The signature hash type. Must be one of\n"
+ {"sighashtype", RPCArg::Type::STR, RPCArg::DefaultHint{"DEFAULT for Taproot, ALL otherwise"}, "The signature hash type. Must be one of\n"
" \"DEFAULT\"\n"
" \"ALL\"\n"
" \"NONE\"\n"
@@ -1207,7 +1207,7 @@ RPCMethod send()
{"change_position", RPCArg::Type::NUM, RPCArg::DefaultHint{"random"}, "The index of the change output"},
{"change_type", RPCArg::Type::STR, RPCArg::DefaultHint{"set by -changetype"}, "The output type to use. Only valid if change_address is not specified. Options are " + FormatAllOutputTypes() + "."},
{"fee_rate", RPCArg::Type::AMOUNT, RPCArg::DefaultHint{"not set, fall back to wallet fee estimation"}, "Specify a fee rate in " + CURRENCY_ATOM + "/vB.", RPCArgOptions{.also_positional = true}},
- {"include_watching", RPCArg::Type::BOOL, RPCArg::Default{"false"}, "(DEPRECATED) No longer used"},
+ {"include_watching", RPCArg::Type::BOOL, RPCArg::Default{false}, "(DEPRECATED) No longer used"},
{"inputs", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Specify inputs instead of adding them automatically.",
{
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "", {
@@ -1597,7 +1597,7 @@ RPCMethod walletprocesspsbt()
{
{"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction base64 string"},
{"sign", RPCArg::Type::BOOL, RPCArg::Default{true}, "Also sign the transaction when updating (requires wallet to be unlocked)"},
- {"sighashtype", RPCArg::Type::STR, RPCArg::Default{"DEFAULT for Taproot, ALL otherwise"}, "The signature hash type to sign with if not specified by the PSBT. Must be one of\n"
+ {"sighashtype", RPCArg::Type::STR, RPCArg::DefaultHint{"DEFAULT for Taproot, ALL otherwise"}, "The signature hash type to sign with if not specified by the PSBT. Must be one of\n"
" \"DEFAULT\"\n"
" \"ALL\"\n"
" \"NONE\"\n"Why this scored 21/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.