diff options
| author | Andrew Chow <[email protected]> | 2019-03-25 17:00:00 -0400 |
|---|---|---|
| committer | Andrew Chow <[email protected]> | 2020-01-30 23:55:36 -0500 |
| commit | 19a354b11f85a3c6c81ff83bf702bf7a40cf5046 (patch) | |
| tree | 92498c0bc6745e0eb18f2b41cbc5f7f0256f737a /src | |
| parent | Merge #18025: doc: Add missing supported rpcs to doc/descriptors.md (diff) | |
| download | discoin-19a354b11f85a3c6c81ff83bf702bf7a40cf5046.tar.xz discoin-19a354b11f85a3c6c81ff83bf702bf7a40cf5046.zip | |
Output a descriptor in createmultisig and addmultisigaddress
Diffstat (limited to 'src')
| -rw-r--r-- | src/rpc/misc.cpp | 5 | ||||
| -rw-r--r-- | src/wallet/rpcwallet.cpp | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 56bd33b0e..f360cb752 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 df71f97e8..36f1110f2 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; } |