diff --git a/crates/node/builder/src/builder/mod.rs b/crates/node/builder/src/builder/mod.rs index d2ce2a1d8e..8b57781ea9 100644 --- a/crates/node/builder/src/builder/mod.rs +++ b/crates/node/builder/src/builder/mod.rs @@ -9,6 +9,13 @@ pub use states::*; use std::sync::Arc; +use crate::{ + common::WithConfigs, + components::NodeComponentsBuilder, + node::FullNode, + rpc::{EthApiBuilderProvider, RethRpcServerHandles, RpcContext}, + DefaultNodeLauncher, LaunchNode, Node, NodeHandle, +}; use futures::Future; use reth_chainspec::{EthChainSpec, EthereumHardforks, Hardforks}; use reth_cli_util::get_secret_key; @@ -18,7 +25,8 @@ use reth_db_api::{ }; use reth_exex::ExExContext; use reth_network::{ - NetworkBuilder, NetworkConfig, NetworkConfigBuilder, NetworkHandle, NetworkManager, + transactions::TransactionsManagerConfig, NetworkBuilder, NetworkConfig, NetworkConfigBuilder, + NetworkHandle, NetworkManager, }; use reth_node_api::{ FullNodeTypes, FullNodeTypesAdapter, NodeAddOns, NodeTypes, NodeTypesWithDBAdapter, @@ -38,14 +46,6 @@ use reth_transaction_pool::{PoolConfig, TransactionPool}; use secp256k1::SecretKey; use tracing::{info, trace, warn}; -use crate::{ - common::WithConfigs, - components::NodeComponentsBuilder, - node::FullNode, - rpc::{EthApiBuilderProvider, RethRpcServerHandles, RpcContext}, - DefaultNodeLauncher, LaunchNode, Node, NodeHandle, -}; - /// The adapter type for a reth node with the builtin provider type // Note: we need to hardcode this because custom components might depend on it in associated types. pub type RethFullAdapter = FullNodeTypesAdapter< @@ -583,16 +583,34 @@ impl BuilderContext { self.config().builder.clone() } - /// Convenience function to start the network. + /// Convenience function to start the network tasks. /// /// Spawns the configured network and associated tasks and returns the [`NetworkHandle`] /// connected to that network. pub fn start_network(&self, builder: NetworkBuilder<(), ()>, pool: Pool) -> NetworkHandle + where + Pool: TransactionPool + Unpin + 'static, + { + self.start_network_with(builder, pool, Default::default()) + } + + /// Convenience function to start the network tasks. + /// + /// Accepts the config for the transaction task. + /// + /// Spawns the configured network and associated tasks and returns the [`NetworkHandle`] + /// connected to that network. + pub fn start_network_with( + &self, + builder: NetworkBuilder<(), ()>, + pool: Pool, + tx_config: TransactionsManagerConfig, + ) -> NetworkHandle where Pool: TransactionPool + Unpin + 'static, { let (handle, network, txpool, eth) = builder - .transactions(pool, Default::default()) + .transactions(pool, tx_config) .request_handler(self.provider().clone()) .split_with_handle();