Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 2,400 Lines • ▼ Show 20 Lines | if (strCommand == NetMsgType::ADDR) { | ||||
!HasAllDesirableServiceFlags(addr.nServices)) { | !HasAllDesirableServiceFlags(addr.nServices)) { | ||||
continue; | continue; | ||||
} | } | ||||
if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60) { | if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60) { | ||||
addr.nTime = nNow - 5 * 24 * 60 * 60; | addr.nTime = nNow - 5 * 24 * 60 * 60; | ||||
} | } | ||||
pfrom->AddAddressKnown(addr); | pfrom->AddAddressKnown(addr); | ||||
if (g_banman->IsBanned(addr)) { | |||||
// Do not process banned addresses beyond remembering | |||||
// we received them | |||||
continue; | |||||
} | |||||
bool fReachable = IsReachable(addr); | bool fReachable = IsReachable(addr); | ||||
if (addr.nTime > nSince && !pfrom->fGetAddr && vAddr.size() <= 10 && | if (addr.nTime > nSince && !pfrom->fGetAddr && vAddr.size() <= 10 && | ||||
addr.IsRoutable()) { | addr.IsRoutable()) { | ||||
// Relay to a limited number of other nodes | // Relay to a limited number of other nodes | ||||
RelayAddress(addr, fReachable, connman); | RelayAddress(addr, fReachable, connman); | ||||
} | } | ||||
// Do not store addresses outside our network | // Do not store addresses outside our network | ||||
if (fReachable) { | if (fReachable) { | ||||
▲ Show 20 Lines • Show All 1,125 Lines • ▼ Show 20 Lines | if (strCommand == NetMsgType::GETADDR) { | ||||
return true; | return true; | ||||
} | } | ||||
pfrom->fSentAddr = true; | pfrom->fSentAddr = true; | ||||
pfrom->vAddrToSend.clear(); | pfrom->vAddrToSend.clear(); | ||||
std::vector<CAddress> vAddr = connman->GetAddresses(); | std::vector<CAddress> vAddr = connman->GetAddresses(); | ||||
FastRandomContext insecure_rand; | FastRandomContext insecure_rand; | ||||
for (const CAddress &addr : vAddr) { | for (const CAddress &addr : vAddr) { | ||||
if (!g_banman->IsBanned(addr)) { | |||||
pfrom->PushAddress(addr, insecure_rand); | pfrom->PushAddress(addr, insecure_rand); | ||||
} | } | ||||
} | |||||
return true; | return true; | ||||
} | } | ||||
if (strCommand == NetMsgType::MEMPOOL) { | if (strCommand == NetMsgType::MEMPOOL) { | ||||
if (!(pfrom->GetLocalServices() & NODE_BLOOM) && | if (!(pfrom->GetLocalServices() & NODE_BLOOM) && | ||||
!pfrom->HasPermission(PF_MEMPOOL)) { | !pfrom->HasPermission(PF_MEMPOOL)) { | ||||
if (!pfrom->HasPermission(PF_NOBAN)) { | if (!pfrom->HasPermission(PF_NOBAN)) { | ||||
LogPrint(BCLog::NET, | LogPrint(BCLog::NET, | ||||
▲ Show 20 Lines • Show All 1,319 Lines • Show Last 20 Lines |