aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-02-09 04:55:29 -0800
committerMarcoFalke <falke.marco@gmail.com>2020-02-09 04:55:45 -0800
commit75fb37ce68289eb7e00e2ccdd2ef7f9271332545 (patch)
tree479e5ada5df0d546b89e6b00558933f13a392dcc /src
parent23fab1a3dfe6f308880197dbe2bd7ce70866f13c (diff)
parent19a354b11f85a3c6c81ff83bf702bf7a40cf5046 (diff)
downloadbitcoin-75fb37ce68289eb7e00e2ccdd2ef7f9271332545.tar.xz
Merge #18032: rpc: Output a descriptor in createmultisig and addmultisigaddress
19a354b11f85a3c6c81ff83bf702bf7a40cf5046 Output a descriptor in createmultisig and addmultisigaddress (Andrew Chow) Pull request description: Give a descriptor from `createmultisig` and `addmultisigaddress`. Extracted from #16528 with `addmultisgaddress` and tests added. ACKs for top commit: Sjors: tACK 19a354b11f85a3c6c81ff83bf702bf7a40cf5046 MarcoFalke: ACK 19a354b11f85a3c6c81ff83bf702bf7a40cf5046 promag: Code review ACK 19a354b11f85a3c6c81ff83bf702bf7a40cf5046. meshcollider: utACK 19a354b11f85a3c6c81ff83bf702bf7a40cf5046 Tree-SHA512: e813125fbbc358ea8d45b1748de16a29a94efd83175b748fb8fa3b0bfc8e783ed36b6c554d84f5d4ead1ba252a83a3e937b6c3f75da7b8d3b4e55f94d6013771
Diffstat (limited to 'src')
-rw-r--r--src/rpc/misc.cpp5
-rw-r--r--src/wallet/rpcwallet.cpp5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp
index 56bd33b0ec..f360cb7525 100644
--- a/src/rpc/misc.cpp
+++ b/src/rpc/misc.cpp
@@ -83,6 +83,7 @@ static UniValue createmultisig(const JSONRPCRequest& request)
"{\n"
" \"address\":\"multisigaddress\", (string) The value of the new multisig address.\n"
" \"redeemScript\":\"script\" (string) The string value of the hex-encoded redemption script.\n"
+ " \"descriptor\":\"descriptor\" (string) The descriptor for this multisig\n"
"}\n"
},
RPCExamples{
@@ -119,9 +120,13 @@ static UniValue createmultisig(const JSONRPCRequest& request)
CScript inner;
const CTxDestination dest = AddAndGetMultisigDestination(required, pubkeys, output_type, keystore, inner);
+ // Make the descriptor
+ std::unique_ptr<Descriptor> descriptor = InferDescriptor(GetScriptForDestination(dest), keystore);
+
UniValue result(UniValue::VOBJ);
result.pushKV("address", EncodeDestination(dest));
result.pushKV("redeemScript", HexStr(inner.begin(), inner.end()));
+ result.pushKV("descriptor", descriptor->ToString());
return result;
}
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 00c4a7427a..dc9124e1a3 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -974,6 +974,7 @@ static UniValue addmultisigaddress(const JSONRPCRequest& request)
"{\n"
" \"address\":\"multisigaddress\", (string) The value of the new multisig address.\n"
" \"redeemScript\":\"script\" (string) The string value of the hex-encoded redemption script.\n"
+ " \"descriptor\":\"descriptor\" (string) The descriptor for this multisig\n"
"}\n"
},
RPCExamples{
@@ -1018,9 +1019,13 @@ static UniValue addmultisigaddress(const JSONRPCRequest& request)
CTxDestination dest = AddAndGetMultisigDestination(required, pubkeys, output_type, spk_man, inner);
pwallet->SetAddressBook(dest, label, "send");
+ // Make the descriptor
+ std::unique_ptr<Descriptor> descriptor = InferDescriptor(GetScriptForDestination(dest), spk_man);
+
UniValue result(UniValue::VOBJ);
result.pushKV("address", EncodeDestination(dest));
result.pushKV("redeemScript", HexStr(inner.begin(), inner.end()));
+ result.pushKV("descriptor", descriptor->ToString());
return result;
}