p2p: make seed/priority ban exemption actually work; skip serving rejected connections - #66
Open
DHEBP wants to merge 1 commit into
Open
p2p: make seed/priority ban exemption actually work; skip serving rejected connections#66DHEBP wants to merge 1 commit into
DHEBP wants to merge 1 commit into
Conversation
… conns IsAddressInBanList returned true (banned) for nonbanlist entries, the opposite of the documented "never banned" intent, and the compare never matched because entries are stored as host:port while callers pass a bare IP. Normalize the stored entry and return false so seed, exclusive and priority nodes are actually exempt. The incoming-accept loop closed already-connected and banned connections but then fell through to tls.Server/ServeCodecWithState on the closed socket. Add continue after each close, matching the loop's existing rate-limiter and accept-error branches.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two small p2p fixes, both non-consensus, and no tests touch either function.
The "never ban seed/exclusive/priority nodes" exemption never worked. IsAddressInBanList returned true (banned) for those entries, backwards from the comment, and it never matched anyway since nonbanlist stores host:port while callers pass a bare IP. It now normalizes the stored entry and returns false, so IP-based entries are actually exempt. Hostname-based seeds would need DNS, so those are left out on purpose.
The incoming accept loop closed already-connected and banned connections but didn't continue, so it fell through to tls.Server + ServeCodecWithState on the closed socket — wasted work on every rejected connection. Added continue after each close, matching what the loop already does for the rate limiter and accept-error branches.
Note: Ban_Address has a comment implying it also guards seed nodes, but it doesn't — it never checks the list. The exemption is enforced here at the check instead, which also covers subnet bans. Happy to correct that comment separately if you'd prefer.