From 2a41689231f208dea6d2ad907a6ed5c5ed5aaaf4 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Tue, 3 Mar 2026 11:31:32 +0300 Subject: [PATCH] fix: wallet data directory creation --- src/wallet/wallet.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/wallet/wallet.rs b/src/wallet/wallet.rs index 22c57fe..5976b30 100644 --- a/src/wallet/wallet.rs +++ b/src/wallet/wallet.rs @@ -165,8 +165,10 @@ impl Wallet { let config = WalletConfig::create(name.clone(), conn_method); let w = Wallet::new(config.clone()); { - // create directory if it doesn't exist - fs::create_dir_all(config.get_data_path()) + // Wallet directory setup. + let mut path = PathBuf::from(config.get_data_path()); + path.push(WalletConfig::DATA_DIR_NAME); + fs::create_dir_all(&path) .map_err(|_| Error::IO("Directory creation error".to_string()))?; // Create seed file. let _ = WalletSeed::init_file(config.seed_path().as_str(), @@ -175,13 +177,13 @@ impl Wallet { .map_err(|_| Error::IO("Seed file creation error".to_string()))?; let node_client = Self::create_node_client(&config)?; let mut wallet: LMDBBackend<'static, HTTPNodeClient, ExtKeychain> = - match LMDBBackend::new(config.get_data_path().as_str(), node_client) { + match LMDBBackend::new(path.to_str().unwrap(), node_client) { Err(_) => { return Err(Error::Lifecycle("DB creation error".to_string()).into()); } Ok(d) => d, }; - // Save init status of this wallet, to determine whether it needs a full UTXO scan + // Save init status of this wallet, to determine whether it needs a full UTXO scan. let mut batch = wallet.batch_no_mask()?; match mnemonic.mode() { PhraseMode::Generate => batch.save_init_status(WalletInitStatus::InitNoScanning)?,