From ef0676f40077af799ce244c539ee7fbc07cc20a0 Mon Sep 17 00:00:00 2001 From: will Date: Thu, 19 Mar 2026 13:35:14 +0000 Subject: [PATCH] rpc: factor getaddressinfo embedded field docs Keep the repeated embedded address documentation in one helper so the OpenRPC metadata and help text stay consistent without duplicating the same field list. --- src/wallet/rpc/addresses.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp index 8feae478632..02d59a79188 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 GetAddressInfoEmbeddedFields(bool include_nested) +static std::vector GetAddressInfoBaseFields() { - auto fields = std::vector{ + 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 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 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; }