diff --git a/testutil/vesting/mock_vesting_accounts.go b/testutil/vesting/mock_vesting_accounts.go index a31aa8fd480..d55dbd39ac2 100644 --- a/testutil/vesting/mock_vesting_accounts.go +++ b/testutil/vesting/mock_vesting_accounts.go @@ -10,12 +10,7 @@ import ( // LockedCoinsFromDelegating prevents the mock vesting account from delegating // any unvested tokens. func (mvdva MockVestedDelegateVestingAccount) LockedCoinsFromDelegating(blockTime time.Time) sdk.Coins { - locked := mvdva.ContinuousVestingAccount.GetVestingCoins(blockTime) - if locked == nil { - return sdk.NewCoins() - } - - return locked + return mvdva.ContinuousVestingAccount.GetVestingCoins(blockTime) } func NewMockVestedDelegateVestingAccount(cva *types.ContinuousVestingAccount) *MockVestedDelegateVestingAccount { diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index d0310f156b4..0882eb3b815 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -960,7 +960,9 @@ func (suite *IntegrationTestSuite) TestDelegatableCoins() { ctx = ctx.WithBlockTime(now.Add(12 * time.Hour)) suite.Require().NoError(keeper.DelegateCoins(ctx, testAddr, addrModule, delCoins)) - suite.Require().Equal(sdk.NewCoins(), keeper.DelegatableCoins(ctx, testAddr)) + + var emptyCoins sdk.Coins + suite.Require().Equal(emptyCoins, keeper.DelegatableCoins(ctx, testAddr)) suite.Require().Error(keeper.DelegateCoins(ctx, testAddr, addrModule, delCoins)) } diff --git a/x/bank/keeper/view.go b/x/bank/keeper/view.go index b17aceb3c38..1441a1aae77 100644 --- a/x/bank/keeper/view.go +++ b/x/bank/keeper/view.go @@ -221,7 +221,7 @@ func (k BaseViewKeeper) DelegatableCoins(ctx sdk.Context, addr sdk.AccAddress) s func (k BaseViewKeeper) unlockedCoins(total, locked sdk.Coins) (spendable sdk.Coins) { spendable, hasNeg := total.SafeSub(locked...) - if hasNeg || spendable == nil { + if hasNeg { spendable = sdk.NewCoins() return }