Skip to content
7 changes: 7 additions & 0 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,13 @@ func (app *BaseApp) runTx(mode execMode, txBytes []byte) (gInfo sdk.GasInfo, res
gasWanted = ctx.GasMeter().Limit()

if err != nil {
if mode == execModeReCheck {
// if the ante handler fails on recheck, we want to remove the tx from the mempool
err := app.mempool.Remove(tx)
if err != nil {
Comment thread
tac0turtle marked this conversation as resolved.
Outdated
Comment thread
tac0turtle marked this conversation as resolved.
Outdated
return gInfo, nil, anteEvents, errors.Join(err, err)
Comment thread
facundomedica marked this conversation as resolved.
Outdated
}
}
Comment thread
tac0turtle marked this conversation as resolved.
return gInfo, nil, nil, err
}

Expand Down
7 changes: 7 additions & 0 deletions baseapp/baseapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/cosmos/cosmos-sdk/testutil"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/mempool"
)

var (
Expand Down Expand Up @@ -80,6 +81,12 @@ func NewBaseAppSuite(t *testing.T, opts ...func(*baseapp.BaseApp)) *BaseAppSuite
app.SetParamStore(paramStore{db: dbm.NewMemDB()})
app.SetTxDecoder(txConfig.TxDecoder())
app.SetTxEncoder(txConfig.TxEncoder())
mem := mempool.NewPriorityMempool[int64](mempool.PriorityNonceMempoolConfig[int64]{
TxPriority: mempool.NewDefaultTxPriority(),
MaxTx: 0,
SignerExtractor: mempool.NewDefaultSignerExtractionAdapter(),
})
app.SetMempool(mem)

// mount stores and seal
require.Nil(t, app.LoadLatestVersion())
Expand Down