Skip to content

Commit

Permalink
Change optimistic logic
Browse files Browse the repository at this point in the history
  • Loading branch information
potuz committed Feb 10, 2022
1 parent 4c34e5d commit 249b790
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions beacon-chain/blockchain/process_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ func (s *Service) onBlockBatch(ctx context.Context, blks []block.SignedBeaconBlo
return nil, nil, nil, err
}

optimistic[i] = true
// Non merge blocks are never optimistic
optimistic[i] = false
if preState.Version() == version.Bellatrix {
executionEnabled, err := blocks.ExecutionEnabled(preState, b.Block().Body())
if err != nil {
Expand All @@ -432,9 +433,10 @@ func (s *Service) onBlockBatch(ctx context.Context, blks []block.SignedBeaconBlo
if !candidate {
return nil, nil, nil, errors.Wrap(err, "could not optimistically sync block")
}
optimistic[i] = true
break
case nil:
optimistic[i] = false
break
default:
return nil, nil, nil, errors.Wrap(err, "could not execute payload")
}
Expand Down Expand Up @@ -477,10 +479,7 @@ func (s *Service) onBlockBatch(ctx context.Context, blks []block.SignedBeaconBlo
FinalizedBlockHash: common.BytesToHash(finalizedBlockHash),
}
err = s.cfg.ExecutionEngineCaller.NotifyForkChoiceValidated(ctx, f)
switch err {
case nil, powchain.ErrSyncing:
break
default:
if err != nil && err != powchain.ErrSyncing {
return nil, nil, nil, err
}
}
Expand Down

0 comments on commit 249b790

Please sign in to comment.