Skip to content

p2p: make seed/priority ban exemption actually work; skip serving rejected connections - #66

Open
DHEBP wants to merge 1 commit into
DEROFDN:community-devfrom
DHEBP:fix/p2p-ban-handling
Open

p2p: make seed/priority ban exemption actually work; skip serving rejected connections#66
DHEBP wants to merge 1 commit into
DEROFDN:community-devfrom
DHEBP:fix/p2p-ban-handling

Conversation

@DHEBP

@DHEBP DHEBP commented Aug 11, 2026

Copy link
Copy Markdown

Two small p2p fixes, both non-consensus, and no tests touch either function.

  1. 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.

  2. 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.

… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant