mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 04:12:36 -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;
|
std::string* purpose) = 0;
|
||||||
|
|
||||||
//! Get wallet address list.
|
//! Get wallet address list.
|
||||||
virtual std::vector<WalletAddress> getAddresses() = 0;
|
virtual std::vector<WalletAddress> getAddresses() const = 0;
|
||||||
|
|
||||||
//! Get receive requests.
|
//! Get receive requests.
|
||||||
virtual std::vector<std::string> getAddressReceiveRequests() = 0;
|
virtual std::vector<std::string> getAddressReceiveRequests() = 0;
|
||||||
|
|
|
@ -204,14 +204,14 @@ public:
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
std::vector<WalletAddress> getAddresses() override
|
std::vector<WalletAddress> getAddresses() const override
|
||||||
{
|
{
|
||||||
LOCK(m_wallet->cs_wallet);
|
LOCK(m_wallet->cs_wallet);
|
||||||
std::vector<WalletAddress> result;
|
std::vector<WalletAddress> result;
|
||||||
for (const auto& item : m_wallet->m_address_book) {
|
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 (item.second.IsChange()) continue;
|
if (is_change) return;
|
||||||
result.emplace_back(item.first, m_wallet->IsMine(item.first), item.second.GetLabel(), item.second.purpose);
|
result.emplace_back(dest, m_wallet->IsMine(dest), label, purpose);
|
||||||
}
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::vector<std::string> getAddressReceiveRequests() override {
|
std::vector<std::string> getAddressReceiveRequests() override {
|
||||||
|
|
Loading…
Reference in a new issue