mirror of
				https://github.com/0glabs/0g-chain.git
				synced 2025-10-31 23:17:27 +00:00 
			
		
		
		
	fix: get vesting status return values
This commit is contained in:
		
							parent
							
								
									e05ea73da0
								
							
						
					
					
						commit
						37bd179c8e
					
				| @ -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 { | func (k Keeper) AccountIsVesting(ctx sdk.Context, addr sdk.AccAddress) bool { | ||||||
| 	vv := k.GetAccountFromAuthKeeper(ctx, addr) | 	vv := k.GetAccountFromAuthKeeper(ctx, addr) | ||||||
| 	if !vv.DebtAfterFailedVesting.IsZero() { | 	if !vv.DebtAfterFailedVesting.IsZero() { | ||||||
| 		return false | 		return true | ||||||
| 	} | 	} | ||||||
| 	for _, p := range vv.VestingPeriodProgress { | 	for _, p := range vv.VestingPeriodProgress { | ||||||
| 		if !p.PeriodComplete { | 		if !p.PeriodComplete { | ||||||
| 			return false |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 			return true | 			return true | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
|  | 	return false | ||||||
|  | } | ||||||
|  | |||||||
| @ -111,13 +111,13 @@ func TestAccountIsVesting(t *testing.T) { | |||||||
| 	ak.SetAccount(ctx, vva) | 	ak.SetAccount(ctx, vva) | ||||||
| 	keeper.SetValidatorVestingAccountKey(ctx, vva.Address) | 	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 { | 	for i := range vva.VestingPeriodProgress { | ||||||
| 		vva.VestingPeriodProgress[i] = types.VestingProgress{true, true} | 		vva.VestingPeriodProgress[i] = types.VestingProgress{true, true} | ||||||
| 		ak.SetAccount(ctx, vva) | 		ak.SetAccount(ctx, vva) | ||||||
| 	} | 	} | ||||||
| 	require.Equal(t, true, keeper.AccountIsVesting(ctx, vva.Address)) | 	require.Equal(t, false, keeper.AccountIsVesting(ctx, vva.Address)) | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Kevin Davis
						Kevin Davis