Skip to content

Commit

Permalink
retain height
Browse files Browse the repository at this point in the history
  • Loading branch information
srene committed Oct 9, 2024
1 parent 54d729b commit e24d96f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions block/pruning.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (

// PruneBlocks prune all block related data from dymint store up to (but not including) retainHeight. It returns the number of blocks pruned, used for testing.
func (m *Manager) PruneBlocks(retainHeight uint64) (uint64, error) {
nextSubmissionHeight := m.NextHeightToSubmit()
if m.IsProposer() && nextSubmissionHeight < retainHeight { // do not delete anything that we might submit in future
m.logger.Debug("cannot prune blocks before they have been submitted. using last submitted height for pruning", "retain_height", retainHeight, "height_to_submit", m.NextHeightToSubmit())
retainHeight = nextSubmissionHeight
if m.IsProposer() { // do not delete anything that we might submit in future
retainHeight = max(m.NextHeightToSubmit(), retainHeight)
} else { // do not delete anything that is not validated yet
retainHeight = max(m.State.NextValidationHeight(), retainHeight)
}

// prune blocks from blocksync store
Expand Down

0 comments on commit e24d96f

Please sign in to comment.