diff --git a/abci/abci.go b/abci/abci.go index 3c39164..bf47d84 100644 --- a/abci/abci.go +++ b/abci/abci.go @@ -141,6 +141,18 @@ func (h *ProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHandler { for ; iterator != nil; iterator = iterator.Next() { memTx := iterator.Tx() + // We've already selected the highest bid transaction, so we can skip + // all other auction transactions. + isAuctionTx, err := h.isAuctionTx(memTx) + if err != nil { + txsToRemove[memTx] = struct{}{} + continue selectTxLoop + } + + if isAuctionTx { + continue selectTxLoop + } + txBz, err := h.txVerifier.PrepareProposalVerifyTx(memTx) if err != nil { txsToRemove[memTx] = struct{}{} @@ -216,3 +228,12 @@ func (h *ProposalHandler) RemoveTx(tx sdk.Tx) { panic(fmt.Errorf("failed to remove invalid transaction from the mempool: %w", err)) } } + +func (h *ProposalHandler) isAuctionTx(tx sdk.Tx) (bool, error) { + msgAuctionBid, err := mempool.GetMsgAuctionBidFromTx(tx) + if err != nil { + return false, err + } + + return msgAuctionBid != nil, nil +} diff --git a/abci/abci_test.go b/abci/abci_test.go index 4dd237e..de46bb9 100644 --- a/abci/abci_test.go +++ b/abci/abci_test.go @@ -350,7 +350,7 @@ func (suite *ABCITestSuite) TestPrepareProposal() { insertRefTxs = false }, 4, - 1, + 10, true, }, { @@ -362,7 +362,7 @@ func (suite *ABCITestSuite) TestPrepareProposal() { insertRefTxs = true }, 31, - 31, + 40, true, }, { @@ -470,7 +470,7 @@ func (suite *ABCITestSuite) TestPrepareProposal() { insertRefTxs = true }, 201, - 201, + 300, true, }, }