Skip to content

Commit 81f732b

Browse files
committed
Merge #15617: p2p: Do not relay banned IP addresses
054d01d Do not relay banned IP addresses (Pieter Wuille) Pull request description: Tree-SHA512: 538c43781c789949e1ae566533e76835d478e40e8ba6427b22234ee611cb4a311b2940a214e37c1e9c9afe28a6814a00d490a39e3580bb5ebd85b03e95040246
2 parents e45b7f2 + 054d01d commit 81f732b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/net_processing.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,6 +2022,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
20222022
if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60)
20232023
addr.nTime = nNow - 5 * 24 * 60 * 60;
20242024
pfrom->AddAddressKnown(addr);
2025+
if (g_banman->IsBanned(addr)) continue; // Do not process banned addresses beyond remembering we received them
20252026
bool fReachable = IsReachable(addr);
20262027
if (addr.nTime > nSince && !pfrom->fGetAddr && vAddr.size() <= 10 && addr.IsRoutable())
20272028
{
@@ -2912,8 +2913,11 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
29122913
pfrom->vAddrToSend.clear();
29132914
std::vector<CAddress> vAddr = connman->GetAddresses();
29142915
FastRandomContext insecure_rand;
2915-
for (const CAddress &addr : vAddr)
2916-
pfrom->PushAddress(addr, insecure_rand);
2916+
for (const CAddress &addr : vAddr) {
2917+
if (!g_banman->IsBanned(addr)) {
2918+
pfrom->PushAddress(addr, insecure_rand);
2919+
}
2920+
}
29172921
return true;
29182922
}
29192923

0 commit comments

Comments
 (0)