From 2db0c5c3a5618415f46d5d6150820d646f13dc88 Mon Sep 17 00:00:00 2001 From: guillaumemichel Date: Tue, 13 Aug 2024 13:27:46 +0200 Subject: [PATCH] p2p: handle ip4/6 quic addresses --- p2p/enode/node.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/p2p/enode/node.go b/p2p/enode/node.go index c8d521529f67e..fdf75509be2c3 100644 --- a/p2p/enode/node.go +++ b/p2p/enode/node.go @@ -202,8 +202,12 @@ func (n *Node) TCPEndpoint() (netip.AddrPort, bool) { // QUICEndpoint returns the announced QUIC endpoint. func (n *Node) QUICEndpoint() (netip.AddrPort, bool) { - var quic enr.QUIC - n.Load(&quic) + var quic uint16 + if n.ip.Is4() || n.ip.Is4In6() { + n.Load((*enr.QUIC)(&quic)) + } else { + n.Load((*enr.QUIC6)(&quic)) + } if !n.ip.IsValid() || n.ip.IsUnspecified() || quic == 0 { return netip.AddrPort{}, false }