aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2015-12-03 20:13:10 +0000
committerGregory Maxwell <greg@xiph.org>2015-12-03 20:13:10 +0000
commit6aadc7557823b7673b8f661b3d41cf867e2936a3 (patch)
treeb1981615c79f249c42f239feaf259f1d2e925bfd /src
parent5548d9cb11c8e66fa4913aba5e7d28acc2c5a9d0 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp6
1 files changed, 6 insertions, 0 deletions
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<uint256> vtxid;