Skip to content

Commit

Permalink
Merge pull request #79 from agoric-labs/zaki/vesting_account_bug_fix
Browse files Browse the repository at this point in the history
fix failure to persist vesting account
  • Loading branch information
zmanian authored Jul 16, 2021
2 parents bd904b0 + a60e664 commit 18b8870
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion x/auth/vesting/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,23 @@ func (s msgServer) CreatePeriodicVestingAccount(goCtx context.Context, msg *type

baseAccount := ak.NewAccountWithAddress(ctx, to)

types.NewPeriodicVestingAccount(baseAccount.(*authtypes.BaseAccount), totalCoins.Sort(), msg.StartTime, msg.VestingPeriods)
acc := types.NewPeriodicVestingAccount(baseAccount.(*authtypes.BaseAccount), totalCoins.Sort(), msg.StartTime, msg.VestingPeriods)

ak.SetAccount(ctx, acc)

defer func() {
telemetry.IncrCounter(1, "new", "account")

for _, a := range totalCoins {
if a.Amount.IsInt64() {
telemetry.SetGaugeWithLabels(
[]string{"tx", "msg", "create_periodic_vesting_account"},
float32(a.Amount.Int64()),
[]metrics.Label{telemetry.NewLabel("denom", a.Denom)},
)
}
}
}()

err = bk.SendCoins(ctx, from, to, totalCoins)
if err != nil {
Expand Down

0 comments on commit 18b8870

Please sign in to comment.