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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main.cpp
Expand Up @@ -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;
Copy link
Contributor

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

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.

return true;
}
LOCK2(cs_main, pfrom->cs_filter);

std::vector<uint256> vtxid;
Expand Down