Skip to content

Commit

Permalink
comment update
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Mar 19, 2024
1 parent fbf64e6 commit e60b723
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions x/slashing/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,15 @@ func (k Keeper) DeleteDeprecatedValidatorMissedBlockBitArray(ctx sdk.Context, it
return
}

// Iterate over all the validator signing infos and delete the deprecated missed block bit arrays
valSignInfoIter := sdk.KVStorePrefixIterator(store, types.ValidatorSigningInfoKeyPrefix)
defer valSignInfoIter.Close()

iterationCounter := 0
for ; valSignInfoIter.Valid(); valSignInfoIter.Next() {
address := types.ValidatorSigningInfoAddress(valSignInfoIter.Key())

// created anonymous function to scope defer statement
// Creat anonymous function to scope defer statement
func() {
iter := storetypes.KVStorePrefixIterator(store, v4.DeprecatedValidatorMissedBlockBitArrayPrefixKey(address))
defer iter.Close()
Expand All @@ -151,7 +152,7 @@ func (k Keeper) DeleteDeprecatedValidatorMissedBlockBitArray(ctx sdk.Context, it

ctx.Logger().Info("Deleted deprecated missed block bit arrays", "count", iterationCounter)

// if we have deleted all the deprecated missed block bit arrays, we can delete the pruning key (setting to nil)
// If we have deleted all the deprecated missed block bit arrays, we can delete the pruning key (set to nil)
if iterationCounter == 0 {
store.Delete(types.IsPruningKey)
}
Expand Down

0 comments on commit e60b723

Please sign in to comment.