Skip to content

Commit 3834cfd

Browse files
committed
assert error
1 parent 401b5d0 commit 3834cfd

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

block/internal/cache/generic_cache.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ package cache
33
import (
44
"context"
55
"encoding/binary"
6+
"errors"
67
"fmt"
78
"sync"
89
"sync/atomic"
910

1011
lru "github.com/hashicorp/golang-lru/v2"
12+
ds "github.com/ipfs/go-datastore"
1113

1214
"github.com/evstack/ev-node/pkg/store"
1315
)
@@ -266,7 +268,10 @@ func (c *Cache[T]) RestoreFromStore(ctx context.Context) error {
266268

267269
buf, err := c.store.GetMetadata(ctx, c.snapshotKey())
268270
if err != nil {
269-
return nil //nolint:nilerr // key absent = nothing to restore
271+
if errors.Is(err, ds.ErrNotFound) {
272+
return nil // key absent = fresh node or pre-snapshot version, nothing to restore
273+
}
274+
return fmt.Errorf("reading cache snapshot from store: %w", err)
270275
}
271276

272277
for _, e := range decodeSnapshot(buf) {

0 commit comments

Comments
 (0)