mirror of
https://github.com/status-im/go-waku.git
synced 2025-01-27 22:15:38 +00:00
feat: add warning about bootnodes not supporting shards (#848)
This commit is contained in:
parent
cf82f66d12
commit
48acff4a5c
@ -379,9 +379,8 @@ func delayedHasNext(ctx context.Context, iterator enode.Iterator) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Iterates over the nodes found via discv5 belonging to the node's current shard, and sends them to peerConnector
|
||||
func (d *DiscoveryV5) peerLoop(ctx context.Context) error {
|
||||
iterator, err := d.PeerIterator(FilterPredicate(func(n *enode.Node) bool {
|
||||
func (d *DiscoveryV5) defaultPredicate() Predicate {
|
||||
return FilterPredicate(func(n *enode.Node) bool {
|
||||
localRS, err := wenr.RelaySharding(d.localnode.Node().Record())
|
||||
if err != nil {
|
||||
return false
|
||||
@ -413,7 +412,12 @@ func (d *DiscoveryV5) peerLoop(ctx context.Context) error {
|
||||
}
|
||||
|
||||
return false
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
// Iterates over the nodes found via discv5 belonging to the node's current shard, and sends them to peerConnector
|
||||
func (d *DiscoveryV5) peerLoop(ctx context.Context) error {
|
||||
iterator, err := d.PeerIterator(d.defaultPredicate())
|
||||
if err != nil {
|
||||
d.metrics.RecordError(iteratorFailure)
|
||||
return fmt.Errorf("obtaining iterator: %w", err)
|
||||
@ -441,6 +445,20 @@ func (d *DiscoveryV5) peerLoop(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (d *DiscoveryV5) runDiscoveryV5Loop(ctx context.Context) {
|
||||
if len(d.config.Bootnodes) > 0 {
|
||||
localRS, err := wenr.RelaySharding(d.localnode.Node().Record())
|
||||
if err == nil && localRS != nil {
|
||||
iterator := d.defaultPredicate()(enode.IterNodes(d.config.Bootnodes))
|
||||
validBootCount := 0
|
||||
for iterator.Next() {
|
||||
validBootCount++
|
||||
}
|
||||
|
||||
if validBootCount == 0 {
|
||||
d.log.Warn("no discv5 bootstrap nodes share this node configured shards")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
restartLoop:
|
||||
for {
|
||||
|
Loading…
x
Reference in New Issue
Block a user