Skip to content

Commit 0eb6b48

Browse files
committed
nil safety for committer
1 parent 43f676e commit 0eb6b48

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/orchestrator/committer.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,13 @@ func (c *Committer) getBlockNumbersToCommit(ctx context.Context) ([]*big.Int, er
291291
}()
292292

293293
latestCommittedBlockNumber, err := c.storage.MainStorage.GetMaxBlockNumber(c.rpc.GetChainID())
294-
log.Debug().Msgf("Committer found this max block number in main storage: %s", latestCommittedBlockNumber.String())
295294
if err != nil {
296295
return nil, err
297296
}
297+
if latestCommittedBlockNumber == nil {
298+
latestCommittedBlockNumber = new(big.Int).SetUint64(0)
299+
}
300+
log.Debug().Msgf("Committer found this max block number in main storage: %s", latestCommittedBlockNumber.String())
298301

299302
if latestCommittedBlockNumber.Sign() == 0 {
300303
// If no blocks have been committed yet, start from the fromBlock specified in the config

0 commit comments

Comments
 (0)