Skip to content

Commit

Permalink
Disconnect on mempool requests from peers when over the upload limit.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gmaxwell committed Dec 3, 2015
1 parent 5548d9c commit 6aadc75
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4981,6 +4981,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;
Expand Down

0 comments on commit 6aadc75

Please sign in to comment.