Skip to content

Commit

Permalink
chore: disable discovery for --dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Jul 1, 2024
1 parent 6db598d commit 90ed154
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
7 changes: 2 additions & 5 deletions crates/e2e-test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,8 @@ where
.with_chain(chain_spec.clone())
.with_network(network_config.clone())
.with_unused_ports()
.with_rpc(RpcServerArgs::default().with_unused_ports().with_http());

if is_dev {
node_config = node_config.dev();
}
.with_rpc(RpcServerArgs::default().with_unused_ports().with_http())
.set_dev(is_dev);

let span = span!(Level::INFO, "node", idx);
let _enter = span.enter();
Expand Down
15 changes: 14 additions & 1 deletion crates/node/core/src/node_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,25 @@ impl NodeConfig {
.with_unused_ports()
}

/// Sets --dev mode for the node
/// Sets --dev mode for the node.
///
/// In addition to setting the `--dev` flag, this also:
/// - disables discovery in [`NetworkArgs`].
pub const fn dev(mut self) -> Self {
self.dev.dev = true;
self.network.discovery.disable_discovery = true;
self
}

/// Sets --dev mode for the node [`NodeConfig::dev`], if `dev` is true.
pub const fn set_dev(self, dev: bool) -> Self {
if dev {
self.dev()
} else {
self
}
}

/// Set the data directory args for the node
pub fn with_datadir_args(mut self, datadir_args: DatadirArgs) -> Self {
self.datadir = datadir_args;
Expand Down

0 comments on commit 90ed154

Please sign in to comment.