Cleaning up

This commit is contained in:
Anynomouss
2025-03-01 14:23:39 +01:00
parent b45b603382
commit fe86c7a7e5
2 changed files with 3 additions and 21 deletions
+2 -19
View File
@@ -178,7 +178,7 @@ fn check_api_secret_file(
}
/// Handles setup and detection of paths for wallet
// Use config file in a) current directory as template, or b) in top path, or c) .grin home
/// Use config file in a) current dir as template, b) in top path, or c) .grin home
pub fn initial_setup_wallet(
chain_type: &global::ChainTypes,
data_path: Option<PathBuf>,
@@ -224,25 +224,8 @@ pub fn initial_setup_wallet(
default_config.config_file_path = Some(config_path);
// Update paths relative to current dir
default_config.update_paths(&wallet_path, &node_path);
// Write config file, otherwise defaults will be writen
// default_config
// .write_to_file(
// &default_config
// .config_file_path
// .clone()
// .unwrap()
// .to_str()
// .unwrap(),
// false,
// None,
// None,
// )
// .unwrap_or_else(|e| {
// panic!("Error creating config file: {}", e);
// });
(wallet_path, default_config)
}
true => {
let mut path = wallet_path.clone();
path.pop();
@@ -253,7 +236,7 @@ pub fn initial_setup_wallet(
}
}
};
// Check API secrets, if ok, return config
check_api_secret_file(chain_type, Some(path.clone()), OWNER_API_SECRET_FILE_NAME)?;
check_api_secret_file(chain_type, Some(path), API_SECRET_FILE_NAME)?;
Ok(config)
+1 -2
View File
@@ -70,6 +70,7 @@ pub struct InitArgs {
pub restore: bool,
}
/// Write config (default if None), initiate the wallet
pub fn init<L, C, K>(
owner_api: &mut Owner<L, C, K>,
_g_args: &GlobalArgs,
@@ -81,9 +82,7 @@ where
C: NodeClient + 'static,
K: keychain::Keychain + 'static,
{
// Assume global chain type has already been initialized.
let chain_type = global::get_chain_type();
let mut w_lock = owner_api.wallet_inst.lock();
let p = w_lock.lc_provider()?;
p.create_config(