Merge bitcoin/bitcoin#36131: rpc: Improve two field's OpenRPC types
What changed, and why it matters
This commit is a documentation-only correction to the machine-readable OpenRPC schema. It changes two type annotations: one says private keys are plain strings (not hex strings), and another says an ancestor-fees field is a number (not an amount string). The commit message explicitly states these changes have no effect on the actual RPC behavior or help output, only on the generated OpenRPC dump file.
No security action required. This is a non-functional schema/documentation fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies RPC argument/result metadata in src/rpc/rawtransaction.cpp and src/wallet/rpc/coins.cpp. In signrawtransactionwithkey, the ‘privatekey’ array element type is changed from STR_HEX to STR because private keys are base58-encoded, not hex. In listunspent, the ‘ancestorfees’ result type is changed from STR_AMOUNT to NUM because the field is returned as a numeric satoshi value. Both changes only affect the OpenRPC dump (dump.json) schema generation; runtime parsing, validation, and RPC help text are unchanged.
Changed components
src/rpc/rawtransaction.cppsrc/wallet/rpc/coins.cppOpenRPC schema dump generationInspect captured patch +2 / −2
### src/rpc/rawtransaction.cpp
@@ -699,7 +699,7 @@ static RPCMethod signrawtransactionwithkey()
{"hexstring", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction hex string"},
{"privkeys", RPCArg::Type::ARR, RPCArg::Optional::NO, "The base58-encoded private keys for signing",
{
- {"privatekey", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "private key in base58-encoding"},
+ {"privatekey", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "private key in base58-encoding"},
},
},
{"prevtxs", RPCArg::Type::ARR, RPCArg::Optional::OMITTED, "The previous dependent transaction outputs",
### src/wallet/rpc/coins.cpp
@@ -495,7 +495,7 @@ RPCMethod listunspent()
{RPCResult::Type::NUM, "confirmations", "The number of confirmations"},
{RPCResult::Type::NUM, "ancestorcount", /*optional=*/true, "The number of in-mempool ancestor transactions, including this one (if transaction is in the mempool)"},
{RPCResult::Type::NUM, "ancestorsize", /*optional=*/true, "The virtual transaction size of in-mempool ancestors, including this one (if transaction is in the mempool)"},
- {RPCResult::Type::STR_AMOUNT, "ancestorfees", /*optional=*/true, "The total fees of in-mempool ancestors (including this one) with fee deltas used for mining priority in " + CURRENCY_ATOM + " (if transaction is in the mempool)"},
+ {RPCResult::Type::NUM, "ancestorfees", /*optional=*/true, "The total fees of in-mempool ancestors (including this one) with fee deltas used for mining priority in " + CURRENCY_ATOM + " (if transaction is in the mempool)"},
{RPCResult::Type::STR_HEX, "redeemScript", /*optional=*/true, "The redeem script if the output script is P2SH"},
{RPCResult::Type::STR, "witnessScript", /*optional=*/true, "witness script if the output script is P2WSH or P2SH-P2WSH"},
{RPCResult::Type::BOOL, "spendable", "(DEPRECATED) Always true"},Why this scored 20/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.