File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 11package keeper
22
33import (
4+ "sort"
45 "strings"
56
67 math "cosmossdk.io/math"
@@ -72,7 +73,14 @@ func (k *FractionalBanker) GetAllFractionalBalances(ctx sdk.Context) (types.Prec
7273
7374func (k * FractionalBanker ) SetFractionalBalance (ctx sdk.Context , address sdk.AccAddress , balances BalanceMap ) {
7475 store := prefix .NewStore (ctx .KVStore (k .storeKey ), types .KeyPrefix (types .FractionalBalanceKeyPrefix ))
75- for denom , amount := range balances {
76+ sortedBalances := make ([]string , 0 , len (balances ))
77+ for denom := range balances {
78+ sortedBalances = append (sortedBalances , denom )
79+ }
80+ sort .Strings (sortedBalances )
81+
82+ for _ , denom := range sortedBalances {
83+ amount := balances [denom ]
7684 if amount .IsPositive () {
7785 bz , err := amount .Marshal ()
7886 // Marshal will NEVER actually return an error unless there are downstream code changes
You can’t perform that action at this time.
0 commit comments