Skip to content

Commit c34c25d

Browse files
authored
fix(headertest): Return err not found in header store if not found (#148)
1 parent 446648d commit c34c25d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

headertest/store.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ func (m *Store[H]) Get(ctx context.Context, hash header.Hash) (H, error) {
6262
}
6363

6464
func (m *Store[H]) GetByHeight(ctx context.Context, height uint64) (H, error) {
65-
return m.Headers[height], nil
65+
if header, exists := m.Headers[height]; exists {
66+
return header, nil
67+
}
68+
var zero H
69+
return zero, header.ErrNotFound
6670
}
6771

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

0 commit comments

Comments
 (0)