From 1efcd88b4b9bb25ab69dc167f70db2bd9dbb75f9 Mon Sep 17 00:00:00 2001 From: "jaeseung.bae" Date: Thu, 15 Feb 2024 16:38:05 +0900 Subject: [PATCH] chore: no need to check empty balance. Balance will be back while handling tx which throws error --- x/bankplus/keeper/keeper.go | 12 ------------ x/bankplus/keeper/keeper_test.go | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/x/bankplus/keeper/keeper.go b/x/bankplus/keeper/keeper.go index 30ea62f273..cdf2a262ba 100644 --- a/x/bankplus/keeper/keeper.go +++ b/x/bankplus/keeper/keeper.go @@ -75,18 +75,6 @@ func (k BaseKeeper) isInactiveAddr(addr sdk.AccAddress) bool { return k.inactiveAddrs[addrString] } -// SendCoins transfers amt coins from a sending account to a receiving account. -// This is wrapped bank the `SendKeeper` interface of `bank` module, -// and checks if `toAddr` is a inactiveAddr managed by the module. -func (k BaseKeeper) SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error { - // if toAddr is smart contract, check the status of contract. - if k.isInactiveAddr(toAddr) { - return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", toAddr) - } - - return k.BaseSendKeeper.SendCoins(ctx, fromAddr, toAddr, amt) -} - // AddToInactiveAddr adds the address to `inactiveAddr`. func (k BaseKeeper) AddToInactiveAddr(ctx context.Context, addr sdk.AccAddress) { addrString, err := k.addrCdc.BytesToString(addr) diff --git a/x/bankplus/keeper/keeper_test.go b/x/bankplus/keeper/keeper_test.go index ddb5d0d11f..a9297cbda1 100644 --- a/x/bankplus/keeper/keeper_test.go +++ b/x/bankplus/keeper/keeper_test.go @@ -195,6 +195,7 @@ func (s *IntegrationTestSuite) verifySendAccountToModule() { func (s *IntegrationTestSuite) TestInactiveAddrOfSendCoins() { s.mintInitialBalances() s.verifySendToBlockedAddr() + s.mintInitialBalances() s.verifySendToBlockedAddrAfterRemoveIt() } @@ -205,7 +206,6 @@ func (s *IntegrationTestSuite) verifySendToBlockedAddr() { err := s.cut.SendCoins(s.ctx, s.holderAcc.GetAddress(), s.blockedAcc.GetAddress(), initCoins) s.Require().Contains(err.Error(), "is not allowed to receive funds") - s.Require().Equal(initCoins, s.cut.GetAllBalances(s.ctx, s.holderAcc.GetAddress())) } func (s *IntegrationTestSuite) verifySendToBlockedAddrAfterRemoveIt() {