Skip to content

Commit e7b6272

Browse files
committed
Merge bitcoin/bitcoin#24636: rpc: Exclude descriptor when address is excluded
faf37c2 rpc: Exclude descriptor when address is excluded (MarcoFalke) Pull request description: I don't think output descriptors should be used to describe redeem scripts and witness scripts. Fix this by excluding them when it doesn't make sense. This should only affect the `decodepsbt` RPC. Found by bitcoin/bitcoin#23083 ACKs for top commit: achow101: ACK faf37c2 jonatack: ACK faf37c2 Tree-SHA512: ebd581ad639e70080e26028723fed287caa3fa4d7b836936645020d6cd9b7586585d7113b043442c444a9dc90c23b93efd7f8b8a7d6cf5db1e42137b67c497c3
2 parents 26d98d5 + faf37c2 commit e7b6272

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/core_write.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool include
153153
CTxDestination address;
154154

155155
out.pushKV("asm", ScriptToAsmStr(scriptPubKey));
156-
out.pushKV("desc", InferDescriptor(scriptPubKey, DUMMY_SIGNING_PROVIDER)->ToString());
156+
if (include_address) {
157+
out.pushKV("desc", InferDescriptor(scriptPubKey, DUMMY_SIGNING_PROVIDER)->ToString());
158+
}
157159
if (include_hex) out.pushKV("hex", HexStr(scriptPubKey));
158160

159161
std::vector<std::vector<unsigned char>> solns;

src/rpc/rawtransaction.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,7 @@ static RPCHelpMan decodepsbt()
971971
{RPCResult::Type::OBJ, "scriptPubKey", "",
972972
{
973973
{RPCResult::Type::STR, "asm", "The asm"},
974+
{RPCResult::Type::STR, "desc", "Inferred descriptor for the output"},
974975
{RPCResult::Type::STR_HEX, "hex", "The hex"},
975976
{RPCResult::Type::STR, "type", "The type, eg 'pubkeyhash'"},
976977
{RPCResult::Type::STR, "address", /*optional=*/true, "The Bitcoin address (only if a well-defined address exists)"},

0 commit comments

Comments
 (0)