Simplify fcu 2 (#13400)

* change getPayloadAttribute signature

* Unify different FCU arguments
This commit is contained in:
Potuz
2024-01-02 19:45:55 -03:00
committed by GitHub
parent 886d76fe7c
commit 8c1e180dd1
6 changed files with 101 additions and 87 deletions

View File

@@ -342,10 +342,10 @@ func (s *Service) onBlockBatch(ctx context.Context, blks []consensusblocks.ROBlo
return errors.Wrap(err, "could not set optimistic block to valid")
}
}
arg := &notifyForkchoiceUpdateArg{
arg := &fcuConfig{
headState: preState,
headRoot: lastBR,
headBlock: lastB.Block(),
headBlock: lastB,
}
if _, err := s.notifyForkchoiceUpdate(ctx, arg); err != nil {
return err
@@ -711,12 +711,12 @@ func (s *Service) lateBlockTasks(ctx context.Context) {
}
s.headLock.RUnlock()
s.cfg.ForkChoiceStore.RLock()
fcuArgs := &notifyForkchoiceUpdateArg{
fcuArgs := &fcuConfig{
headState: headState,
headRoot: headRoot,
headBlock: headBlock.Block(),
headBlock: headBlock,
}
_, fcuArgs.attributes = s.getPayloadAttribute(ctx, headState, s.CurrentSlot()+1, headRoot[:])
fcuArgs.attributes = s.getPayloadAttribute(ctx, headState, s.CurrentSlot()+1, headRoot[:])
_, err = s.notifyForkchoiceUpdate(ctx, fcuArgs)
s.cfg.ForkChoiceStore.RUnlock()
if err != nil {