From 5bd0e325b5dadd2a8741b3e824f4adb04e50227c Mon Sep 17 00:00:00 2001 From: Sean King Date: Fri, 8 Oct 2021 16:05:49 +0200 Subject: [PATCH] tests(escrow): adding hasBalance check for module acc --- modules/apps/29-fee/keeper/escrow.go | 1 - modules/apps/29-fee/keeper/escrow_test.go | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/apps/29-fee/keeper/escrow.go b/modules/apps/29-fee/keeper/escrow.go index bb8a39e0e95..f102a893e82 100644 --- a/modules/apps/29-fee/keeper/escrow.go +++ b/modules/apps/29-fee/keeper/escrow.go @@ -26,7 +26,6 @@ func (k Keeper) EscrowPacketFee(ctx sdk.Context, refundAcc sdk.AccAddress, fee t for _, f := range fees { fmt.Print(f) hasBalance := k.bankKeeper.HasBalance(ctx, refundAcc, f) - fmt.Print(hasBalance) if !hasBalance { return sdkerrors.Wrap(types.ErrBalanceNotFound, fmt.Sprintf("%s", refundAcc.String())) } diff --git a/modules/apps/29-fee/keeper/escrow_test.go b/modules/apps/29-fee/keeper/escrow_test.go index d2fc0497432..5a92f25a43b 100644 --- a/modules/apps/29-fee/keeper/escrow_test.go +++ b/modules/apps/29-fee/keeper/escrow_test.go @@ -72,9 +72,13 @@ func (suite *KeeperTestSuite) TestEscrowPacketFee() { if tc.expPass { feeInEscrow, _ := suite.chainA.GetSimApp().IBCFeeKeeper.GetFeeInEscrow(suite.chainA.GetContext(), refundAcc.String(), packetId.ChannelId, packetId.Sequence) + // check if the escrowed fee is set in state suite.Require().Equal(fee.AckFee, feeInEscrow.AckFee) suite.Require().Equal(fee.ReceiveFee, feeInEscrow.ReceiveFee) suite.Require().Equal(fee.TimeoutFee, feeInEscrow.TimeoutFee) + // check if the balance for the module account is correct and the fee is correctly escrowed + hasBalance := suite.chainA.GetSimApp().BankKeeper.HasBalance(suite.chainA.GetContext(), suite.chainA.GetSimApp().IBCFeeKeeper.GetFeeModuleAddress(), sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(300)}) + suite.Require().True(hasBalance) suite.Require().NoError(err) } else { suite.Require().Error(err)