aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2015-12-03 20:13:10 +0000
committerWladimir J. van der Laan <laanwj@gmail.com>2015-12-04 09:44:24 +0100
commit6ba25d28868146d5d6dbd671881db3a58f549567 (patch)
tree2a6ab36950d3daf79049feb1090693bceeef1b3f /src
parentcfb44ce97a939cb9b6db96f4b273c2a618e11d88 (diff)
downloadbitcoin-6ba25d28868146d5d6dbd671881db3a58f549567.tar.xz
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: 6aadc7557823b7673b8f661b3d41cf867e2936a3 Github-Pull: #7166
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 cb3f8f39f8..b200109a6a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4982,6 +4982,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;