diff --git a/block/validate.go b/block/validate.go index eaaea7bb3..7ac13332e 100644 --- a/block/validate.go +++ b/block/validate.go @@ -30,9 +30,9 @@ func (m *Manager) SettlementValidateLoop(ctx context.Context) error { return ctx.Err() case <-m.settlementValidationC: - m.logger.Info("validating state updates to target height", "targetHeight", m.LastSettlementHeight.Load()) + m.logger.Info("validating state updates to target height", "targetHeight", min(m.LastSettlementHeight.Load(), m.State.Height())) - for currH := m.SettlementValidator.NextValidationHeight(); currH <= m.LastSettlementHeight.Load(); currH = m.SettlementValidator.NextValidationHeight() { + for currH := m.SettlementValidator.NextValidationHeight(); currH <= min(m.LastSettlementHeight.Load(), m.State.Height()); currH = m.SettlementValidator.NextValidationHeight() { // get next batch that needs to be validated from SL batch, err := m.SLClient.GetBatchAtHeight(currH)