Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
reductionista committed Apr 10, 2024
1 parent f102397 commit d7d0169
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/chains/evm/logpoller/log_poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ func (lp *logPoller) BackupPollAndSaveLogs(ctx context.Context) {
return
}
// If this is our first run, start from block min(lastProcessed.FinalizedBlockNumber-1, lastProcessed.BlockNumber-backupPollerBlockDelay)
backupStartBlock := mathutil.Min(lastProcessed.FinalizedBlockNumber-1, lastProcessed.BlockNumber-lp.backupPollerBlockDelay)
backupStartBlock := mathutil.Min(lastProcessed.FinalizedBlockNumber, lastProcessed.BlockNumber-lp.backupPollerBlockDelay)
// (or at block 0 if whole blockchain is too short)
lp.backupPollerNextBlock = mathutil.Max(backupStartBlock, 0)
}
Expand Down
6 changes: 3 additions & 3 deletions core/chains/evm/logpoller/log_poller_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func TestLogPoller_BackupPollerStartup(t *testing.T) {
BackfillBatchSize: 3,
RpcBatchSize: 2,
KeepFinalizedBlocksDepth: 1000,
BackupPollerBlockDelay: 3,
BackupPollerBlockDelay: 0,
}
lp := NewLogPoller(orm, ec, lggr, lpOpts)
lp.BackupPollAndSaveLogs(ctx)
Expand Down Expand Up @@ -299,15 +299,14 @@ func TestLogPoller_Replay(t *testing.T) {
ec.On("HeadByNumber", mock.Anything, mock.Anything).Return(&head, nil)
ec.On("FilterLogs", mock.Anything, mock.Anything).Return([]types.Log{log1}, nil).Twice()
ec.On("ConfiguredChainID").Return(chainID, nil)
mockBatchCallContext(t, ec)

lpOpts := Opts{
PollPeriod: time.Hour,
FinalityDepth: 3,
BackfillBatchSize: 3,
RpcBatchSize: 3,
KeepFinalizedBlocksDepth: 20,
BackupPollerBlockDelay: 100,
BackupPollerBlockDelay: 0,
}
lp := NewLogPoller(orm, ec, lggr, lpOpts)

Expand Down Expand Up @@ -337,6 +336,7 @@ func TestLogPoller_Replay(t *testing.T) {

// Replay() should return error code received from replayComplete
t.Run("returns error code on replay complete", func(t *testing.T) {
mockBatchCallContext(t, ec)
anyErr := pkgerrors.New("any error")
done := make(chan struct{})
go func() {
Expand Down

0 comments on commit d7d0169

Please sign in to comment.