Skip to content

Commit 6aadc75

Browse files
committed
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.
1 parent 5548d9c commit 6aadc75

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4981,6 +4981,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
49814981

49824982
else if (strCommand == "mempool")
49834983
{
4984+
if (CNode::OutboundTargetReached(false) && !pfrom->fWhitelisted)
4985+
{
4986+
LogPrint("net", "mempool request with bandwidth limit reached, disconnect peer=%d\n", pfrom->GetId());
4987+
pfrom->fDisconnect = true;
4988+
return true;
4989+
}
49844990
LOCK2(cs_main, pfrom->cs_filter);
49854991

49864992
std::vector<uint256> vtxid;

0 commit comments

Comments
 (0)