aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet.cpp10
-rw-r--r--src/wallet/wallet.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 6b061308ec..ab36dacf37 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -4104,6 +4104,16 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
return walletInstance;
}
+const CAddressBookData* CWallet::FindAddressBookEntry(const CTxDestination& dest, bool allow_change) const
+{
+ const auto& address_book_it = m_address_book.find(dest);
+ if (address_book_it == m_address_book.end()) return nullptr;
+ if ((!allow_change) && address_book_it->second.IsChange()) {
+ return nullptr;
+ }
+ return &address_book_it->second;
+}
+
void CWallet::postInitProcess()
{
auto locked_chain = chain().lock();
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 788f29c039..c681dd28c8 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -785,6 +785,7 @@ public:
uint64_t nAccountingEntryNumber = 0;
std::map<CTxDestination, CAddressBookData> m_address_book GUARDED_BY(cs_wallet);
+ const CAddressBookData* FindAddressBookEntry(const CTxDestination&, bool allow_change = false) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
std::set<COutPoint> setLockedCoins GUARDED_BY(cs_wallet);