Merge pull request #255 from Kava-Labs/kd-validator-vesting

fix: vesting status
This commit is contained in:
Kevin Davis 2019-10-10 11:02:28 -04:00 committed by GitHub
commit e9f3b62fec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -209,12 +209,12 @@ func (k Keeper) GetPeriodEndTimes(ctx sdk.Context, addr sdk.AccAddress) []int64
func (k Keeper) AccountIsVesting(ctx sdk.Context, addr sdk.AccAddress) bool {
vv := k.GetAccountFromAuthKeeper(ctx, addr)
if !vv.DebtAfterFailedVesting.IsZero() {
return false
return true
}
for _, p := range vv.VestingPeriodProgress {
if !p.PeriodComplete {
return false
}
}
return true
}
}
return false
}

View File

@ -111,13 +111,13 @@ func TestAccountIsVesting(t *testing.T) {
ak.SetAccount(ctx, vva)
keeper.SetValidatorVestingAccountKey(ctx, vva.Address)
require.Equal(t, false, keeper.AccountIsVesting(ctx, vva.Address))
require.Equal(t, true, keeper.AccountIsVesting(ctx, vva.Address))
for i := range vva.VestingPeriodProgress {
vva.VestingPeriodProgress[i] = types.VestingProgress{true, true}
ak.SetAccount(ctx, vva)
}
require.Equal(t, true, keeper.AccountIsVesting(ctx, vva.Address))
require.Equal(t, false, keeper.AccountIsVesting(ctx, vva.Address))
}