p2p: handle return false from TCPEndpoint

This commit is contained in:
Weixie Cui 2026-05-10 01:15:04 +08:00
parent 1abbae239d
commit 159720d4da

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())
}