Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2649 from bandprotocol/update-export
Browse files Browse the repository at this point in the history
chain: add commission check before withdrawing commission when export
  • Loading branch information
taobun committed Sep 17, 2020
1 parent 2476e07 commit 99ee780
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chain/app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ func (app *bandApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []st

// withdraw all validator commission
app.StakingKeeper.IterateValidators(ctx, func(_ int64, val staking.ValidatorI) (stop bool) {
accumCommission := app.DistrKeeper.GetValidatorAccumulatedCommission(ctx, val.GetOperator())
if accumCommission.IsZero() {
return false
}
_, err := app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator())
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit 99ee780

Please sign in to comment.