From 6aadc7557823b7673b8f661b3d41cf867e2936a3 Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Thu, 3 Dec 2015 20:13:10 +0000 Subject: 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. --- src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index bfa71a7292..22e71c0c48 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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 vtxid; -- cgit v1.2.3