Lock forkchoice on late block tasks (#12978)

Co-authored-by: Nishant Das <nishdas93@gmail.com>
This commit is contained in:
Potuz 2023-10-02 14:07:03 -03:00 committed by GitHub
parent 70380660b3
commit 56f3dafb54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -649,11 +649,13 @@ func (s *Service) lateBlockTasks(ctx context.Context) {
return return
} }
s.headLock.RUnlock() s.headLock.RUnlock()
s.cfg.ForkChoiceStore.RLock()
_, err = s.notifyForkchoiceUpdate(ctx, &notifyForkchoiceUpdateArg{ _, err = s.notifyForkchoiceUpdate(ctx, &notifyForkchoiceUpdateArg{
headState: headState, headState: headState,
headRoot: headRoot, headRoot: headRoot,
headBlock: headBlock.Block(), headBlock: headBlock.Block(),
}) })
s.cfg.ForkChoiceStore.RUnlock()
if err != nil { if err != nil {
log.WithError(err).Debug("could not perform late block tasks: failed to update forkchoice with engine") log.WithError(err).Debug("could not perform late block tasks: failed to update forkchoice with engine")
} }