aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorIvan Metlushko <metlushko@gmail.com>2021-02-02 09:28:27 +0100
committerIvan Metlushko <metlushko@gmail.com>2021-03-09 09:04:35 +0100
commit2e5f7def22e1b212fbd69e9147145d9d1f408aaf (patch)
tree689614f9dd072e7b68a2739189db1c52bafef1af /src/wallet
parent461f0c781e5a9c13df21ca0c35029f685758d0bb (diff)
downloadbitcoin-2e5f7def22e1b212fbd69e9147145d9d1f408aaf.tar.xz
wallet, rpc: update listdescriptors response format
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/rpcdump.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index a2872f10ae..748d911efe 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -1747,22 +1747,23 @@ RPCHelpMan listdescriptors()
"listdescriptors",
"\nList descriptors imported into a descriptor-enabled wallet.",
{},
- RPCResult{
- RPCResult::Type::ARR, "", "Response is an array of descriptor objects",
+ RPCResult{RPCResult::Type::OBJ, "", "", {
+ {RPCResult::Type::STR, "wallet_name", "Name of wallet this operation was performed on"},
+ {RPCResult::Type::ARR, "descriptors", "Array of descriptor objects",
{
{RPCResult::Type::OBJ, "", "", {
{RPCResult::Type::STR, "desc", "Descriptor string representation"},
{RPCResult::Type::NUM, "timestamp", "The creation time of the descriptor"},
{RPCResult::Type::BOOL, "active", "Activeness flag"},
- {RPCResult::Type::BOOL, "internal", true, "Whether this is internal or external descriptor; defined only for active descriptors"},
+ {RPCResult::Type::BOOL, "internal", true, "Whether this is an internal or external descriptor; defined only for active descriptors"},
{RPCResult::Type::ARR_FIXED, "range", true, "Defined only for ranged descriptors", {
{RPCResult::Type::NUM, "", "Range start inclusive"},
{RPCResult::Type::NUM, "", "Range end inclusive"},
}},
{RPCResult::Type::NUM, "next", true, "The next index to generate addresses from; defined only for ranged descriptors"},
}},
- }
- },
+ }}
+ }},
RPCExamples{
HelpExampleCli("listdescriptors", "") + HelpExampleRpc("listdescriptors", "")
},
@@ -1779,7 +1780,7 @@ RPCHelpMan listdescriptors()
LOCK(wallet->cs_wallet);
- UniValue response(UniValue::VARR);
+ UniValue descriptors(UniValue::VARR);
const auto active_spk_mans = wallet->GetActiveScriptPubKeyMans();
for (const auto& spk_man : wallet->GetAllScriptPubKeyMans()) {
const auto desc_spk_man = dynamic_cast<DescriptorScriptPubKeyMan*>(spk_man);
@@ -1808,9 +1809,13 @@ RPCHelpMan listdescriptors()
spk.pushKV("range", range);
spk.pushKV("next", wallet_descriptor.next_index);
}
- response.push_back(spk);
+ descriptors.push_back(spk);
}
+ UniValue response(UniValue::VOBJ);
+ response.pushKV("wallet_name", wallet->GetName());
+ response.pushKV("descriptors", descriptors);
+
return response;
},
};