diff --git a/config/src/config.rs b/config/src/config.rs index 9855eb7..9666ccb 100644 --- a/config/src/config.rs +++ b/config/src/config.rs @@ -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, @@ -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) diff --git a/controller/src/command.rs b/controller/src/command.rs index 4fa781e..1d1c082 100644 --- a/controller/src/command.rs +++ b/controller/src/command.rs @@ -70,6 +70,7 @@ pub struct InitArgs { pub restore: bool, } +/// Write config (default if None), initiate the wallet pub fn init( owner_api: &mut Owner, _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(