From cd335f81680f73711a1e4fa98a3836f96d140862 Mon Sep 17 00:00:00 2001 From: Richard Ramos <info@richardramos.me> Date: Thu, 22 Jun 2023 16:36:24 -0400 Subject: [PATCH] fix: handle scenarios where localnode has no shard set --- waku/v2/discv5/discover.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/waku/v2/discv5/discover.go b/waku/v2/discv5/discover.go index bd397af5..ae358caf 100644 --- a/waku/v2/discv5/discover.go +++ b/waku/v2/discv5/discover.go @@ -364,12 +364,15 @@ func (d *DiscoveryV5) peerLoop(ctx context.Context) error { } iterator = enode.Filter(iterator, func(n *enode.Node) bool { - // TODO: might make sense to extract the next line outside of the iterator localRS, err := enr.RelaySharding(d.localnode.Node().Record()) - if err != nil || localRS == nil { + if err != nil { return false } + if localRS == nil { // No shard registered, so no need to check for shards + return true + } + nodeRS, err := enr.RelaySharding(d.localnode.Node().Record()) if err != nil || nodeRS == nil { return false