refactor: dedup runtime initializations (#22263)

Co-authored-by: Alexey Shekhirin <github@shekhirin.com>
This commit is contained in:
DaniPopes
2026-02-17 18:35:31 +01:00
committed by GitHub
parent 6ff4f947c8
commit 0ba685386d
72 changed files with 275 additions and 318 deletions

View File

@@ -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());