diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2020-02-22 02:50:46 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2020-04-02 16:02:56 +0000 |
commit | 8e64b8c84bcbd63caea06f3af087af1f0609eaf5 (patch) | |
tree | b3d79070111058aaa90c0ca4ba9167fc7a0ba761 /src/wallet/wallet.cpp | |
parent | 65b6bdc2b164343ec3cc3d32a0297daff9e24fec (diff) | |
download | bitcoin-8e64b8c84bcbd63caea06f3af087af1f0609eaf5.tar.xz |
Wallet: New FindAddressBookEntry method to filter out change entries (and skip ->second everywhere)
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r-- | src/wallet/wallet.cpp | 10 |
1 files changed, 10 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(); |