Skip to content

Commit

Permalink
Suppress gossip warnings due to no sampled peers (#2562)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored Dec 29, 2023
1 parent 4bcf7ee commit bbcc5f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion network/p2p/gossip/gossip.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package gossip

import (
"context"
"errors"
"fmt"
"sync"
"time"
Expand Down Expand Up @@ -165,7 +166,8 @@ func (p *PullGossiper[_]) Gossip(ctx context.Context) error {
}

for i := 0; i < p.pollSize; i++ {
if err := p.client.AppRequestAny(ctx, msgBytes, p.handleResponse); err != nil {
err := p.client.AppRequestAny(ctx, msgBytes, p.handleResponse)
if err != nil && !errors.Is(err, p2p.ErrNoPeers) {
return err
}
}
Expand Down
2 changes: 2 additions & 0 deletions network/p2p/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ func (v *Validators) Sample(ctx context.Context, limit int) []ids.NodeID {

v.refresh(ctx)

// TODO: Account for peer connectivity during the sampling of validators
// rather than filtering sampled validators.
validatorIDs := v.validatorIDs.Sample(limit)
sampled := validatorIDs[:0]

Expand Down

0 comments on commit bbcc5f0

Please sign in to comment.