mirror of
https://github.com/status-im/go-waku.git
synced 2025-01-28 06:25:13 +00:00
fix: handle scenarios where localnode has no shard set
This commit is contained in:
parent
eba4aa43e5
commit
cd335f8168
@ -364,12 +364,15 @@ func (d *DiscoveryV5) peerLoop(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
iterator = enode.Filter(iterator, func(n *enode.Node) bool {
|
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())
|
localRS, err := enr.RelaySharding(d.localnode.Node().Record())
|
||||||
if err != nil || localRS == nil {
|
if err != nil {
|
||||||
return false
|
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())
|
nodeRS, err := enr.RelaySharding(d.localnode.Node().Record())
|
||||||
if err != nil || nodeRS == nil {
|
if err != nil || nodeRS == nil {
|
||||||
return false
|
return false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user