fix: handle scenarios where localnode has no shard set

This commit is contained in:
Richard Ramos 2023-06-22 16:36:24 -04:00 committed by richΛrd
parent eba4aa43e5
commit cd335f8168

View File

@ -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