diff --git a/nimbus/core/tx_pool/tx_tasks/tx_add.nim b/nimbus/core/tx_pool/tx_tasks/tx_add.nim index 01e95f087..b37fb814d 100644 --- a/nimbus/core/tx_pool/tx_tasks/tx_add.nim +++ b/nimbus/core/tx_pool/tx_tasks/tx_add.nim @@ -77,10 +77,18 @@ proc supersede(xp: TxPoolRef; item: TxItemRef): Result[void,TxInfo] return err(txInfoErrUnspecified) current = rc.value.data - # verify whether replacing is allowed, at all - let bumpPrice = (current.tx.gasPrice * xp.priceBump.GasInt + 99) div 100 - if item.tx.gasPrice < current.tx.gasPrice + bumpPrice: - return err(txInfoErrReplaceUnderpriced) + # TODO: To unblock `kurtosis-tech/ethereum-package` based testing, + # we have to accept superseding transactions temporarily until `rpc_utils.nim` + # supports the 'pending' tag by incorporating pending transactions from the + # mempool when returning the current account nonce. Until that is fixed, + # we keep telling the transaction spammer that their nonce has not changed, + # and it keeps spamming transactions with the same nonce repeatedly. + # Note: When this is fixed, update `tests/test_txpool.nim` and + # re-enable the "Superseding txs with sender and nonce variants" test case. + if false: + let bumpPrice = (current.tx.gasPrice * xp.priceBump.GasInt + 99) div 100 + if item.tx.gasPrice < current.tx.gasPrice + bumpPrice: + return err(txInfoErrReplaceUnderpriced) # make space, delete item if not xp.txDB.dispose(current, txInfoSenderNonceSuperseded): diff --git a/tests/test_txpool.nim b/tests/test_txpool.nim index 0e201c01b..a34a7d10b 100644 --- a/tests/test_txpool.nim +++ b/tests/test_txpool.nim @@ -301,11 +301,12 @@ proc runTxPoolTests(noisy = true) = check xq.nItems.total == testTxs.len check xq.nItems.disposed == testTxs.len - # last update item was underpriced, so it must not have been - # replaced - var altLst = testTxs.toSeq.mapIt("alt " & it[0].info) - altLst[^1] = testTxs[^1][0].info - check altLst.sorted == xq.toItems.toSeq.mapIt(it.info).sorted + if false: # Temporarily disabled, see `supersede` in `tx_add.nim` + # last update item was underpriced, so it must not have been + # replaced + var altLst = testTxs.toSeq.mapIt("alt " & it[0].info) + altLst[^1] = testTxs[^1][0].info + check altLst.sorted == xq.toItems.toSeq.mapIt(it.info).sorted test &"Deleting tx => also delete higher nonces":