-
-
Notifications
You must be signed in to change notification settings - Fork 369
Net: bound automatic peer discouragement #1937
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
Open
navidR
wants to merge
1
commit into
firoorg:master
Choose a base branch
from
navidR:dev/navidr/bounded-automatic-discouragement
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,7 +165,7 @@ struct CNodeState { | |
| bool fCurrentlyConnected; | ||
| //! Accumulated misbehaviour score for this peer. | ||
| int nMisbehavior; | ||
| //! Whether this peer should be disconnected and banned (unless whitelisted). | ||
| //! Whether this peer should be disconnected and discouraged (unless whitelisted). | ||
| bool fShouldBan; | ||
| //! String name of this peer (debugging/logging purposes). | ||
| const std::string name; | ||
|
|
@@ -744,7 +744,7 @@ void Misbehaving(NodeId pnode, int howmuch) | |
| int banscore = GetArg("-banscore", DEFAULT_BANSCORE_THRESHOLD); | ||
| if (state->nMisbehavior >= banscore && state->nMisbehavior - howmuch < banscore) | ||
| { | ||
| LogPrintf("%s: %s peer=%d (%d -> %d) BAN THRESHOLD EXCEEDED\n", __func__, state->name, pnode, state->nMisbehavior-howmuch, state->nMisbehavior); | ||
| LogPrintf("%s: %s peer=%d (%d -> %d) DISCOURAGEMENT THRESHOLD EXCEEDED\n", __func__, state->name, pnode, state->nMisbehavior - howmuch, state->nMisbehavior); | ||
| state->fShouldBan = true; | ||
| } else | ||
| LogPrintf("%s: %s peer=%d (%d -> %d)\n", __func__, state->name, pnode, state->nMisbehavior-howmuch, state->nMisbehavior); | ||
|
|
@@ -3177,11 +3177,12 @@ static bool SendRejectsAndCheckIfBanned(CNode* pnode, CConnman& connman) | |
| llmq::quorumSigSharesManager->MarkNodeBanned(pnode->GetId()); | ||
| } | ||
| pnode->fDisconnect = true; | ||
| if (pnode->addr.IsLocal()) | ||
| LogPrintf("Warning: not banning local peer %s!\n", pnode->addr.ToString()); | ||
| else | ||
| { | ||
| connman.Ban(pnode->addr, BanReasonNodeMisbehaving); | ||
| if (pnode->addr.IsLocal()) { | ||
| LogPrintf("Warning: not discouraging local peer %s!\n", pnode->addr.ToString()); | ||
| } else { | ||
| LogPrintf("Disconnecting and discouraging peer %s!\n", pnode->addr.ToString()); | ||
| connman.Discourage(pnode->addr); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: For an invalid peer address, this records the invalid address byte key; unresolved peers share that key, so one offender discourages every invalid address. [logic error] Assessment: 🟠 Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** src/net_processing.cpp
**Line:** 3184:3184
**Comment:**
*Logic Error: For an invalid peer address, this records the invalid address byte key; unresolved peers share that key, so one offender discourages every invalid address.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix |
||
| connman.DisconnectNode(pnode->addr); | ||
| } | ||
| } | ||
| return true; | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
setDiscouragedis never reset byClearBanned, so repeated tests and users clearing bans retain automatic discouragement for previously recorded addresses. [state/lifecycle]Assessment: 🟠
Major· 🔁Occurrence: SometimesPrompt for AI Agent 🤖