Skip to content

Commit

Permalink
Revert "fix: add extra check in vesting (backport cosmos#15373) (cosm…
Browse files Browse the repository at this point in the history
…os#15383)"

This reverts commit f382e43.
  • Loading branch information
GAtom22 committed Mar 23, 2023
1 parent 153af67 commit e949ffd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
9 changes: 1 addition & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog

## [Unreleased]
* (simapp) [#15305](https://github.com/cosmos/cosmos-sdk/pull/15305) Add `AppStateFnWithExtendedCb` with callback function to extend rawState.

### Bug Fixes

* (x/auth/vesting) [#15383](https://github.com/cosmos/cosmos-sdk/pull/15383) Add extra checks when creating a periodic vesting account.

## [v0.46.11-ledger](https://github.com/evmos/cosmos-sdk/releases/tag/v0.46.11-ledger) - 2022-03-23
## [v0.46.11](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.11) - 2022-03-03

### Improvements

Expand Down
14 changes: 7 additions & 7 deletions x/auth/vesting/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCre
}
}()

if err = bk.SendCoins(ctx, from, to, msg.Amount); err != nil {
err = bk.SendCoins(ctx, from, to, msg.Amount)
if err != nil {
return nil, err
}

Expand Down Expand Up @@ -139,7 +140,8 @@ func (s msgServer) CreatePermanentLockedAccount(goCtx context.Context, msg *type
}
}()

if err = bk.SendCoins(ctx, from, to, msg.Amount); err != nil {
err = bk.SendCoins(ctx, from, to, msg.Amount)
if err != nil {
return nil, err
}

Expand Down Expand Up @@ -173,14 +175,11 @@ func (s msgServer) CreatePeriodicVestingAccount(goCtx context.Context, msg *type
}

var totalCoins sdk.Coins

for _, period := range msg.VestingPeriods {
totalCoins = totalCoins.Add(period.Amount...)
}

if err := bk.IsSendEnabledCoins(ctx, totalCoins...); err != nil {
return nil, err
}

baseAccount := authtypes.NewBaseAccountWithAddress(to)
baseAccount = ak.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
vestingAccount := types.NewPeriodicVestingAccount(baseAccount, totalCoins.Sort(), msg.StartTime, msg.VestingPeriods)
Expand All @@ -201,7 +200,8 @@ func (s msgServer) CreatePeriodicVestingAccount(goCtx context.Context, msg *type
}
}()

if err = bk.SendCoins(ctx, from, to, totalCoins); err != nil {
err = bk.SendCoins(ctx, from, to, totalCoins)
if err != nil {
return nil, err
}

Expand Down

0 comments on commit e949ffd

Please sign in to comment.