From 3f0b77785adfae9b2ff83847c52f17bcdf3a0582 Mon Sep 17 00:00:00 2001 From: huangyi Date: Mon, 2 Sep 2024 11:39:35 +0800 Subject: [PATCH] Problem: tx is not replaced by priority Closes: #1557 Solution: - add TxReplacement callback, only replace if priority is higher --- CHANGELOG.md | 1 + app/app.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ce0b33b7d..83f1bd39d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ * (store) [#1526](https://github.com/crypto-org-chain/cronos/pull/1526) Cache index/filters in rocksdb application.db to reduce ram usage. * (store)[#1529](https://github.com/crypto-org-chain/cronos/pull/1529) Enable pinL0FilterAndIndexBlocksInCache. * (store)[#1547](https://github.com/crypto-org-chain/cronos/pull/1547) Disable memiavl cache if block-stm is enabled. +* (app) [#]() Only replace tx if new priority is larger. ### Bug Fixes diff --git a/app/app.go b/app/app.go index 7da2128af5..7e503881e2 100644 --- a/app/app.go +++ b/app/app.go @@ -375,6 +375,10 @@ func New( TxPriority: mempool.NewDefaultTxPriority(), SignerExtractor: evmapp.NewEthSignerExtractionAdapter(mempool.NewDefaultSignerExtractionAdapter()), MaxTx: maxTxs, + TxReplacement: func(op, np int64, oTx, nTx sdk.Tx) bool { + // tx is only replaced if new priority is higher than old priority + return np > op + }, }) handler := baseapp.NewDefaultProposalHandler(mempool, app)