Do not disconnect peer for asking mempool if it has NO_BAN permission

This commit is contained in:
nicolas.dorier
2019-06-21 11:31:12 +09:00
parent e5b26deaaa
commit ecd5cf7ea4

View File

@ -3011,16 +3011,22 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
if (strCommand == NetMsgType::MEMPOOL) { if (strCommand == NetMsgType::MEMPOOL) {
if (!(pfrom->GetLocalServices() & NODE_BLOOM) && !pfrom->fWhitelisted) if (!(pfrom->GetLocalServices() & NODE_BLOOM) && !pfrom->fWhitelisted)
{
if (!pfrom->HasPermission(PF_NOBAN))
{ {
LogPrint(BCLog::NET, "mempool request with bloom filters disabled, disconnect peer=%d\n", pfrom->GetId()); LogPrint(BCLog::NET, "mempool request with bloom filters disabled, disconnect peer=%d\n", pfrom->GetId());
pfrom->fDisconnect = true; pfrom->fDisconnect = true;
}
return true; return true;
} }
if (connman->OutboundTargetReached(false) && !pfrom->fWhitelisted) if (connman->OutboundTargetReached(false) && !pfrom->fWhitelisted)
{
if (!pfrom->HasPermission(PF_NOBAN))
{ {
LogPrint(BCLog::NET, "mempool request with bandwidth limit reached, disconnect peer=%d\n", pfrom->GetId()); LogPrint(BCLog::NET, "mempool request with bandwidth limit reached, disconnect peer=%d\n", pfrom->GetId());
pfrom->fDisconnect = true; pfrom->fDisconnect = true;
}
return true; return true;
} }