refactor: use ForEachAddrBookEntry in interfaces::getAddresses

This commit is contained in:
furszy 2022-06-11 11:38:19 -03:00
parent 032842ae41
commit 2b48642499
No known key found for this signature in database
GPG key ID: 5DD23CCC686AA623
2 changed files with 6 additions and 6 deletions

View file

@ -114,7 +114,7 @@ public:
std::string* purpose) = 0;
//! Get wallet address list.
virtual std::vector<WalletAddress> getAddresses() = 0;
virtual std::vector<WalletAddress> getAddresses() const = 0;
//! Get receive requests.
virtual std::vector<std::string> getAddressReceiveRequests() = 0;

View file

@ -204,14 +204,14 @@ public:
}
return true;
}
std::vector<WalletAddress> getAddresses() override
std::vector<WalletAddress> getAddresses() const override
{
LOCK(m_wallet->cs_wallet);
std::vector<WalletAddress> result;
for (const auto& item : m_wallet->m_address_book) {
if (item.second.IsChange()) continue;
result.emplace_back(item.first, m_wallet->IsMine(item.first), item.second.GetLabel(), item.second.purpose);
}
m_wallet->ForEachAddrBookEntry([&](const CTxDestination& dest, const std::string& label, const std::string& purpose, bool is_change) EXCLUSIVE_LOCKS_REQUIRED(m_wallet->cs_wallet) {
if (is_change) return;
result.emplace_back(dest, m_wallet->IsMine(dest), label, purpose);
});
return result;
}
std::vector<std::string> getAddressReceiveRequests() override {