mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 08:49:29 +00:00
Mirror the guard applied to (*UDPv4).Dial in #34916: when the target node has no usable UDP endpoint, return errNoUDPEndpoint instead of silently sending the ENRRequest to an invalid AddrPort and waiting for a timeout. The other UDPEndpoint-using request paths in this file already do this: ping v4_udp.go:215 errNoUDPEndpoint Ping v4_udp.go:228 errNoUDPEndpoint newLookup v4_udp.go:309 errNoUDPEndpoint RequestENR v4_udp.go:358 addr, _ := n.UDPEndpoint() <-- outlier RequestENR is reachable from external callers like cmd/devp2p/crawl.go, which feeds in arbitrary nodes that may not have a UDP port set. Before this change, such nodes burn one full RPC timeout; after it, the caller gets a clean error immediately. The added test fails on master with "RPC timeout" and the trace logs "PING/v4 addr=invalid AddrPort", confirming packets are being written to an unspecified address; with the fix it returns errNoUDPEndpoint without doing any I/O. |
||
|---|---|---|
| .. | ||
| v4wire | ||
| v5wire | ||
| common.go | ||
| lookup.go | ||
| metrics.go | ||
| node.go | ||
| ntp.go | ||
| table.go | ||
| table_reval.go | ||
| table_reval_test.go | ||
| table_test.go | ||
| table_util_test.go | ||
| v4_lookup_test.go | ||
| v4_udp.go | ||
| v4_udp_test.go | ||
| v5_talk.go | ||
| v5_udp.go | ||
| v5_udp_test.go | ||