Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions internal/orchestrator/committer.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (c *Committer) getBlockNumbersToCommit(ctx context.Context) ([]*big.Int, er
}()

latestCommittedBlockNumber, err := c.storage.MainStorage.GetMaxBlockNumber(c.rpc.GetChainID())
log.Info().Msgf("Committer found this max block number in main storage: %s", latestCommittedBlockNumber.String())
log.Debug().Msgf("Committer found this max block number in main storage: %s", latestCommittedBlockNumber.String())
if err != nil {
return nil, err
}
Expand All @@ -135,9 +135,12 @@ func (c *Committer) getBlockNumbersToCommit(ctx context.Context) ([]*big.Int, er
}

blockCount := new(big.Int).Sub(endBlock, startBlock).Int64() + 1
if blockCount < 1 {
if blockCount < 0 {
return []*big.Int{}, fmt.Errorf("more blocks have been committed than the RPC has available - possible chain reset")
}
if blockCount == 0 {
return []*big.Int{}, nil
}
blockNumbers := make([]*big.Int, blockCount)
for i := int64(0); i < blockCount; i++ {
blockNumber := new(big.Int).Add(startBlock, big.NewInt(i))
Expand Down