Skip to content

Commit

Permalink
fix: network switching (#3413)
Browse files Browse the repository at this point in the history
Description
---
When the base node is runned with command `-network <name>` everything is loaded from them correct folder.

How Has This Been Tested?
---
Manually.
  • Loading branch information
Cifko authored Oct 5, 2021
1 parent 1231cc0 commit 9a369a0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion applications/tari_app_utilities/src/initialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ pub fn init_configuration(
// Populate the configuration struct
let mut global_config = GlobalConfig::convert_from(application_type, cfg.clone())
.map_err(|err| ExitCodes::ConfigError(err.to_string()))?;
check_file_paths(&mut global_config, &bootstrap);

if let Some(str) = bootstrap.network.clone() {
log::info!(target: LOG_TARGET, "Network selection requested");

let network = Network::from_str(&str);
match network {
Ok(network) => {
Expand All @@ -44,6 +44,13 @@ pub fn init_configuration(
network
);
global_config.network = network;
global_config.data_dir = PathBuf::from(str);
if let DatabaseType::LMDB(_) = global_config.db_type {
global_config.db_type = DatabaseType::LMDB(global_config.data_dir.join("db"));
}
global_config.peer_db_path = global_config.data_dir.join("peer_db");
global_config.wallet_peer_db_path = global_config.data_dir.join("wallet_peer_db");
global_config.console_wallet_peer_db_path = global_config.data_dir.join("console_wallet_peer_db");
},
Err(_) => {
log::warn!(
Expand All @@ -53,6 +60,7 @@ pub fn init_configuration(
},
}
}
check_file_paths(&mut global_config, &bootstrap);

Ok((bootstrap, global_config, cfg))
}
Expand Down

0 comments on commit 9a369a0

Please sign in to comment.