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.
Disconnect on mempool requests from peers when over the upload limit. #7166
pull gmaxwell wants to merge 1 commits into bitcoin:master from gmaxwell:mempool_p2p_when_overlimit changing 1 files +6 −0-
gmaxwell commented at 8:17 PM on December 3, 2015: contributor
-
6aadc75578
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.
- gmaxwell added the label P2P on Dec 3, 2015
-
jonasschnelli commented at 8:21 PM on December 3, 2015: contributor
utACK.
-
MarcoFalke commented at 8:31 PM on December 3, 2015: member
Nice, Concept ACK.
-
GIJensen commented at 12:14 AM on December 4, 2015: none
utACK.
-
petertodd commented at 12:41 AM on December 4, 2015: contributor
utACK
- laanwj merged this on Dec 4, 2015
- laanwj closed this on Dec 4, 2015
- laanwj referenced this in commit 792259278e on Dec 4, 2015
- gmaxwell referenced this in commit 6ba25d2886 on Dec 4, 2015
-
laanwj commented at 8:45 AM on December 4, 2015: member
Cherry-picked to 0.12 as 6ba25d2
-
in src/main.cpp:None in 6aadc75578
4980 | @@ -4981,6 +4981,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, 4981 | 4982 | else if (strCommand == "mempool") 4983 | { 4984 | + if (CNode::OutboundTargetReached(false) && !pfrom->fWhitelisted) 4985 | + { 4986 | + LogPrint("net", "mempool request with bandwidth limit reached, disconnect peer=%d\n", pfrom->GetId()); 4987 | + pfrom->fDisconnect = true;
rebroad commented at 2:46 PM on February 1, 2016:I'm not sure how much this achieves, just disconnecting. Is this considered misbehavior? Should it be considered misbehavior if the node reconnects and continues this behavior?
laanwj commented at 3:35 PM on February 1, 2016:It's not misbehavior - the peer cannot know that you're close to exceeding your bandwidth limit.
If the node reconnects and keeps bombarding with mempool commands it is absolutely misbehavior (with or without this pull), but this change is not meant as mitigation for attacks. For better or worse, at the moment we don't have any framework to ban peers based on P2P-level behavior.
codablock referenced this in commit 33dc16278f on Feb 7, 2018codablock referenced this in commit 78e6ddfb18 on Feb 7, 2018codablock referenced this in commit 1086851938 on Feb 7, 2018andvgal referenced this in commit 3d03adcea1 on Jan 6, 2019CryptoCentric referenced this in commit cd0ff280d6 on Feb 28, 2019CryptoCentric referenced this in commit e5ddb78ae5 on Mar 2, 2019zkbot referenced this in commit e10008da66 on Feb 18, 2021zkbot referenced this in commit 777deea264 on Feb 19, 2021zkbot referenced this in commit b62e35dee8 on Feb 19, 2021MarcoFalke locked this on Sep 8, 2021Labels
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 21:15 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 21:15 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me