mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
refactor: use ForEachAddrBookEntry in interfaces::getAddresses
This commit is contained in:
parent
032842ae41
commit
2b48642499
2 changed files with 6 additions and 6 deletions
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue