rpc: factor getaddressinfo embedded field docs
What changed, and why it matters
This is a pure code cleanup change in Bitcoin Core's wallet RPC documentation. It moves repeated documentation fields for the getaddressinfo command into a shared helper function so the OpenRPC metadata and help text stay in sync. There is no functional change, no bug fix, and no security relevance.
No action required. This is a documentation-only refactor with no security implications.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors src/wallet/rpc/addresses.cpp by extracting a common set of RPCResult field definitions into a new helper GetAddressInfoBaseFields(). GetAddressInfoEmbeddedFields() now calls this helper and reuses it for the nested ‘embedded’ object. The order of the ‘iscompressed’ field is moved earlier in the list, but the same fields are emitted. No runtime behavior, validation, or wallet logic is altered.
Changed components
src/wallet/rpc/addresses.cppInspect captured patch +10 / −10
diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp
index 8feae478..02d59a79 100644
--- a/src/wallet/rpc/addresses.cpp
+++ b/src/wallet/rpc/addresses.cpp
@@ -366,9 +366,9 @@ static UniValue DescribeWalletAddress(const CWallet& wallet, const CTxDestinatio
}
// NOLINTNEXTLINE(misc-no-recursion)
-static std::vector<RPCResult> GetAddressInfoEmbeddedFields(bool include_nested)
+static std::vector<RPCResult> GetAddressInfoBaseFields()
{
- auto fields = std::vector<RPCResult>{
+ return {
{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."},
@@ -389,25 +389,25 @@ static std::vector<RPCResult> GetAddressInfoEmbeddedFields(bool include_nested)
"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::BOOL, "iscompressed", /*optional=*/true, "If the pubkey is compressed."},
};
+}
+
+static std::vector<RPCResult> GetAddressInfoEmbeddedFields(bool include_nested)
+{
+ auto fields = GetAddressInfoBaseFields();
if (include_nested) {
+ auto nested = GetAddressInfoBaseFields();
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)
+ std::move(nested)
);
}
- fields.emplace_back(
- RPCResult::Type::BOOL,
- "iscompressed",
- /*optional=*/true,
- "If the pubkey is compressed."
- );
-
return fields;
}
Why this scored 15/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.