mirror of
https://github.com/logos-messaging/logos-messaging-go.git
synced 2026-01-07 16:33:08 +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
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterates over the nodes found via discv5 belonging to the node's current shard, and sends them to peerConnector
|
func (d *DiscoveryV5) defaultPredicate() Predicate {
|
||||||
func (d *DiscoveryV5) peerLoop(ctx context.Context) error {
|
return FilterPredicate(func(n *enode.Node) bool {
|
||||||
iterator, err := d.PeerIterator(FilterPredicate(func(n *enode.Node) bool {
|
|
||||||
localRS, err := wenr.RelaySharding(d.localnode.Node().Record())
|
localRS, err := wenr.RelaySharding(d.localnode.Node().Record())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
@ -413,7 +412,12 @@ func (d *DiscoveryV5) peerLoop(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false
|
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 {
|
if err != nil {
|
||||||
d.metrics.RecordError(iteratorFailure)
|
d.metrics.RecordError(iteratorFailure)
|
||||||
return fmt.Errorf("obtaining iterator: %w", err)
|
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) {
|
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:
|
restartLoop:
|
||||||
for {
|
for {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user