Skip to content

Commit

Permalink
feat: adding a new method to network config builder
Browse files Browse the repository at this point in the history
  • Loading branch information
loocapro committed Oct 8, 2024
1 parent 4163835 commit a4add44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/exex/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down
6 changes: 6 additions & 0 deletions crates/net/network/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,12 @@ 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 external ip resolver to use for discovery v4.
///
/// If no [`Discv4ConfigBuilder`] is set via [`Self::discovery`], this will create a new one.
Expand Down

0 comments on commit a4add44

Please sign in to comment.