Skip to content

Commit 6ba25d2

Browse files
gmaxwelllaanwj
authored andcommitted
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: 6aadc75 Github-Pull: #7166
1 parent cfb44ce commit 6ba25d2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/main.cpp

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

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

49874993
std::vector<uint256> vtxid;

0 commit comments

Comments
 (0)