Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Sep 10, 2024
1 parent 3c0a903 commit b0584cd
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions x/accounts/defaults/lockup/lockup.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"maps"
"slices"
"time"

"github.com/cosmos/gogoproto/proto"
Expand Down Expand Up @@ -295,21 +296,21 @@ func (bva *BaseLockup) WithdrawUnlockedCoins(
return nil, err
}

hs := bva.headerService.HeaderInfo(ctx)
lockedCoins, err := getLockedCoinsFunc(ctx, hs.Time, msg.Denoms...)
if err != nil {
return nil, err
}

amount := sdk.Coins{}

// deduplicate the denoms
denoms := make(map[string]struct{})
for _, denom := range msg.Denoms {
denoms[denom] = struct{}{}
}
uniqueDenoms := slices.Collect(maps.Keys(denoms))

for denom := range maps.Keys(denoms) {
hs := bva.headerService.HeaderInfo(ctx)
lockedCoins, err := getLockedCoinsFunc(ctx, hs.Time, uniqueDenoms...)
if err != nil {
return nil, err
}

amount := sdk.Coins{}
for _, denom := range uniqueDenoms {
balance, err := bva.getBalance(ctx, fromAddress, denom)
if err != nil {
return nil, err
Expand Down

0 comments on commit b0584cd

Please sign in to comment.