Skip to content

Commit

Permalink
stop creating the all-zeroes dir on KDF start
Browse files Browse the repository at this point in the history
  • Loading branch information
shamardy committed Sep 13, 2024
1 parent d1a8ea7 commit f604ccb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions mm2src/mm2_core/src/mm_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,13 @@ impl MmCtx {
})
}

/// Returns the path to the MM databases root.
#[cfg(not(target_arch = "wasm32"))]
pub fn db_root(&self) -> PathBuf { path_to_db_root(self.conf["dbdir"].as_str()) }

#[cfg(not(target_arch = "wasm32"))]
pub fn wallet_file_path(&self, wallet_name: &str) -> PathBuf {
let db_root = path_to_db_root(self.conf["dbdir"].as_str());
db_root.join(wallet_name.to_string() + ".dat")
self.db_root().join(wallet_name.to_string() + ".dat")
}

/// MM database path.
Expand Down
4 changes: 3 additions & 1 deletion mm2src/mm2_main/src/lp_native_dex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,11 @@ pub async fn lp_init_continue(ctx: MmArc) -> MmInitResult<()> {
pub async fn lp_init(ctx: MmArc, version: String, datetime: String) -> MmInitResult<()> {
info!("Version: {} DT {}", version, datetime);

// Ensure the database root directory exists before initializing the wallet passphrase.
// This is necessary to store the encrypted wallet passphrase if needed.
#[cfg(not(target_arch = "wasm32"))]
{
let dbdir = ctx.dbdir();
let dbdir = ctx.db_root();
fs::create_dir_all(&dbdir).map_to_mm(|e| MmInitError::ErrorCreatingDbDir {
path: dbdir.clone(),
error: e.to_string(),
Expand Down

0 comments on commit f604ccb

Please sign in to comment.