mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Wait until fully synced to process pubsub messages (#3514)
* context timeout for pubsub message processing * add syncing check * gofmt * use a global cache * lint * fmt * fix conflicts * revert change * gaz
This commit is contained in:
@@ -6,8 +6,8 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
"github.com/prysmaticlabs/go-ssz"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/sync/peerstatus"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -33,7 +33,7 @@ func (r *RegularSync) processPendingBlocksQueue() {
|
||||
|
||||
// processes the block tree inside the queue
|
||||
func (r *RegularSync) processPendingBlocks(ctx context.Context) error {
|
||||
pids := r.peerIDs()
|
||||
pids := peerstatus.Keys()
|
||||
slots := r.sortedPendingSlots()
|
||||
|
||||
for _, s := range slots {
|
||||
@@ -82,15 +82,6 @@ func (r *RegularSync) processPendingBlocks(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *RegularSync) peerIDs() []peer.ID {
|
||||
hellos := r.PeerStatuses()
|
||||
pids := make([]peer.ID, 0, len(hellos))
|
||||
for pid := range hellos {
|
||||
pids = append(pids, pid)
|
||||
}
|
||||
return pids
|
||||
}
|
||||
|
||||
func (r *RegularSync) sortedPendingSlots() []int {
|
||||
r.pendingQueueLock.RLock()
|
||||
defer r.pendingQueueLock.RUnlock()
|
||||
|
||||
Reference in New Issue
Block a user