Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress gossip warnings due to no sampled peers #2562

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -163,7 +164,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
Loading