Sync: process pending block with optimistic parent (#10480)

This commit is contained in:
terence tsao
2022-04-04 18:46:05 -07:00
committed by GitHub
parent 9b64c33bd1
commit 7d669f23ab
2 changed files with 83 additions and 3 deletions

View File

@@ -152,14 +152,16 @@ func (s *Service) processPendingBlocks(ctx context.Context) error {
continue
}
if err := s.validateBeaconBlock(ctx, b, blkRoot); err != nil {
err = s.validateBeaconBlock(ctx, b, blkRoot)
switch {
case errors.Is(ErrOptimisticParent, err): // Ok to continue process block with parent that is an optimistic candidate.
case err != nil:
log.Debugf("Could not validate block from slot %d: %v", b.Block().Slot(), err)
s.setBadBlock(ctx, blkRoot)
tracing.AnnotateError(span, err)
// In the next iteration of the queue, this block will be removed from
// the pending queue as it has been marked as a 'bad' block.
span.End()
continue
default:
}
if err := s.cfg.chain.ReceiveBlock(ctx, b, blkRoot); err != nil {