diff --git a/crates/transaction-pool/src/pool/txpool.rs b/crates/transaction-pool/src/pool/txpool.rs index 617cdaa94c..1c488fd8cf 100644 --- a/crates/transaction-pool/src/pool/txpool.rs +++ b/crates/transaction-pool/src/pool/txpool.rs @@ -1415,6 +1415,9 @@ impl AllTransactions { let mut cumulative_cost = U256::ZERO; let mut updates = Vec::new(); + // Current tx does not exceed block gas limit after ensure_valid check + state.insert(TxState::NOT_TOO_MUCH_GAS); + // identifier of the ancestor transaction, will be None if the transaction is the next tx of // the sender let ancestor = TransactionId::ancestor( @@ -1457,11 +1460,6 @@ impl AllTransactions { state.insert(TxState::ENOUGH_FEE_CAP_BLOCK); } - // Ensure tx does not exceed block gas limit - if transaction.gas_limit() < self.block_gas_limit { - state.insert(TxState::NOT_TOO_MUCH_GAS); - } - // placeholder for the replaced transaction, if any let mut replaced_tx = None; @@ -2491,6 +2489,20 @@ mod tests { )); } + #[test] + fn test_tx_equal_gas_limit() { + let on_chain_balance = U256::from(1_000); + let on_chain_nonce = 0; + let mut f = MockTransactionFactory::default(); + let mut pool = AllTransactions::default(); + + let tx = MockTransaction::eip1559().with_gas_limit(30_000_000); + + let InsertOk { state, .. } = + pool.insert_tx(f.validated(tx), on_chain_balance, on_chain_nonce).unwrap(); + assert!(state.contains(TxState::NOT_TOO_MUCH_GAS)); + } + #[test] fn update_basefee_subpools() { let mut f = MockTransactionFactory::default();