Skip to content

Commit

Permalink
fix(prune): fix guard for sequencer (#966)
Browse files Browse the repository at this point in the history
  • Loading branch information
danwt authored Jul 19, 2024
1 parent 41d6053 commit 9fa4109
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions block/pruning.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9fa4109

Please sign in to comment.