Skip to content

Commit edaa5db

Browse files
committed
minor refactor + gofumpt
1 parent 4f5b0ce commit edaa5db

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

x/staking/cache/cache.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func NewEntry[V ~[]E, E any](
4343
cacheType EntryType,
4444
) *Entry[V, E] {
4545
if storeService == nil {
46-
panic(fmt.Sprintf("store service should not be nil for cache type %s", cacheType))
46+
panic(fmt.Sprintf("storeService is nil for cache type %s", cacheType))
4747
}
4848
if loadFromStore == nil {
4949
panic(fmt.Sprintf("loadFromStore is nil for cache type %s", cacheType))
@@ -110,7 +110,6 @@ func (e *Entry[V, E]) setEntry(ctx context.Context, cdc codec.BinaryCodec, key s
110110
e.mu.Lock()
111111
defer e.mu.Unlock()
112112
return e.setEntryUnsafe(ctx, cdc, key, value)
113-
114113
}
115114

116115
// setEntryUnsafe works the same as setEntry but the caller is responsible for holding the lock
@@ -143,7 +142,6 @@ func (e *Entry[V, E]) setEntryUnsafe(ctx context.Context, cdc codec.BinaryCodec,
143142
}
144143

145144
return nil
146-
147145
}
148146

149147
func (e *Entry[V, E]) deleteEntry(ctx context.Context, key string) error {
@@ -175,7 +173,6 @@ func (e *Entry[V, E]) clearUnsafe(ctx context.Context) error {
175173
store := e.storeService.OpenMemoryStore(ctx)
176174
prefix := e.getPrefix()
177175
iter, err := store.Iterator(prefix, storetypes.PrefixEndBytes(prefix))
178-
179176
if err != nil {
180177
return err
181178
}
@@ -269,7 +266,7 @@ type ValidatorsQueueCache struct {
269266

270267
func NewValidatorsQueueCache(
271268
size uint,
272-
cacheStoreService corestoretypes.MemoryStoreService,
269+
memStoreService corestoretypes.MemoryStoreService,
273270
loadUnbondingValidators func(ctx context.Context) (map[string][]string, error),
274271
loadUnbondingDelegations func(ctx context.Context) (map[string][]types.DVPair, error),
275272
loadRedelegations func(ctx context.Context) (map[string][]types.DVVTriplet, error),
@@ -278,19 +275,19 @@ func NewValidatorsQueueCache(
278275
) *ValidatorsQueueCache {
279276
return NewCache(
280277
NewEntry(
281-
cacheStoreService,
278+
memStoreService,
282279
size,
283280
loadUnbondingValidators,
284281
UnbondingValidators,
285282
),
286283
NewEntry(
287-
cacheStoreService,
284+
memStoreService,
288285
size,
289286
loadUnbondingDelegations,
290287
UnbondingDelegations,
291288
),
292289
NewEntry(
293-
cacheStoreService,
290+
memStoreService,
294291
size,
295292
loadRedelegations,
296293
Redelegations,

0 commit comments

Comments
 (0)