rpc: expand getaddressinfo embedded with explicit fields
What changed, and why it matters
This commit is a documentation-only change for the Bitcoin Core wallet's 'getaddressinfo' RPC command. It replaces a vague placeholder in the help text with a detailed, explicit list of fields that can appear inside the 'embedded' object. No wallet logic, validation rules, or network behavior is changed.
No security action required. This is a routine documentation/clarity improvement. Reviewers may optionally verify that the expanded field list matches the actual fields returned by DescribeWalletAddress().
Security signals we found
No change to consensus, validation, networking, or wallet cryptography
Change is confined to RPC help schema definitions
No new permissions, inputs, or parsing paths introduced
No bug fix or vulnerability remediation evident in the diff
Evidence from the diff
The patch refactors the RPCResult schema for getaddressinfo in src/wallet/rpc/addresses.cpp. It introduces a recursive helper GetAddressInfoEmbeddedFields() that returns the field list for the embedded object and uses ElideGroup() to render it in the help output. Previously the embedded object was documented with a single ELISION entry; now each sub-field is listed explicitly. The actual runtime output of getaddressinfo is unchanged because RPCResult schemas are only used for help/documentation generation.
Changed components
src/wallet/rpc/addresses.cppgetaddressinfo RPC help documentationInspect captured patch +53 / −5
diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp
index ed966d89..8feae478 100644
--- a/src/wallet/rpc/addresses.cpp
+++ b/src/wallet/rpc/addresses.cpp
@@ -365,6 +365,52 @@ static UniValue DescribeWalletAddress(const CWallet& wallet, const CTxDestinatio
return ret;
}
+// NOLINTNEXTLINE(misc-no-recursion)
+static std::vector<RPCResult> GetAddressInfoEmbeddedFields(bool include_nested)
+{
+ auto fields = std::vector<RPCResult>{
+ {RPCResult::Type::STR, "address", /*optional=*/true, "The bitcoin address of the embedded script."},
+ {RPCResult::Type::STR_HEX, "scriptPubKey", /*optional=*/true, "The hex-encoded output script generated by the address."},
+ {RPCResult::Type::BOOL, "isscript", /*optional=*/true, "If the key is a script."},
+ {RPCResult::Type::BOOL, "iswitness", /*optional=*/true, "If the address is a witness address."},
+ {RPCResult::Type::NUM, "witness_version", /*optional=*/true, "The version number of the witness program."},
+ {RPCResult::Type::STR_HEX, "witness_program", /*optional=*/true, "The hex value of the witness program."},
+ {RPCResult::Type::STR, "script", /*optional=*/true,
+ "The output script type. Only if isscript is true and the redeemscript is known. Possible\n"
+ "types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_keyhash,\n"
+ "witness_v0_scripthash, witness_unknown."},
+ {RPCResult::Type::STR_HEX, "hex", /*optional=*/true, "The redeemscript for the p2sh address."},
+ {RPCResult::Type::ARR, "pubkeys", /*optional=*/true,
+ "Array of pubkeys associated with the known redeemscript (only if script is multisig).",
+ {
+ {RPCResult::Type::STR, "pubkey", ""},
+ }},
+ {RPCResult::Type::NUM, "sigsrequired", /*optional=*/true,
+ "The number of signatures required to spend multisig output (only if script is multisig)."},
+ {RPCResult::Type::STR_HEX, "pubkey", /*optional=*/true,
+ "The hex value of the raw public key for single-key addresses (possibly embedded in P2SH or P2WSH)."},
+ };
+
+ if (include_nested) {
+ fields.emplace_back(
+ RPCResult::Type::OBJ,
+ "embedded",
+ /*optional=*/true,
+ "Information about the address embedded in P2SH or P2WSH, if relevant and known.",
+ GetAddressInfoEmbeddedFields(/*include_nested=*/false)
+ );
+ }
+
+ fields.emplace_back(
+ RPCResult::Type::BOOL,
+ "iscompressed",
+ /*optional=*/true,
+ "If the pubkey is compressed."
+ );
+
+ return fields;
+}
+
RPCMethod getaddressinfo()
{
return RPCMethod{
@@ -399,11 +445,13 @@ RPCMethod getaddressinfo()
}},
{RPCResult::Type::NUM, "sigsrequired", /*optional=*/true, "The number of signatures required to spend multisig output (only if script is multisig)."},
{RPCResult::Type::STR_HEX, "pubkey", /*optional=*/true, "The hex value of the raw public key for single-key addresses (possibly embedded in P2SH or P2WSH)."},
- {RPCResult::Type::OBJ, "embedded", /*optional=*/true, "Information about the address embedded in P2SH or P2WSH, if relevant and known.",
- {
- {RPCResult::Type::ELISION, "", "Includes all getaddressinfo output fields for the embedded address, excluding metadata (timestamp, hdkeypath, hdseedid)\n"
- "and relation to the wallet (ismine)."},
- }},
+ {RPCResult::Type::OBJ, "embedded", /*optional=*/true,
+ "Information about the address embedded in P2SH or P2WSH, if relevant and known.",
+ ElideGroup(
+ GetAddressInfoEmbeddedFields(/*include_nested=*/true),
+ "Includes all getaddressinfo output fields for the embedded address, excluding metadata (timestamp, hdkeypath, hdseedid)\n"
+ "and relation to the wallet (ismine)."
+ )},
{RPCResult::Type::BOOL, "iscompressed", /*optional=*/true, "If the pubkey is compressed."},
{RPCResult::Type::NUM_TIME, "timestamp", /*optional=*/true, "The creation time of the key, if available, expressed in " + UNIX_EPOCH_TIME + "."},
{RPCResult::Type::STR, "hdkeypath", /*optional=*/true, "The HD keypath, if the key is HD and available."},
Why this scored 18/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.