Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disconnect on mempool requests from peers when over the upload limit. #7166

Merged
merged 1 commit into from Dec 4, 2015
Merged

Disconnect on mempool requests from peers when over the upload limit. #7166

merged 1 commit into from Dec 4, 2015

Conversation

gmaxwell
Copy link
Contributor

@gmaxwell gmaxwell commented Dec 3, 2015

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.

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 gmaxwell added the P2P label Dec 3, 2015
@jonasschnelli
Copy link
Contributor

jonasschnelli commented Dec 3, 2015

utACK.

@MarcoFalke
Copy link
Member

MarcoFalke commented Dec 3, 2015

Nice, Concept ACK.

@dcousens
Copy link
Contributor

dcousens commented Dec 3, 2015

ACK

Would be nice if #6589 was merged so we could quantify how much is actually used by this on average 👍

@GIJensen
Copy link

GIJensen commented Dec 4, 2015

utACK.

@petertodd
Copy link
Contributor

petertodd commented Dec 4, 2015

utACK

@laanwj laanwj merged commit 6aadc75 into bitcoin:master Dec 4, 2015
1 check passed
laanwj added a commit that referenced this issue Dec 4, 2015
6aadc75 Disconnect on mempool requests from peers when over the upload limit. (Gregory Maxwell)
gmaxwell added a commit that referenced this issue Dec 4, 2015
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: 6aadc75
Github-Pull: #7166
@laanwj
Copy link
Member

laanwj commented Dec 4, 2015

Cherry-picked to 0.12 as 6ba25d2

if (CNode::OutboundTargetReached(false) && !pfrom->fWhitelisted)
{
LogPrint("net", "mempool request with bandwidth limit reached, disconnect peer=%d\n", pfrom->GetId());
pfrom->fDisconnect = true;
Copy link
Contributor

@rebroad rebroad Feb 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member

@laanwj laanwj Feb 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 pushed a commit to codablock/dash that referenced this issue Feb 7, 2018
6aadc75 Disconnect on mempool requests from peers when over the upload limit. (Gregory Maxwell)
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this issue Jan 6, 2019
6aadc75 Disconnect on mempool requests from peers when over the upload limit. (Gregory Maxwell)
CryptoCentric pushed a commit to absolute-community/absolute that referenced this issue Feb 28, 2019
CryptoCentric pushed a commit to absolute-community/absolute that referenced this issue Mar 2, 2019
zkbot added a commit to zcash/zcash that referenced this issue Feb 18, 2021
Bitcoin 0.12 misc P2P/Net PRs

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#5288
  - Only the reorg, option was removed in bitcoin/bitcoin#6374 which we merged in #1258
- bitcoin/bitcoin#6561
- bitcoin/bitcoin#6728
- bitcoin/bitcoin#6829
- bitcoin/bitcoin#6974
- bitcoin/bitcoin#7075
- bitcoin/bitcoin#7166

Part of #2074.
zkbot added a commit to zcash/zcash that referenced this issue Feb 19, 2021
Bitcoin 0.12 misc P2P/Net PRs

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#5288
  - Only the reorg, option was removed in bitcoin/bitcoin#6374 which we merged in #1258
- bitcoin/bitcoin#6561
- bitcoin/bitcoin#6728
- bitcoin/bitcoin#6829
- bitcoin/bitcoin#6974
- bitcoin/bitcoin#7075
- bitcoin/bitcoin#7166

Part of #2074.
zkbot added a commit to zcash/zcash that referenced this issue Feb 19, 2021
Bitcoin 0.12 misc P2P/Net PRs

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#5288
  - Only the reorg, option was removed in bitcoin/bitcoin#6374 which we merged in #1258
- bitcoin/bitcoin#6561
- bitcoin/bitcoin#6728
- bitcoin/bitcoin#6829
- bitcoin/bitcoin#6974
- bitcoin/bitcoin#7075
- bitcoin/bitcoin#7166

Part of #2074.
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants