address cwgoes comments

This commit is contained in:
rigelrozanski 2018-07-06 20:29:39 -04:00
parent f08f02d67d
commit d36dda0267
2 changed files with 9 additions and 6 deletions

View File

@ -303,7 +303,7 @@ func (k Keeper) UpdateBondedValidators(ctx sdk.Context,
// TODO benchmark if we should read the current power and not write if it's the same
if bondedValidatorsCount == int(maxValidators) { // is cliff validator
k.setCliffValidator(ctx, validator, k.GetPool(ctx))
} else {
} else if len(oldCliffValidatorAddr) > 0 {
k.clearCliffValidator(ctx)
}
break
@ -409,10 +409,14 @@ func (k Keeper) UpdateBondedValidatorsFull(ctx sdk.Context) {
validator = k.bondValidator(ctx, validator)
}
if validator.Revoked && validator.Status() == sdk.Bonded {
panic(fmt.Sprintf("revoked validator cannot be bonded, address: %v\n", ownerAddr))
if !validator.Revoked {
bondedValidatorsCount++
} else {
if validator.Status() == sdk.Bonded {
panic(fmt.Sprintf("revoked validator cannot be bonded, address: %v\n", ownerAddr))
}
}
bondedValidatorsCount++
iterator.Next()
}
iterator.Close()

View File

@ -634,8 +634,7 @@ func TestGetTendermintUpdatesInserted(t *testing.T) {
require.Equal(t, validators[4].ABCIValidator(), updates[0])
}
//TODO why is this called NotValidatorCliff?
func TestGetTendermintUpdatesNotValidatorCliff(t *testing.T) {
func TestGetTendermintUpdatesWithCliffValidator(t *testing.T) {
ctx, _, keeper := CreateTestInput(t, false, 1000)
params := types.DefaultParams()
params.MaxValidators = 2