From 2a419a3192e4b44cca4ed244d80d9f32d84f6705 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Mon, 9 Jul 2018 14:21:29 -0700 Subject: [PATCH] add helper to UpdateBondedValidatorsFull --- x/stake/keeper/inflation_test.go | 1 + x/stake/keeper/validator.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/x/stake/keeper/inflation_test.go b/x/stake/keeper/inflation_test.go index 2fee8154a0..28efc0c59b 100644 --- a/x/stake/keeper/inflation_test.go +++ b/x/stake/keeper/inflation_test.go @@ -342,6 +342,7 @@ func checkValidatorSetup(t *testing.T, pool types.Pool, initialTotalTokens, init } // Checks that The inflation will correctly increase or decrease after an update to the pool +// nolint: gocyclo func checkInflation(t *testing.T, pool types.Pool, previousInflation, updatedInflation sdk.Rat, msg string) { inflationChange := updatedInflation.Sub(previousInflation) diff --git a/x/stake/keeper/validator.go b/x/stake/keeper/validator.go index 233c7b6e87..e8713c04d5 100644 --- a/x/stake/keeper/validator.go +++ b/x/stake/keeper/validator.go @@ -422,6 +422,11 @@ func (k Keeper) UpdateBondedValidatorsFull(ctx sdk.Context) { iterator.Close() // perform the actual kicks + kickOutValidators(k, ctx, toKickOut) + return +} + +func kickOutValidators(k Keeper, ctx sdk.Context, toKickOut map[string]byte) { for key := range toKickOut { ownerAddr := []byte(key) validator, found := k.GetValidator(ctx, ownerAddr) @@ -430,7 +435,6 @@ func (k Keeper) UpdateBondedValidatorsFull(ctx sdk.Context) { } k.unbondValidator(ctx, validator) } - return } // perform all the store operations for when a validator status becomes unbonded