Always generate a new key for the P2P network

This commit is contained in:
Luke Parker
2025-09-22 06:41:30 -04:00
parent 3655ae68df
commit 0b377f3c4e

View File

@@ -48,7 +48,7 @@ impl SubstrateCli for Cli {
} }
pub fn run() -> sc_cli::Result<()> { pub fn run() -> sc_cli::Result<()> {
let cli = Cli::from_args(); let mut cli = Cli::from_args();
match &cli.subcommand { match &cli.subcommand {
Some(Subcommand::Key(cmd)) => cmd.run(&cli), Some(Subcommand::Key(cmd)) => cmd.run(&cli),
@@ -98,11 +98,20 @@ pub fn run() -> sc_cli::Result<()> {
cli.create_runner(cmd)?.sync_run(|config| cmd.run::<Block>(&config)) cli.create_runner(cmd)?.sync_run(|config| cmd.run::<Block>(&config))
} }
None => cli.create_runner(&cli.run)?.run_node_until_exit(|mut config| async { None => {
cli.run.network_params.node_key_params = sc_cli::NodeKeyParams {
node_key: None,
node_key_file: None,
node_key_type: sc_cli::arg_enums::NodeKeyType::Ed25519,
unsafe_force_node_key_generation: true,
};
cli.create_runner(&cli.run)?.run_node_until_exit(|mut config| async {
if config.role.is_authority() { if config.role.is_authority() {
config.state_pruning = Some(PruningMode::ArchiveAll); config.state_pruning = Some(PruningMode::ArchiveAll);
} }
service::new_full(config).map_err(sc_cli::Error::Service) service::new_full(config).map_err(sc_cli::Error::Service)
}), })
}
} }
} }