@@ -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.
173173func (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
0 commit comments