Skip to content

Commit

Permalink
fix(headertest): Return err not found in header store if not found (#148
Browse files Browse the repository at this point in the history
)
  • Loading branch information
renaynay authored Jan 25, 2024
1 parent 446648d commit c34c25d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion headertest/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ func (m *Store[H]) Get(ctx context.Context, hash header.Hash) (H, error) {
}

func (m *Store[H]) GetByHeight(ctx context.Context, height uint64) (H, error) {
return m.Headers[height], nil
if header, exists := m.Headers[height]; exists {
return header, nil
}
var zero H
return zero, header.ErrNotFound
}

func (m *Store[H]) GetRange(ctx context.Context, from, to uint64) ([]H, error) {
Expand Down

0 comments on commit c34c25d

Please sign in to comment.