Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
potuz committed Mar 7, 2023
1 parent 91583ae commit 9753bc6
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions beacon-chain/blockchain/forkchoice_update_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,20 @@ func (s *Service) getStateAndBlock(ctx context.Context, r [32]byte) (state.Beaco
// fockchoiceUpdateWithExecution is a wrapper around notifyForkchoiceUpdate. It decides whether a new call to FCU should be made.
func (s *Service) forkchoiceUpdateWithExecution(ctx context.Context, newHeadRoot [32]byte, proposingSlot primitives.Slot) error {
isNewHead := s.isNewHead(newHeadRoot)
isNewProposer := s.isNewProposer(proposingSlot)
if !isNewHead && !isNewProposer {
if !isNewHead {
return nil
}

if isNewHead && isNewProposer && !features.Get().DisableReorgLateBlocks {
isNewProposer := s.isNewProposer(proposingSlot)
if isNewProposer && !features.Get().DisableReorgLateBlocks {
if proposingSlot == s.CurrentSlot() {
proposerHead := s.ForkChoicer().GetProposerHead()
if proposerHead != newHeadRoot {
isNewHead = false
return nil
}
} else if s.ForkChoicer().ShouldOverrideFCU() {
isNewHead = false
return nil
}
}
if !isNewHead {
return nil
}
headRoot := newHeadRoot
headState, headBlock, err := s.getStateAndBlock(ctx, newHeadRoot)
if err != nil {
log.WithError(err).Error("Could not get forkchoice update argument")
Expand All @@ -72,7 +67,7 @@ func (s *Service) forkchoiceUpdateWithExecution(ctx context.Context, newHeadRoot

_, err = s.notifyForkchoiceUpdate(ctx, &notifyForkchoiceUpdateArg{
headState: headState,
headRoot: headRoot,
headRoot: newHeadRoot,
headBlock: headBlock.Block(),
})
if err != nil {
Expand Down

0 comments on commit 9753bc6

Please sign in to comment.