mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: disable discovery for --dev (#9229)
This commit is contained in:
@ -58,15 +58,12 @@ where
|
||||
let mut nodes: Vec<NodeTestContext<_>> = Vec::with_capacity(num_nodes);
|
||||
|
||||
for idx in 0..num_nodes {
|
||||
let mut node_config = NodeConfig::test()
|
||||
let node_config = NodeConfig::test()
|
||||
.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();
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user