diff options
| author | Gregory Maxwell <[email protected]> | 2015-12-03 20:13:10 +0000 |
|---|---|---|
| committer | Gregory Maxwell <[email protected]> | 2015-12-03 20:13:10 +0000 |
| commit | 6aadc7557823b7673b8f661b3d41cf867e2936a3 (patch) | |
| tree | b1981615c79f249c42f239feaf259f1d2e925bfd /src/main.cpp | |
| parent | Merge pull request #7152 (diff) | |
| download | discoin-6aadc7557823b7673b8f661b3d41cf867e2936a3.tar.xz discoin-6aadc7557823b7673b8f661b3d41cf867e2936a3.zip | |
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/main.cpp')
| -rw-r--r-- | src/main.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index bfa71a729..22e71c0c4 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; |