mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Merge bitcoin/bitcoin#24636: rpc: Exclude descriptor when address is excluded
faf37c217arpc: 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 https://github.com/bitcoin/bitcoin/pull/23083 ACKs for top commit: achow101: ACKfaf37c217ajonatack: ACKfaf37c217aTree-SHA512: ebd581ad639e70080e26028723fed287caa3fa4d7b836936645020d6cd9b7586585d7113b043442c444a9dc90c23b93efd7f8b8a7d6cf5db1e42137b67c497c3
This commit is contained in:
@@ -153,7 +153,9 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool include
|
||||
CTxDestination address;
|
||||
|
||||
out.pushKV("asm", ScriptToAsmStr(scriptPubKey));
|
||||
out.pushKV("desc", InferDescriptor(scriptPubKey, DUMMY_SIGNING_PROVIDER)->ToString());
|
||||
if (include_address) {
|
||||
out.pushKV("desc", InferDescriptor(scriptPubKey, DUMMY_SIGNING_PROVIDER)->ToString());
|
||||
}
|
||||
if (include_hex) out.pushKV("hex", HexStr(scriptPubKey));
|
||||
|
||||
std::vector<std::vector<unsigned char>> solns;
|
||||
|
||||
@@ -971,6 +971,7 @@ static RPCHelpMan decodepsbt()
|
||||
{RPCResult::Type::OBJ, "scriptPubKey", "",
|
||||
{
|
||||
{RPCResult::Type::STR, "asm", "The asm"},
|
||||
{RPCResult::Type::STR, "desc", "Inferred descriptor for the output"},
|
||||
{RPCResult::Type::STR_HEX, "hex", "The hex"},
|
||||
{RPCResult::Type::STR, "type", "The type, eg 'pubkeyhash'"},
|
||||
{RPCResult::Type::STR, "address", /*optional=*/true, "The Bitcoin address (only if a well-defined address exists)"},
|
||||
|
||||
Reference in New Issue
Block a user