feat: add RethTransactionPoolConfig (#5729)

This commit is contained in:
Matthias Seitz
2023-12-11 15:58:57 +01:00
committed by GitHub
parent 1e523049ca
commit fa1584b223
3 changed files with 13 additions and 4 deletions

View File

@ -1,5 +1,6 @@
//! Transaction pool arguments //! Transaction pool arguments
use crate::cli::config::RethTransactionPoolConfig;
use clap::Args; use clap::Args;
use reth_transaction_pool::{ use reth_transaction_pool::{
LocalTransactionConfig, PoolConfig, PriceBumpConfig, SubPoolLimit, DEFAULT_PRICE_BUMP, LocalTransactionConfig, PoolConfig, PriceBumpConfig, SubPoolLimit, DEFAULT_PRICE_BUMP,
@ -65,9 +66,9 @@ impl Default for TxPoolArgs {
} }
} }
impl TxPoolArgs { impl RethTransactionPoolConfig for TxPoolArgs {
/// Returns transaction pool configuration. /// Returns transaction pool configuration.
pub fn pool_config(&self) -> PoolConfig { fn pool_config(&self) -> PoolConfig {
PoolConfig { PoolConfig {
local_transactions_config: LocalTransactionConfig { no_exemptions: self.no_locals }, local_transactions_config: LocalTransactionConfig { no_exemptions: self.no_locals },
pending_limit: SubPoolLimit { pending_limit: SubPoolLimit {

View File

@ -11,9 +11,10 @@ use reth_rpc_builder::{
auth::AuthServerConfig, error::RpcError, EthConfig, IpcServerBuilder, RpcServerConfig, auth::AuthServerConfig, error::RpcError, EthConfig, IpcServerBuilder, RpcServerConfig,
ServerBuilder, TransportRpcModuleConfig, ServerBuilder, TransportRpcModuleConfig,
}; };
use reth_transaction_pool::PoolConfig;
use std::{borrow::Cow, path::PathBuf, time::Duration}; use std::{borrow::Cow, path::PathBuf, time::Duration};
/// A trait that provides configured RPC server. /// A trait that provides a configured RPC server.
/// ///
/// This provides all basic config values for the RPC server and is implemented by the /// This provides all basic config values for the RPC server and is implemented by the
/// [RpcServerArgs](crate::args::RpcServerArgs) type. /// [RpcServerArgs](crate::args::RpcServerArgs) type.
@ -127,3 +128,10 @@ impl<C> RethNetworkConfig for reth_network::NetworkManager<C> {
reth_network::NetworkManager::add_rlpx_sub_protocol(self, protocol); reth_network::NetworkManager::add_rlpx_sub_protocol(self, protocol);
} }
} }
/// A trait that provides all basic config values for the transaction pool and is implemented by the
/// [TxPoolArgs](crate::args::TxPoolArgs) type.
pub trait RethTransactionPoolConfig {
/// Returns transaction pool configuration.
fn pool_config(&self) -> PoolConfig;
}

View File

@ -10,7 +10,7 @@ use crate::{
}, },
cli::{ cli::{
components::RethNodeComponentsImpl, components::RethNodeComponentsImpl,
config::RethRpcConfig, config::{RethRpcConfig, RethTransactionPoolConfig},
ext::{RethCliExt, RethNodeCommandConfig}, ext::{RethCliExt, RethNodeCommandConfig},
}, },
dirs::{ChainPath, DataDirPath, MaybePlatformPath}, dirs::{ChainPath, DataDirPath, MaybePlatformPath},