Skip to content

Commit

Permalink
node/watchers/evm: do not allow finalizer == nil (TOB-WORMGUWA-17)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbjump committed May 4, 2023
1 parent 8938c22 commit 271b815
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions node/pkg/watchers/evm/connectors/poller.go
Expand Up @@ -143,17 +143,15 @@ func (b *BlockPollConnector) pollBlocks(ctx context.Context, logger *zap.Logger,
return lastPublishedBlock, fmt.Errorf("failed to fetch next block (%d): %w", nextBlockNumber.Uint64(), err)
}

if b.finalizer != nil {
finalized, err := b.isBlockFinalizedWithTimeout(ctx, block)
if err != nil {
logger.Error("failed to check block finalization",
zap.Uint64("block", block.Number.Uint64()), zap.Error(err))
return lastPublishedBlock, fmt.Errorf("failed to check block finalization (%d): %w", block.Number.Uint64(), err)
}
finalized, err := b.isBlockFinalizedWithTimeout(ctx, block)
if err != nil {
logger.Error("failed to check block finalization",
zap.Uint64("block", block.Number.Uint64()), zap.Error(err))
return lastPublishedBlock, fmt.Errorf("failed to check block finalization (%d): %w", block.Number.Uint64(), err)
}

if !finalized {
break
}
if !finalized {
break
}

b.blockFeed.Send(block)
Expand Down

0 comments on commit 271b815

Please sign in to comment.