From 91018a442359ce1af5e1810488b50e3fbb000f54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=20=C4=90ANG?= Date: Fri, 15 Jul 2022 10:26:32 +0700 Subject: [PATCH] p2p/discover: only get the peer nodes in netrestrict config --- p2p/discover/v5_udp.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/p2p/discover/v5_udp.go b/p2p/discover/v5_udp.go index 69aaefa27897..6ffa7bef7e1a 100644 --- a/p2p/discover/v5_udp.go +++ b/p2p/discover/v5_udp.go @@ -407,6 +407,9 @@ func (t *UDPv5) verifyResponseNode(c *callV5, r *enr.Record, distances []uint, s if err := netutil.CheckRelayIP(c.node.IP(), node.IP()); err != nil { return nil, err } + if t.netrestrict != nil && !t.netrestrict.Contains(node.IP()) { + return nil, errors.New("not contained in netrestrict list") + } if c.node.UDP() <= 1024 { return nil, errLowPort }