mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 04:54:05 -05:00
nil block check (#16006)
* nil block check * check err from OriginCheckpointBlockRoot * return error if block is not found * use block.IsNil()
This commit is contained in:
@@ -217,10 +217,17 @@ func (s *Service) fetchOriginSidecars(peers []peer.ID) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error fetching origin checkpoint blockroot")
|
||||
}
|
||||
|
||||
block, err := s.cfg.DB.Block(s.ctx, blockRoot)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "block")
|
||||
}
|
||||
if block.IsNil() {
|
||||
return errors.Errorf("origin block for root %#x not found in database", blockRoot)
|
||||
}
|
||||
|
||||
currentSlot, blockSlot := s.clock.CurrentSlot(), block.Block().Slot()
|
||||
currentEpoch, blockEpoch := slots.ToEpoch(currentSlot), slots.ToEpoch(blockSlot)
|
||||
|
||||
3
changelog/satushh-fetchoriginsidecars-bug.md
Normal file
3
changelog/satushh-fetchoriginsidecars-bug.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Fixed
|
||||
|
||||
- Nil check for block if it doesn't exist in the DB in fetchOriginSidecars
|
||||
Reference in New Issue
Block a user