aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net.cpp8
-rw-r--r--src/net_processing.cpp5
2 files changed, 8 insertions, 5 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 0c56cddbdc..171358bb5f 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -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)
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 5f1e7318f3..0aa7288b7d 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -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;
}