mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-28 13:02:38 +02:00
Move filtering banned addrs inside GetAddresses()
This commit is contained in:
parent
007e15dcd7
commit
ded742bc5b
@ -2530,7 +2530,13 @@ void CConnman::AddNewAddresses(const std::vector<CAddress>& vAddr, const CAddres
|
||||
|
||||
std::vector<CAddress> CConnman::GetAddresses()
|
||||
{
|
||||
return addrman.GetAddr();
|
||||
std::vector<CAddress> addresses = addrman.GetAddr();
|
||||
if (m_banman) {
|
||||
addresses.erase(std::remove_if(addresses.begin(), addresses.end(),
|
||||
[this](const CAddress& addr){return m_banman->IsDiscouraged(addr) || m_banman->IsBanned(addr);}),
|
||||
addresses.end());
|
||||
}
|
||||
return addresses;
|
||||
}
|
||||
|
||||
bool CConnman::AddNode(const std::string& strNode)
|
||||
|
@ -3480,10 +3480,7 @@ void ProcessMessage(
|
||||
std::vector<CAddress> vAddr = connman.GetAddresses();
|
||||
FastRandomContext insecure_rand;
|
||||
for (const CAddress &addr : vAddr) {
|
||||
bool banned_or_discouraged = banman && (banman->IsDiscouraged(addr) || banman->IsBanned(addr));
|
||||
if (!banned_or_discouraged) {
|
||||
pfrom.PushAddress(addr, insecure_rand);
|
||||
}
|
||||
pfrom.PushAddress(addr, insecure_rand);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user