Data Race on the background FCU call (#13602)

This commit is contained in:
Potuz 2024-02-13 13:22:53 -03:00 committed by GitHub
parent 3d13c69ef3
commit 8a89173937
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -73,6 +73,8 @@ func (s *Service) sendFCUWithAttributes(cfg *postBlockProcessConfig, fcuArgs *fc
slotCtx, cancel := context.WithTimeout(context.Background(), slotDeadline) slotCtx, cancel := context.WithTimeout(context.Background(), slotDeadline)
defer cancel() defer cancel()
cfg.ctx = slotCtx cfg.ctx = slotCtx
s.cfg.ForkChoiceStore.RLock()
defer s.cfg.ForkChoiceStore.RUnlock()
if err := s.computePayloadAttributes(cfg, fcuArgs); err != nil { if err := s.computePayloadAttributes(cfg, fcuArgs); err != nil {
log.WithError(err).Error("could not compute payload attributes") log.WithError(err).Error("could not compute payload attributes")
return return
@ -80,8 +82,6 @@ func (s *Service) sendFCUWithAttributes(cfg *postBlockProcessConfig, fcuArgs *fc
if fcuArgs.attributes.IsEmpty() { if fcuArgs.attributes.IsEmpty() {
return return
} }
s.cfg.ForkChoiceStore.RLock()
defer s.cfg.ForkChoiceStore.RUnlock()
if _, err := s.notifyForkchoiceUpdate(cfg.ctx, fcuArgs); err != nil { if _, err := s.notifyForkchoiceUpdate(cfg.ctx, fcuArgs); err != nil {
log.WithError(err).Error("could not update forkchoice with payload attributes for proposal") log.WithError(err).Error("could not update forkchoice with payload attributes for proposal")
} }