Skip to content

Commit 0f2ad67

Browse files
committed
fix misleading error message
1 parent 627b36c commit 0f2ad67

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

internal/orchestrator/committer.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (c *Committer) getBlockNumbersToCommit(ctx context.Context) ([]*big.Int, er
113113
}()
114114

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

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

0 commit comments

Comments
 (0)