From 23577ab7e0d6bdfaa630beefa52a6a111fdfd00a Mon Sep 17 00:00:00 2001 From: GnaD13 Date: Wed, 25 Oct 2023 12:48:44 +0700 Subject: [PATCH] correct iterator --- x/transfermiddleware/keeper/keeper.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x/transfermiddleware/keeper/keeper.go b/x/transfermiddleware/keeper/keeper.go index a154677d4..4b8828f78 100644 --- a/x/transfermiddleware/keeper/keeper.go +++ b/x/transfermiddleware/keeper/keeper.go @@ -4,6 +4,7 @@ import ( "time" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/store/prefix" "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" @@ -168,7 +169,8 @@ func (keeper Keeper) HasAllowRlyAddress(ctx sdk.Context, rlyAddress string) bool func (keeper Keeper) IterateAllowRlyAddress(ctx sdk.Context, cb func(rlyAddress string) (stop bool)) { store := ctx.KVStore(keeper.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.KeyRlyAddress) + prefixStore := prefix.NewStore(store, types.KeyRlyAddress) + iterator := sdk.KVStorePrefixIterator(prefixStore, nil) defer iterator.Close() for ; iterator.Valid(); iterator.Next() {