From 6062b3af297968380f5d7ba276dcbe3cde04c296 Mon Sep 17 00:00:00 2001 From: Sergi Rene Date: Mon, 4 Nov 2024 12:36:17 +0100 Subject: [PATCH] fix(validation): set right validation height (#1187) --- block/validate.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)