Skip to content

Commit

Permalink
Merge pull request #23 from terra-money/revert-19-feature/exclude-val…
Browse files Browse the repository at this point in the history
…idator-account-from-gensis-staking

Revert "exclude validator addresses from being genesis staking"
  • Loading branch information
yun-yeo authored May 26, 2022
2 parents 8c8a215 + 5363311 commit 80878b5
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -842,17 +842,13 @@ func (app *TerraApp) enforceStakingForVestingTokens(ctx sdk.Context, genesisStat

allValidators := app.StakingKeeper.GetAllValidators(ctx)

// Filter out validators which have huge max commission than 20%
var validators []stakingtypes.Validator
validatorAccAddressMap := make(map[string]bool)
maxCommissionCondition := sdk.NewDecWithPrec(20, 2)
for _, val := range allValidators {

// Filter out validators which have huge max commission than 20%
if val.Commission.CommissionRates.MaxRate.LTE(maxCommissionCondition) {
validators = append(validators, val)
}

validatorAccAddressMap[sdk.AccAddress(val.GetOperator()).String()] = true
}

validatorLen := len(validators)
Expand All @@ -872,12 +868,6 @@ func (app *TerraApp) enforceStakingForVestingTokens(ctx sdk.Context, genesisStat
}

if vestingAcc, ok := account.(vestingexported.VestingAccount); ok {

// skip genesis staking if the vesting account is validator address
if _, ok := validatorAccAddressMap[vestingAcc.GetAddress().String()]; ok {
continue
}

amt := vestingAcc.GetOriginalVesting().AmountOf(app.StakingKeeper.BondDenom(ctx))

// to prevent staking multiple times over the same validator
Expand Down

0 comments on commit 80878b5

Please sign in to comment.