add helper to UpdateBondedValidatorsFull

This commit is contained in:
ValarDragon 2018-07-09 14:21:29 -07:00
parent 1433b61a92
commit 2a419a3192
2 changed files with 6 additions and 1 deletions

View File

@ -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)

View File

@ -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