aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpc/util.cpp
diff options
context:
space:
mode:
authorAntoine Poinsot <darosior@protonmail.com>2022-06-29 19:04:48 +0200
committerAntoine Poinsot <darosior@protonmail.com>2022-07-19 12:46:01 +0200
commitb724476158a7dfeef9edfda3f519dfd6f93202a8 (patch)
treec5b5f53acb4f58c6ddc9d155c515c877e37a186b /src/wallet/rpc/util.cpp
parent55a82eaf91d252a04a0cc8ad7d948d956c6cb24f (diff)
downloadbitcoin-b724476158a7dfeef9edfda3f519dfd6f93202a8.tar.xz
rpc: output wallet descriptors for received entries in listsinceblock
The descriptor wallets allow an application to track coins of multiple descriptors in a single wallet. However, such an application would not previously be able to (easily) tell what received coin "belongs" to what descriptor. This commit tackles this issues by adding a "wallet_desc" entry to the entries for received coins in 'listsinceblock'.
Diffstat (limited to 'src/wallet/rpc/util.cpp')
-rw-r--r--src/wallet/rpc/util.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wallet/rpc/util.cpp b/src/wallet/rpc/util.cpp
index 4fcb393226..16305d4465 100644
--- a/src/wallet/rpc/util.cpp
+++ b/src/wallet/rpc/util.cpp
@@ -123,6 +123,15 @@ std::string LabelFromValue(const UniValue& value)
return label;
}
+void PushParentDescriptors(const CWallet& wallet, const CScript& script_pubkey, UniValue& entry)
+{
+ UniValue parent_descs(UniValue::VARR);
+ for (const auto& desc: wallet.GetWalletDescriptors(script_pubkey)) {
+ parent_descs.push_back(desc.descriptor->ToString());
+ }
+ entry.pushKV("parent_descs", parent_descs);
+}
+
void HandleWalletError(const std::shared_ptr<CWallet> wallet, DatabaseStatus& status, bilingual_str& error)
{
if (!wallet) {