Skip to content

Commit

Permalink
Merge branch 'main' into chore/remove-ShareWithProof
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg authored Oct 28, 2024
2 parents 3d8687d + 097fcab commit d470aac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pruner/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ func (s *Service) findPruneableHeaders(
return nil, err
}

if lastPruned.Height() == estimatedCutoffHeight {
if lastPruned.Height() >= estimatedCutoffHeight {
// nothing left to prune
return nil, nil
}

log.Debugw("finder: fetching header range", "last pruned", lastPruned.Height(),
"target height", estimatedCutoffHeight)

headers, err := s.getter.GetRangeByHeight(ctx, lastPruned, estimatedCutoffHeight)
// GetRangeByHeight requests (from:to), where `to` is non-inclusive, we need
// to request one more header than the estimated cutoff
headers, err := s.getter.GetRangeByHeight(ctx, lastPruned, estimatedCutoffHeight+1)
if err != nil {
log.Errorw("failed to get range from header store", "from", lastPruned.Height(),
"to", estimatedCutoffHeight, "error", err)
Expand Down

0 comments on commit d470aac

Please sign in to comment.