Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: always accept transactions with current nonce #11931

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions crates/transaction-pool/src/pool/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1424,11 +1424,15 @@ impl<T: PoolTransaction> AllTransactions<T> {
fn ensure_valid(
&self,
transaction: ValidPoolTransaction<T>,
on_chain_nonce: u64,
) -> Result<ValidPoolTransaction<T>, InsertErr<T>> {
if !self.local_transactions_config.is_local(transaction.origin, transaction.sender()) {
let current_txs =
self.tx_counter.get(&transaction.sender_id()).copied().unwrap_or_default();
if current_txs >= self.max_account_slots {

// Reject transactions if sender's capacity is exceeded.
// If transaction's nonce matches on-chain nonce always let it through
if current_txs >= self.max_account_slots && transaction.nonce() > on_chain_nonce {
return Err(InsertErr::ExceededSenderTransactionsCapacity {
transaction: Arc::new(transaction),
})
Expand Down Expand Up @@ -1595,7 +1599,7 @@ impl<T: PoolTransaction> AllTransactions<T> {
) -> InsertResult<T> {
assert!(on_chain_nonce <= transaction.nonce(), "Invalid transaction");

let mut transaction = self.ensure_valid(transaction)?;
let mut transaction = self.ensure_valid(transaction, on_chain_nonce)?;

let inserted_tx_id = *transaction.id();
let mut state = TxState::default();
Expand Down
Loading