Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: network switching #3413

Merged
merged 2 commits into from
Oct 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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