Skip to content

Commit

Permalink
Node/EVM: Batch poller publish initial blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-riley committed Sep 6, 2024
1 parent ff9c4b1 commit a229995
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions node/pkg/watchers/evm/connectors/batch_poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ func (b *BatchPollConnector) SubscribeForBlocks(ctx context.Context, errC chan e

errCount := 0

// Publish the initial finalized and safe blocks so we have a starting point for reobservation requests.
for idx, block := range lastBlocks {
b.logger.Info(fmt.Sprintf("publishing initial %s block", b.batchData[idx].finality), zap.Uint64("initial_block", block.Number.Uint64()))
sink <- block
if b.generateSafe && b.batchData[idx].finality == Finalized {
safe := block.Copy(Safe)
b.logger.Info("publishing generated initial safe block", zap.Uint64("initial_block", safe.Number.Uint64()))
sink <- safe
}
}

common.RunWithScissors(ctx, errC, "block_poll_subscribe_for_blocks", func(ctx context.Context) error {
timer := time.NewTimer(b.Delay)
defer timer.Stop()
Expand Down

0 comments on commit a229995

Please sign in to comment.