Merge pull request #7166

6aadc75 Disconnect on mempool requests from peers when over the upload limit. (Gregory Maxwell)
This commit is contained in:
Wladimir J. van der Laan 2015-12-04 09:43:04 +01:00
commit 792259278e
No known key found for this signature in database
GPG key ID: 74810B012346C9A6

View file

@ -4981,6 +4981,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
else if (strCommand == "mempool") else if (strCommand == "mempool")
{ {
if (CNode::OutboundTargetReached(false) && !pfrom->fWhitelisted)
{
LogPrint("net", "mempool request with bandwidth limit reached, disconnect peer=%d\n", pfrom->GetId());
pfrom->fDisconnect = true;
return true;
}
LOCK2(cs_main, pfrom->cs_filter); LOCK2(cs_main, pfrom->cs_filter);
std::vector<uint256> vtxid; std::vector<uint256> vtxid;