Fallback in Update Head On Error (#12199)

* return if head call fails

* potuz's feedback

* potuz's feedback
This commit is contained in:
Nishant Das
2023-03-28 23:06:44 +08:00
committed by GitHub
parent 83ccb15e66
commit 5cbbd26df4

View File

@@ -133,6 +133,10 @@ func (s *Service) UpdateHead(ctx context.Context, proposingSlot primitives.Slot)
newHeadRoot, err := s.cfg.ForkChoiceStore.Head(ctx)
if err != nil {
log.WithError(err).Error("Could not compute head from new attestations")
// Fallback to our current head root in the event of a failure.
s.headLock.RLock()
newHeadRoot = s.headRoot()
s.headLock.RUnlock()
}
newAttHeadElapsedTime.Observe(float64(time.Since(start).Milliseconds()))