Skip to content

Commit

Permalink
fix: handle scenarios where localnode has no shard set
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos committed Jun 26, 2023
1 parent eba4aa4 commit cd335f8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions waku/v2/discv5/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cd335f8

Please sign in to comment.