Exit Pending Queue Properly (#7927)

* exit properly

* terence's review

* Update beacon-chain/sync/pending_blocks_queue.go

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>

* Update beacon-chain/sync/pending_blocks_queue.go

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>

* fix tests

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
This commit is contained in:
Nishant Das
2020-11-24 03:34:40 +08:00
committed by GitHub
parent b0dfc46603
commit 6f766ed583
2 changed files with 22 additions and 4 deletions

View File

@@ -134,12 +134,20 @@ func (s *Service) processPendingBlocks(ctx context.Context) error {
log.Debugf("Could not validate block from slot %d: %v", b.Block.Slot, err)
s.setBadBlock(ctx, blkRoot)
traceutil.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
}
if err := s.chain.ReceiveBlock(ctx, b, blkRoot); err != nil {
log.Debugf("Could not process block from slot %d: %v", b.Block.Slot, err)
s.setBadBlock(ctx, blkRoot)
traceutil.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
}
s.setSeenBlockIndexSlot(b.Block.Slot, b.Block.ProposerIndex)