diff options
author | Ivan Metlushko <metlushko@gmail.com> | 2021-02-23 08:51:01 +0100 |
---|---|---|
committer | Ivan Metlushko <metlushko@gmail.com> | 2021-02-23 08:51:01 +0100 |
commit | a69c3b35f8974b378a87a3e42d331bd4147e07df (patch) | |
tree | 65674a8e788fb61d9bef306e2e11de8786b74846 /src/wallet/rpcdump.cpp | |
parent | 5e4a3ca2f483b0bd8230191f16d8a8c0c45af131 (diff) |
wallet: listdescriptors uses normalized descriptor form
Diffstat (limited to 'src/wallet/rpcdump.cpp')
-rw-r--r-- | src/wallet/rpcdump.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 99803a91d2..a2872f10ae 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -1775,6 +1775,8 @@ RPCHelpMan listdescriptors() throw JSONRPCError(RPC_WALLET_ERROR, "listdescriptors is not available for non-descriptor wallets"); } + EnsureWalletIsUnlocked(wallet.get()); + LOCK(wallet->cs_wallet); UniValue response(UniValue::VARR); @@ -1787,7 +1789,11 @@ RPCHelpMan listdescriptors() UniValue spk(UniValue::VOBJ); LOCK(desc_spk_man->cs_desc_man); const auto& wallet_descriptor = desc_spk_man->GetWalletDescriptor(); - spk.pushKV("desc", wallet_descriptor.descriptor->ToString()); + std::string descriptor; + if (!desc_spk_man->GetDescriptorString(descriptor, false)) { + throw JSONRPCError(RPC_WALLET_ERROR, "Can't get normalized descriptor string."); + } + spk.pushKV("desc", descriptor); spk.pushKV("timestamp", wallet_descriptor.creation_time); const bool active = active_spk_mans.count(desc_spk_man) != 0; spk.pushKV("active", active); |