From 8a7283ca83587041eb607e9d4570f95b0f47246f Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Wed, 6 Apr 2022 20:34:38 +0800 Subject: [PATCH] Introduce CWallet::HaveOrchardSpendingKeyForAddress. --- src/wallet/wallet.cpp | 6 +++++- src/wallet/wallet.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 6f1cc9c2e..e3411c580 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -6716,7 +6716,7 @@ bool CWallet::HasSpendingKeys(const NoteFilter& addrSet) const { } for (const auto& addr : addrSet.GetOrchardAddresses()) { - if (!orchardWallet.GetSpendingKeyForAddress(addr).has_value()) { + if (!HaveOrchardSpendingKeyForAddress(addr)) { return false; } } @@ -6724,6 +6724,10 @@ bool CWallet::HasSpendingKeys(const NoteFilter& addrSet) const { return true; } +bool CWallet::HaveOrchardSpendingKeyForAddress( + const OrchardRawAddress &addr) const { + return orchardWallet.GetSpendingKeyForAddress(addr).has_value(); +} /** * Find notes in the wallet filtered by payment addresses, min depth, max depth, diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 1122b2990..05f241905 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1957,6 +1957,8 @@ public: */ bool HasSpendingKeys(const NoteFilter& noteFilter) const; + bool HaveOrchardSpendingKeyForAddress(const libzcash::OrchardRawAddress &addr) const; + /* Find notes filtered by payment addresses, min depth, max depth, if they are spent, if a spending key is required, and if they are locked */ void GetFilteredNotes(std::vector& sproutEntriesRet,