Skip to content

Commit 7277a18

Browse files
authored
fix(headertest): Store should fail if a range of 0 is requested (#147)
1 parent a5a9f28 commit 7277a18

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

headertest/store.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package headertest
33
import (
44
"bytes"
55
"context"
6+
"fmt"
67
"testing"
78

89
"github.com/celestiaorg/go-header"
@@ -76,6 +77,10 @@ func (m *Store[H]) GetRangeByHeight(ctx context.Context, fromHead H, to uint64)
7677

7778
func (m *Store[H]) getRangeByHeight(ctx context.Context, from, to uint64) ([]H, error) {
7879
amount := to - from
80+
if amount == 0 {
81+
return nil, fmt.Errorf("no headers requested")
82+
}
83+
7984
headers := make([]H, amount)
8085

8186
// As the requested range is [from; to),

0 commit comments

Comments
 (0)