Skip to content

Commit aa847fc

Browse files
committed
lint
1 parent 0a441d3 commit aa847fc

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

block/internal/cache/generic_cache.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,14 @@ func (c *Cache[T]) setDAIncluded(hash string, daHeight uint64, blockHeight uint6
165165
c.daIncluded.Add(hash, daHeight)
166166
c.hashByHeight.Add(blockHeight, hash)
167167
c.setMaxDAHeight(daHeight)
168-
c.persistSnapshot()
168+
c.persistSnapshot(context.Background())
169169
}
170170

171171
// removeDAIncluded removes the DA-included status of the hash from the cache
172172
// and rewrites the window snapshot.
173173
func (c *Cache[T]) removeDAIncluded(hash string) {
174174
c.daIncluded.Remove(hash)
175-
c.persistSnapshot()
175+
c.persistSnapshot(context.Background())
176176
}
177177

178178
// daHeight returns the maximum DA height from all DA-included items.
@@ -217,7 +217,7 @@ func (c *Cache[T]) deleteAllForHeight(height uint64) {
217217
c.daIncluded.Remove(hash)
218218
}
219219

220-
c.persistSnapshot()
220+
c.persistSnapshot(context.Background())
221221
}
222222

223223
// persistSnapshot serialises all current daIncluded entries into a compact
@@ -234,7 +234,7 @@ func (c *Cache[T]) deleteAllForHeight(height uint64) {
234234
// This write happens on every mutation so the store always reflects the exact
235235
// current in-flight window. The payload is small (typically < 10 entries ×
236236
// 16 bytes = 160 bytes), so the cost is negligible.
237-
func (c *Cache[T]) persistSnapshot() {
237+
func (c *Cache[T]) persistSnapshot(ctx context.Context) {
238238
if c.store == nil || c.storeKeyPrefix == "" {
239239
return
240240
}
@@ -255,7 +255,7 @@ func (c *Cache[T]) persistSnapshot() {
255255
}
256256

257257
buf := encodeSnapshot(entries)
258-
_ = c.store.SetMetadata(context.Background(), c.snapshotKey(), buf)
258+
_ = c.store.SetMetadata(ctx, c.snapshotKey(), buf)
259259
}
260260

261261
// encodeSnapshot serialises a slice of snapshotEntry values into a byte slice.
@@ -306,7 +306,7 @@ func (c *Cache[T]) RestoreFromStore(ctx context.Context) error {
306306
buf, err := c.store.GetMetadata(ctx, c.snapshotKey())
307307
if err != nil {
308308
// Key absent — nothing to restore (new node or pre-snapshot version).
309-
return nil
309+
return nil //nolint:nilerr // ok to ignore
310310
}
311311

312312
entries := decodeSnapshot(buf)
@@ -352,7 +352,7 @@ func (c *Cache[T]) SaveToStore(ctx context.Context) error {
352352
if c.store == nil {
353353
return nil
354354
}
355-
c.persistSnapshot()
355+
c.persistSnapshot(ctx)
356356
return nil
357357
}
358358

block/internal/cache/manager_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212

1313
"github.com/evstack/ev-node/block/internal/common"
1414
"github.com/evstack/ev-node/pkg/config"
15-
"github.com/evstack/ev-node/pkg/store"
1615
pkgstore "github.com/evstack/ev-node/pkg/store"
1716
"github.com/evstack/ev-node/types"
1817
)
@@ -25,10 +24,10 @@ func tempConfig(t *testing.T) config.Config {
2524
}
2625

2726
// helper to make an in-memory store
28-
func memStore(t *testing.T) store.Store {
29-
ds, err := store.NewTestInMemoryKVStore()
27+
func memStore(t *testing.T) pkgstore.Store {
28+
ds, err := pkgstore.NewTestInMemoryKVStore()
3029
require.NoError(t, err)
31-
return store.New(ds)
30+
return pkgstore.New(ds)
3231
}
3332

3433
func TestManager_HeaderDataOperations(t *testing.T) {

0 commit comments

Comments
 (0)