mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-05 10:12:48 +01:00
wallet: listdescriptors uses normalized descriptor form
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user