diff --git a/crates/aptos/src/node/local_testnet/mod.rs b/crates/aptos/src/node/local_testnet/mod.rs index 7a19fa18d6a029..5016eb3340098d 100644 --- a/crates/aptos/src/node/local_testnet/mod.rs +++ b/crates/aptos/src/node/local_testnet/mod.rs @@ -150,16 +150,28 @@ impl RunLocalTestnet { .map(StdRng::from_seed) .unwrap_or_else(StdRng::from_entropy); - let mut node_config = create_single_node_test_config( - &self.config_path, - &self.test_config_override, - &test_dir, - false, - false, - aptos_cached_packages::head_release_bundle(), - rng, - ) - .context("Failed to create config for node")?; + let validator_config_path = test_dir.join("0").join("node.yaml"); + let mut node_config = match validator_config_path.exists() { + // Start with the existing config if present. + true => NodeConfig::load_from_path(&validator_config_path).with_context(|| { + format!( + "Failed to load existing config at {}, try using --force-restart", + validator_config_path.display() + ) + })?, + // Create a new one if not, e.g. if this is the first run or the user + // specified --force-restart. + false => create_single_node_test_config( + &self.config_path, + &self.test_config_override, + &test_dir, + false, + false, + aptos_cached_packages::head_release_bundle(), + rng, + ) + .context("Failed to create config for node")?, + }; eprintln!();