Skip to content

p2p/enode: fallback to v6 ports for selected ipv4 endpoint#35352

Open
gzliudan wants to merge 1 commit into
ethereum:masterfrom
gzliudan:fix-setIPv4Ports
Open

p2p/enode: fallback to v6 ports for selected ipv4 endpoint#35352
gzliudan wants to merge 1 commit into
ethereum:masterfrom
gzliudan:fix-setIPv4Ports

Conversation

@gzliudan

Copy link
Copy Markdown
Contributor

When IPv4 is selected as the preferred address but only UDP6/TCP6 ports are present in ENR, the previous logic left UDP/TCP as zero and produced a non-usable endpoint.

Load IPv4 ports first and fall back to UDP6/TCP6 ports only when the IPv4 keys are missing, matching the existing missing-key fallback semantics in function setIP6.

Add a regression test covering the mixed-stack case where IPv4 is selected while only IPv6-family ports are populated.

When IPv4 is selected as the preferred address but only UDP6/TCP6 ports are present in ENR, the previous logic left UDP/TCP as zero and produced a non-usable endpoint.

Load IPv4 ports first and fall back to UDP6/TCP6 ports only when the IPv4 keys are missing, matching the existing missing-key fallback semantics in function `setIP6`.

Add a regression test covering the mixed-stack case where IPv4 is selected while only IPv6-family ports are populated.
@gzliudan gzliudan requested a review from fjl as a code owner July 14, 2026 07:32
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