mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-19 03:04:27 -05:00
refactor: dedup runtime initializations (#22263)
Co-authored-by: Alexey Shekhirin <github@shekhirin.com>
This commit is contained in:
@@ -24,6 +24,7 @@ use reth_ethereum::{
|
||||
BlockDownloaderProvider, FetchClient, NetworkConfig, NetworkEventListenerProvider,
|
||||
NetworkHandle, NetworkInfo, NetworkManager, Peers,
|
||||
},
|
||||
tasks::Runtime,
|
||||
};
|
||||
|
||||
#[tokio::main]
|
||||
@@ -34,7 +35,8 @@ async fn main() -> eyre::Result<()> {
|
||||
let local_key = rng_secret_key();
|
||||
|
||||
// Configure the network
|
||||
let config = NetworkConfig::builder(local_key).build_with_noop_provider(DEV.clone());
|
||||
let config =
|
||||
NetworkConfig::builder(local_key, Runtime::test()).build_with_noop_provider(DEV.clone());
|
||||
|
||||
let (requests_tx, mut requests_rx) = tokio::sync::mpsc::channel(1000);
|
||||
let (transactions_tx, mut transactions_rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
@@ -107,7 +109,7 @@ async fn main() -> eyre::Result<()> {
|
||||
/// first peer.
|
||||
async fn run_peer(handle: NetworkHandle) -> eyre::Result<()> {
|
||||
// create another peer
|
||||
let config = NetworkConfig::builder(rng_secret_key())
|
||||
let config = NetworkConfig::builder(rng_secret_key(), Runtime::test())
|
||||
// use random ports
|
||||
.with_unused_ports()
|
||||
.build_with_noop_provider(DEV.clone());
|
||||
|
||||
Reference in New Issue
Block a user