p2p: handle return false from TCPEndpoint (#34916)

This commit is contained in:
cui 2026-05-10 19:02:46 +08:00 committed by GitHub
parent 8581125a21
commit bcb68d23b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -67,7 +67,10 @@ type tcpDialer struct {
}
func (t tcpDialer) Dial(ctx context.Context, dest *enode.Node) (net.Conn, error) {
addr, _ := dest.TCPEndpoint()
addr, ok := dest.TCPEndpoint()
if !ok {
return nil, errNoPort
}
return t.d.DialContext(ctx, "tcp", addr.String())
}