From 9fa4109d1ca0a5acdc986c65e6f7a0f0edf3ea76 Mon Sep 17 00:00:00 2001 From: Daniel T <30197399+danwt@users.noreply.github.com> Date: Fri, 19 Jul 2024 11:41:30 +0100 Subject: [PATCH] fix(prune): fix guard for sequencer (#966) --- block/pruning.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/block/pruning.go b/block/pruning.go index f194e3585..521e61f38 100644 --- a/block/pruning.go +++ b/block/pruning.go @@ -7,8 +7,11 @@ import ( ) func (m *Manager) pruneBlocks(retainHeight uint64) error { - if m.IsSequencer() && retainHeight <= m.NextHeightToSubmit() { // do not delete anything that we might submit in future - return fmt.Errorf("cannot prune blocks before they have been submitted: %d: %w", retainHeight, gerrc.ErrInvalidArgument) + if m.IsSequencer() && m.NextHeightToSubmit() < retainHeight { // do not delete anything that we might submit in future + return fmt.Errorf("cannot prune blocks before they have been submitted: retain height %d: next height to submit: %d: %w", + retainHeight, + m.NextHeightToSubmit(), + gerrc.ErrInvalidArgument) } pruned, err := m.Store.PruneBlocks(m.State.BaseHeight, retainHeight)