diff --git a/modules/apps/29-fee/ibc_module_test.go b/modules/apps/29-fee/ibc_module_test.go index 8bdc92458f7..fb2bd8ecf01 100644 --- a/modules/apps/29-fee/ibc_module_test.go +++ b/modules/apps/29-fee/ibc_module_test.go @@ -622,6 +622,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { }.Acknowledgement() expectedRelayerBalance = packetFee.Fee.AckFee + expectedBalance = expectedBalance.Add(packetFee.Fee.RecvFee[0]) }, true, }, @@ -693,7 +694,6 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { expectedRelayerBalance, relayerBalance, ) - }) } } diff --git a/modules/apps/29-fee/keeper/escrow.go b/modules/apps/29-fee/keeper/escrow.go index 37c9dd7e624..525ce258d05 100644 --- a/modules/apps/29-fee/keeper/escrow.go +++ b/modules/apps/29-fee/keeper/escrow.go @@ -56,7 +56,7 @@ func (k Keeper) DistributePacketFees(ctx sdk.Context, forwardRelayer string, rev } // distribute fee to valid forward relayer address otherwise refund the fee - if !forwardAddr.Empty() { + if !forwardAddr.Empty() && !k.bankKeeper.BlockedAddr(forwardAddr) { // distribute fee for forward relaying k.distributeFee(ctx, forwardAddr, packetFee.Fee.RecvFee) } else { diff --git a/modules/apps/29-fee/keeper/escrow_test.go b/modules/apps/29-fee/keeper/escrow_test.go index 647b968f56d..2f6b2fe62b1 100644 --- a/modules/apps/29-fee/keeper/escrow_test.go +++ b/modules/apps/29-fee/keeper/escrow_test.go @@ -5,6 +5,7 @@ import ( "github.com/tendermint/tendermint/crypto/secp256k1" "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types" + transfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v3/testing" ) @@ -141,6 +142,11 @@ func (suite *KeeperTestSuite) TestDistributeFee() { forwardRelayer = "invalid address" }, false, }, + { + "invalid forward address: blocked address", func() { + forwardRelayer = suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress().String() + }, false, + }, } for _, tc := range testCases { diff --git a/modules/apps/29-fee/types/expected_keepers.go b/modules/apps/29-fee/types/expected_keepers.go index 0b42718ff02..3a58f0706b3 100644 --- a/modules/apps/29-fee/types/expected_keepers.go +++ b/modules/apps/29-fee/types/expected_keepers.go @@ -37,4 +37,5 @@ type BankKeeper interface { SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + BlockedAddr(sdk.AccAddress) bool }