diff --git a/p2p/netutil/net.go b/p2p/netutil/net.go index 85c62cf5d4..560c68e168 100644 --- a/p2p/netutil/net.go +++ b/p2p/netutil/net.go @@ -290,11 +290,7 @@ func (s *DistinctNetSet) RemoveAddr(ip netip.Addr) { // Contains whether the given IP is contained in the set. func (s DistinctNetSet) Contains(ip net.IP) bool { - addr, ok := netip.AddrFromSlice(ip) - if !ok { - panic(fmt.Errorf("invalid IP %v", ip)) - } - return s.ContainsAddr(addr) + return s.ContainsAddr(IPToAddr(ip)) } // Contains whether the given IP is contained in the set.