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:
satushh
2025-11-11 17:20:48 +00:00
committed by GitHub
parent 6735c921f8
commit eae15697da
2 changed files with 10 additions and 0 deletions

View File

@@ -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)

View File

@@ -0,0 +1,3 @@
### Fixed
- Nil check for block if it doesn't exist in the DB in fetchOriginSidecars