feat: Support txpool.locals in txpool.cli (#5971)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Supernovahs.eth
2024-01-09 20:02:55 +05:30
committed by GitHub
parent a3d2b224ea
commit 7cd659f406
4 changed files with 33 additions and 6 deletions

View File

@@ -2,12 +2,12 @@
use crate::cli::config::RethTransactionPoolConfig;
use clap::Args;
use reth_primitives::Address;
use reth_transaction_pool::{
LocalTransactionConfig, PoolConfig, PriceBumpConfig, SubPoolLimit, DEFAULT_PRICE_BUMP,
REPLACE_BLOB_PRICE_BUMP, TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER,
TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT, TXPOOL_SUBPOOL_MAX_TXS_DEFAULT,
};
/// Parameters for debugging purposes
#[derive(Debug, Args, PartialEq)]
#[clap(next_help_heading = "TxPool")]
@@ -47,6 +47,9 @@ pub struct TxPoolArgs {
/// Flag to disable local transaction exemptions.
#[arg(long = "txpool.nolocals")]
pub no_locals: bool,
/// Flag to allow certain addresses as local
#[arg(long = "txpool.locals")]
pub locals: Vec<Address>,
}
impl Default for TxPoolArgs {
@@ -62,6 +65,7 @@ impl Default for TxPoolArgs {
price_bump: DEFAULT_PRICE_BUMP,
blob_transaction_price_bump: REPLACE_BLOB_PRICE_BUMP,
no_locals: false,
locals: Default::default(),
}
}
}
@@ -70,7 +74,10 @@ impl RethTransactionPoolConfig for TxPoolArgs {
/// Returns transaction pool configuration.
fn pool_config(&self) -> PoolConfig {
PoolConfig {
local_transactions_config: LocalTransactionConfig { no_exemptions: self.no_locals },
local_transactions_config: LocalTransactionConfig {
no_exemptions: self.no_locals,
local_addresses: self.locals.clone().into_iter().collect(),
},
pending_limit: SubPoolLimit {
max_txs: self.pending_max_count,
max_size: self.pending_max_size * 1024 * 1024,