[ENG-683]: Ignore auction txs in second portion of PrepareProposal (#51)
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
This commit is contained in:
parent
cc3012a129
commit
d301b3adcd
21
abci/abci.go
21
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
|
||||
}
|
||||
|
||||
@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user