Wallet: New FindAddressBookEntry method to filter out change entries (and skip ->second everywhere)
This commit is contained in:
parent
65b6bdc2b1
commit
8e64b8c84b
@ -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();
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user