Skip to content

Commit

Permalink
chore: refactor delete logic not to touch iteration-related things wh…
Browse files Browse the repository at this point in the history
…ile iteration
  • Loading branch information
jaeseung-bae committed Mar 26, 2024
1 parent 4838021 commit e8987d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ replace (
github.com/Finschia/finschia-sdk/api => ../api
// We always want to test against the latest version of the simapp.
github.com/Finschia/finschia-sdk/simapp => ../simapp

// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1
Expand Down
6 changes: 5 additions & 1 deletion x/bankplus/deprecator.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ func DeprecateBankPlus(ctx context.Context, bankStoreService store.KVStoreServic
iter := storetypes.KVStorePrefixIterator(adapter, inactiveAddrsKeyPrefix)
defer iter.Close()

keys := [][]byte{}
for ; iter.Valid(); iter.Next() {
err := kvStore.Delete(iter.Key())
keys = append(keys, iter.Key())
}
for _, key := range keys {
err := kvStore.Delete(key)
if err != nil {
return err
}
Expand Down

0 comments on commit e8987d4

Please sign in to comment.