From 8a891739370f3de6049115e13c5c8da13e716b6f Mon Sep 17 00:00:00 2001 From: Potuz Date: Tue, 13 Feb 2024 13:22:53 -0300 Subject: [PATCH] Data Race on the background FCU call (#13602) --- beacon-chain/blockchain/forkchoice_update_execution.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beacon-chain/blockchain/forkchoice_update_execution.go b/beacon-chain/blockchain/forkchoice_update_execution.go index bb334dae2..fa91e4c1a 100644 --- a/beacon-chain/blockchain/forkchoice_update_execution.go +++ b/beacon-chain/blockchain/forkchoice_update_execution.go @@ -73,6 +73,8 @@ func (s *Service) sendFCUWithAttributes(cfg *postBlockProcessConfig, fcuArgs *fc slotCtx, cancel := context.WithTimeout(context.Background(), slotDeadline) defer cancel() cfg.ctx = slotCtx + s.cfg.ForkChoiceStore.RLock() + defer s.cfg.ForkChoiceStore.RUnlock() if err := s.computePayloadAttributes(cfg, fcuArgs); err != nil { log.WithError(err).Error("could not compute payload attributes") return @@ -80,8 +82,6 @@ func (s *Service) sendFCUWithAttributes(cfg *postBlockProcessConfig, fcuArgs *fc if fcuArgs.attributes.IsEmpty() { return } - s.cfg.ForkChoiceStore.RLock() - defer s.cfg.ForkChoiceStore.RUnlock() if _, err := s.notifyForkchoiceUpdate(cfg.ctx, fcuArgs); err != nil { log.WithError(err).Error("could not update forkchoice with payload attributes for proposal") }