chore: disable discovery for --dev (#9229)

This commit is contained in:
Matthias Seitz
2024-07-01 20:01:39 +02:00
committed by GitHub
parent ad8ec33dc3
commit 116d7a3f1b
2 changed files with 17 additions and 7 deletions

View File

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