mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 19:40:37 +00:00
Sync: don't process pending blocks w/o genesis time (#10750)
* Sync: don't process pending blocks w/o genesis time * Update pending_blocks_queue.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
parent
7f443e8387
commit
a58809597e
@ -36,6 +36,10 @@ func (s *Service) processPendingBlocksQueue() {
|
||||
// Prevents multiple queue processing goroutines (invoked by RunEvery) from contending for data.
|
||||
locker := new(sync.Mutex)
|
||||
async.RunEvery(s.ctx, processPendingBlocksPeriod, func() {
|
||||
// Don't process the pending blocks if genesis time has not been set. The chain is not ready.
|
||||
if !s.isGenesisTimeSet() {
|
||||
return
|
||||
}
|
||||
locker.Lock()
|
||||
if err := s.processPendingBlocks(s.ctx); err != nil {
|
||||
log.WithError(err).Debug("Could not process pending blocks")
|
||||
@ -410,6 +414,12 @@ func (s *Service) addPendingBlockToCache(b interfaces.SignedBeaconBlock) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Returns true if the genesis time has been set in chain service.
|
||||
// Without the genesis time, the chain does not start.
|
||||
func (s *Service) isGenesisTimeSet() bool {
|
||||
return s.cfg.chain.GenesisTime().Unix() != 0
|
||||
}
|
||||
|
||||
// This converts input string to slot.
|
||||
func cacheKeyToSlot(s string) types.Slot {
|
||||
b := []byte(s)
|
||||
|
Loading…
Reference in New Issue
Block a user