mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
net: Optionally include terrible addresses in GetAddr results
This commit is contained in:
@@ -800,7 +800,7 @@ int AddrManImpl::GetEntry(bool use_tried, size_t bucket, size_t position) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::vector<CAddress> AddrManImpl::GetAddr_(size_t max_addresses, size_t max_pct, std::optional<Network> network) const
|
||||
std::vector<CAddress> AddrManImpl::GetAddr_(size_t max_addresses, size_t max_pct, std::optional<Network> network, const bool filtered) const
|
||||
{
|
||||
AssertLockHeld(cs);
|
||||
|
||||
@@ -830,7 +830,7 @@ std::vector<CAddress> AddrManImpl::GetAddr_(size_t max_addresses, size_t max_pct
|
||||
if (network != std::nullopt && ai.GetNetClass() != network) continue;
|
||||
|
||||
// Filter for quality
|
||||
if (ai.IsTerrible(now)) continue;
|
||||
if (ai.IsTerrible(now) && filtered) continue;
|
||||
|
||||
addresses.push_back(ai);
|
||||
}
|
||||
@@ -1214,11 +1214,11 @@ std::pair<CAddress, NodeSeconds> AddrManImpl::Select(bool new_only, std::optiona
|
||||
return addrRet;
|
||||
}
|
||||
|
||||
std::vector<CAddress> AddrManImpl::GetAddr(size_t max_addresses, size_t max_pct, std::optional<Network> network) const
|
||||
std::vector<CAddress> AddrManImpl::GetAddr(size_t max_addresses, size_t max_pct, std::optional<Network> network, const bool filtered) const
|
||||
{
|
||||
LOCK(cs);
|
||||
Check();
|
||||
auto addresses = GetAddr_(max_addresses, max_pct, network);
|
||||
auto addresses = GetAddr_(max_addresses, max_pct, network, filtered);
|
||||
Check();
|
||||
return addresses;
|
||||
}
|
||||
@@ -1317,9 +1317,9 @@ std::pair<CAddress, NodeSeconds> AddrMan::Select(bool new_only, std::optional<Ne
|
||||
return m_impl->Select(new_only, network);
|
||||
}
|
||||
|
||||
std::vector<CAddress> AddrMan::GetAddr(size_t max_addresses, size_t max_pct, std::optional<Network> network) const
|
||||
std::vector<CAddress> AddrMan::GetAddr(size_t max_addresses, size_t max_pct, std::optional<Network> network, const bool filtered) const
|
||||
{
|
||||
return m_impl->GetAddr(max_addresses, max_pct, network);
|
||||
return m_impl->GetAddr(max_addresses, max_pct, network, filtered);
|
||||
}
|
||||
|
||||
std::vector<std::pair<AddrInfo, AddressPosition>> AddrMan::GetEntries(bool use_tried) const
|
||||
|
||||
Reference in New Issue
Block a user