Skip to content

Commit

Permalink
Merge pull request #485 from binance-chain/partialcancel
Browse files Browse the repository at this point in the history
Partial cancel caused an error log when calc fee
  • Loading branch information
rickyyangz authored Mar 9, 2019
2 parents 831c69e + 7b0e6f9 commit 97282fe
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions plugins/dex/order/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,13 @@ func handleCancelOrder(
if sdkError != nil {
return sdkError.Result()
}
acc := keeper.am.GetAccount(ctx, msg.Sender)
fee := keeper.FeeManager.CalcFixedFee(acc.GetCoins(), transfer.eventType, transfer.inAsset, keeper.engines)
acc.SetCoins(acc.GetCoins().Minus(fee.Tokens))
keeper.am.SetAccount(ctx, acc)
fee := common.Fee{}
if !transfer.FeeFree() {
acc := keeper.am.GetAccount(ctx, msg.Sender)
fee = keeper.FeeManager.CalcFixedFee(acc.GetCoins(), transfer.eventType, transfer.inAsset, keeper.engines)
acc.SetCoins(acc.GetCoins().Minus(fee.Tokens))
keeper.am.SetAccount(ctx, acc)
}

// this is done in memory! we must not run this block in checktx or simulate!
if ctx.IsDeliverTx() {
Expand Down

0 comments on commit 97282fe

Please sign in to comment.