diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2020-02-22 04:16:36 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2020-04-02 16:25:17 +0000 |
commit | c751d886f499257627b308b11ffaa51c22db6cc0 (patch) | |
tree | da16f6fe7552691501c4ae52e191c2e8f0931a4f /src/wallet/wallet.cpp | |
parent | 8e64b8c84bcbd63caea06f3af087af1f0609eaf5 (diff) |
Wallet: Avoid treating change-in-the-addressbook as non-change everywhere
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r-- | src/wallet/wallet.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index ab36dacf37..b4cbcfd005 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1237,8 +1237,9 @@ bool CWallet::IsChange(const CScript& script) const return true; LOCK(cs_wallet); - if (!m_address_book.count(address)) + if (!FindAddressBookEntry(address)) { return true; + } } return false; } @@ -3192,7 +3193,7 @@ bool CWallet::SetAddressBookWithDB(WalletBatch& batch, const CTxDestination& add { LOCK(cs_wallet); std::map<CTxDestination, CAddressBookData>::iterator mi = m_address_book.find(address); - fUpdated = mi != m_address_book.end(); + fUpdated = (mi != m_address_book.end() && !mi->second.IsChange()); m_address_book[address].SetLabel(strName); if (!strPurpose.empty()) /* update purpose only if requested */ m_address_book[address].purpose = strPurpose; @@ -3459,6 +3460,7 @@ std::set<CTxDestination> CWallet::GetLabelAddresses(const std::string& label) co std::set<CTxDestination> result; for (const std::pair<const CTxDestination, CAddressBookData>& item : m_address_book) { + if (item.second.IsChange()) continue; const CTxDestination& address = item.first; const std::string& strName = item.second.name; if (strName == label) |