Disconnect on mempool requests from peers when over the upload limit.

Mempool requests use a fair amount of bandwidth when the mempool is large,
 disconnecting peers using them follows the same logic as disconnecting
 peers fetching historical blocks.

Rebased-From: 6aadc75578
Github-Pull: #7166
This commit is contained in:
Gregory Maxwell 2015-12-03 20:13:10 +00:00 committed by Wladimir J. van der Laan
parent cfb44ce97a
commit 6ba25d2886
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6

View File

@ -4982,6 +4982,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
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);
std::vector<uint256> vtxid;