Skip to content

feat: add no-local-exemptions settings to MaintainPoolConfig #15651

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

Merged
merged 3 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions crates/ethereum/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@ where
ctx.task_executor().clone(),
reth_transaction_pool::maintain::MaintainPoolConfig {
max_tx_lifetime: transaction_pool.config().max_queued_lifetime,
no_local_exemptions: transaction_pool
.config()
.local_transactions_config
.no_exemptions,
..Default::default()
},
),
Expand Down
4 changes: 4 additions & 0 deletions crates/optimism/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,10 @@ where
ctx.task_executor().clone(),
reth_transaction_pool::maintain::MaintainPoolConfig {
max_tx_lifetime: pool.config().max_queued_lifetime,
no_local_exemptions: transaction_pool
.config()
.local_transactions_config
.no_exemptions,
..Default::default()
},
),
Expand Down
12 changes: 10 additions & 2 deletions crates/transaction-pool/src/maintain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ pub struct MaintainPoolConfig {
/// Maximum amount of time non-executable, non local transactions are queued.
/// Default: 3 hours
pub max_tx_lifetime: Duration,

/// Apply no exemptions to the locally received transactions.
///
/// This includes:
/// - no price exemptions
/// - no eviction exemptions
pub no_local_exemptions: bool,
}

impl Default for MaintainPoolConfig {
Expand All @@ -64,6 +71,7 @@ impl Default for MaintainPoolConfig {
max_update_depth: 64,
max_reload_accounts: 100,
max_tx_lifetime: MAX_QUEUED_TRANSACTION_LIFETIME,
no_local_exemptions: false,
}
}
}
Expand Down Expand Up @@ -257,8 +265,8 @@ pub async fn maintain_transaction_pool<N, Client, P, St, Tasks>(
.queued_transactions()
.into_iter()
.filter(|tx| {
// filter stale external txs
tx.origin.is_external() && tx.timestamp.elapsed() > config.max_tx_lifetime
// filter stale transactions based on config
(tx.origin.is_external() || config.no_local_exemptions) && tx.timestamp.elapsed() > config.max_tx_lifetime
})
.map(|tx| *tx.hash())
.collect();
Expand Down
Loading