mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
feat: adding a new method to network config builder (#11569)
This commit is contained in:
@@ -271,6 +271,7 @@ pub async fn test_exex_context_with_chain_spec(
|
||||
|
||||
let network_manager = NetworkManager::new(
|
||||
NetworkConfigBuilder::new(SecretKey::new(&mut rand::thread_rng()))
|
||||
.with_unused_discovery_port()
|
||||
.build(provider_factory.clone()),
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -347,6 +347,18 @@ impl NetworkConfigBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the discovery port to an unused port.
|
||||
/// This is useful for testing.
|
||||
pub fn with_unused_discovery_port(self) -> Self {
|
||||
self.discovery_port(0)
|
||||
}
|
||||
|
||||
/// Sets the listener port to an unused port.
|
||||
/// This is useful for testing.
|
||||
pub fn with_unused_listener_port(self) -> Self {
|
||||
self.listener_port(0)
|
||||
}
|
||||
|
||||
/// Sets the external ip resolver to use for discovery v4.
|
||||
///
|
||||
/// If no [`Discv4ConfigBuilder`] is set via [`Self::discovery`], this will create a new one.
|
||||
|
||||
Reference in New Issue
Block a user