From 183d7a17ff5c9781b2855959417de3908fba8dc9 Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Thu, 2 Jul 2026 22:55:18 +0800 Subject: [PATCH] p2p: skip netrestrict check for nodes without resolved IP Hostname-only static nodes have no valid IP at checkDial time and are resolved later in dialTask. Applying netrestrict to them incorrectly rejected the dial before resolution could happen. --- p2p/dial.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p2p/dial.go b/p2p/dial.go index 0ffcd1049730..87690e637663 100644 --- a/p2p/dial.go +++ b/p2p/dial.go @@ -428,7 +428,7 @@ func (d *dialScheduler) checkDial(n *enode.Node) error { if _, ok := d.pendingInbound[n.ID()]; ok { return errPendingInbound } - if d.netRestrict != nil && !d.netRestrict.ContainsAddr(n.IPAddr()) { + if d.netRestrict != nil && n.IPAddr().IsValid() && !d.netRestrict.ContainsAddr(n.IPAddr()) { return errNetRestrict } if d.history.contains(string(n.ID().Bytes())) {