Skip to content

Commit

Permalink
fix(headertest): sanity check range (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
renaynay authored Mar 15, 2024
1 parent b9fa9aa commit bdda26a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions headertest/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,11 @@ func (m *Store[H]) GetRangeByHeight(ctx context.Context, fromHead H, to uint64)
}

func (m *Store[H]) getRangeByHeight(ctx context.Context, from, to uint64) ([]H, error) {
amount := to - from
if amount == 0 {
return nil, fmt.Errorf("no headers requested")
if to <= from {
return nil, fmt.Errorf("malformed range, from: %d, to: %d", from, to)
}

headers := make([]H, amount)
headers := make([]H, to-from)

// As the requested range is [from; to),
// check that (to-1) height in request is less than
Expand Down

0 comments on commit bdda26a

Please sign in to comment.