Skip to content

Commit 3473017

Browse files
committed
feat: add wallet init
-refactor prepare_wallet_db fn
1 parent eee4851 commit 3473017

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,18 @@ pub(crate) fn prepare_home_dir(home_path: Option<PathBuf>) -> Result<PathBuf, Er
102102
/// Prepare wallet database directory.
103103
#[allow(dead_code)]
104104
pub(crate) fn prepare_wallet_db_dir(
105-
wallet_name: &Option<String>,
106105
home_path: &Path,
107106
wallet_opts: &mut WalletOpts,
108107
) -> Result<std::path::PathBuf, Error> {
109108
let mut dir = home_path.to_owned();
109+
let wallet_name = wallet_opts.wallet.clone();
110110
if let Some(wallet_name) = wallet_name {
111-
dir.push(wallet_name);
111+
dir.push(&wallet_name);
112112

113113
if !dir.exists() {
114114
std::fs::create_dir(&dir).map_err(|e| Error::Generic(e.to_string()))?;
115115
}
116-
wallet_opts.load_config(wallet_name, home_path)?;
116+
wallet_opts.load_config(wallet_name.as_str(), home_path)?;
117117
}
118118

119119
Ok(dir)

0 commit comments

Comments
 (0)