Skip to content

Commit 630e2f3

Browse files
authored
Merge pull request #3815 from dusk-network/gas_limit_replace
2 parents 74d6227 + 3979600 commit 630e2f3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

node/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Add support for `TransactionData::Blob`
1313

14+
### Changed
15+
16+
- Change mempool rule to compare gas limit on equal price
17+
1418
## [1.3.0] - 2025-04-17
1519

1620
### Added

node/src/mempool.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,17 @@ impl MempoolSrv {
359359
// ensure spend_ids do not exist in the mempool
360360
for m_tx_id in db.mempool_txs_by_spendable_ids(&spend_ids) {
361361
if let Some(m_tx) = db.mempool_tx(m_tx_id)? {
362-
if m_tx.inner.gas_price() < tx.inner.gas_price() {
362+
// If the transaction spendingId is already in the mempool
363+
// (same nonce or same nullifier), we check if it can be
364+
// replaced by the new transaction based on gas price and
365+
// gas limit.
366+
// If the new transaction has a higher gas price or the same
367+
// gas price but a higher gas limit, we replace the old
368+
// transaction with the new one.
369+
if m_tx.inner.gas_price() < tx.inner.gas_price()
370+
|| (m_tx.inner.gas_price() == tx.inner.gas_price()
371+
&& m_tx.inner.gas_limit() < tx.inner.gas_limit())
372+
{
363373
for deleted in db.delete_mempool_tx(m_tx_id, false)? {
364374
events.push(TransactionEvent::Removed(deleted));
365375
replaced = true;

0 commit comments

Comments
 (0)