Skip to content

Commit

Permalink
fix(store): Allow a range of 1 to be requested from the store
Browse files Browse the repository at this point in the history
  • Loading branch information
renaynay committed Oct 23, 2024
1 parent 58a2cc6 commit 3eab48c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,8 @@ func (s *Store[H]) GetRange(ctx context.Context, from, to uint64) ([]H, error) {
}

func (s *Store[H]) getRangeByHeight(ctx context.Context, from, to uint64) ([]H, error) {
// as the requested range is non-inclusive in the end[from;to), we need to compare
// `from` with `to-1`
if from > to-1 {
return nil, fmt.Errorf("header/store: invalid range(%d,%d)", from, to-1)
if from >= to {
return nil, fmt.Errorf("header/store: invalid range(%d,%d)", from, to)
}
h, err := s.GetByHeight(ctx, to-1)
if err != nil {
Expand Down

0 comments on commit 3eab48c

Please sign in to comment.