diff --git a/gui/src/bitcoind.rs b/gui/src/bitcoind.rs index aba7cfb8..e3939740 100644 --- a/gui/src/bitcoind.rs +++ b/gui/src/bitcoind.rs @@ -1,9 +1,8 @@ use liana::{config::BitcoindConfig, miniscript::bitcoin}; +use std::path::Path; use tracing::{info, warn}; -use crate::app::config::InternalBitcoindExeConfig; - #[cfg(target_os = "windows")] use std::os::windows::process::CommandExt; @@ -51,10 +50,10 @@ impl std::fmt::Display for StartInternalBitcoindError { /// Start internal bitcoind for the given network. pub fn start_internal_bitcoind( network: &bitcoin::Network, - exe_config: InternalBitcoindExeConfig, + bitcoind_datadir: &Path, + exe_path: &Path, ) -> Result { - let datadir_path_str = exe_config - .data_dir + let datadir_path_str = bitcoind_datadir .canonicalize() .map_err(|e| StartInternalBitcoindError::CouldNotCanonicalizeDataDir(e.to_string()))? .to_str() @@ -71,7 +70,7 @@ pub fn start_internal_bitcoind( format!("-chain={}", network.to_core_arg()), format!("-datadir={}", datadir_path_str), ]; - let mut command = std::process::Command::new(exe_config.exe_path); + let mut command = std::process::Command::new(exe_path); #[cfg(target_os = "windows")] let command = command.creation_flags(CREATE_NO_WINDOW); command diff --git a/gui/src/installer/step/bitcoind.rs b/gui/src/installer/step/bitcoind.rs index 1320be7e..5fcacdf4 100644 --- a/gui/src/installer/step/bitcoind.rs +++ b/gui/src/installer/step/bitcoind.rs @@ -865,16 +865,19 @@ impl Step for InternalBitcoindStep { return Command::none(); } }; - let handle = - match start_internal_bitcoind(&self.network, exe_config.clone()) { - Err(e) => { - self.started = Some(Err( - StartInternalBitcoindError::CommandError(e.to_string()), - )); - return Command::none(); - } - Ok(h) => h, - }; + let handle = match start_internal_bitcoind( + &self.network, + &exe_config.data_dir, + &exe_config.exe_path, + ) { + Err(e) => { + self.started = Some(Err(StartInternalBitcoindError::CommandError( + e.to_string(), + ))); + return Command::none(); + } + Ok(h) => h, + }; // Need to wait for cookie file to appear. let cookie_path = internal_bitcoind_cookie_path(&self.bitcoind_datadir, &self.network); diff --git a/gui/src/loader.rs b/gui/src/loader.rs index 351274b9..85347e62 100644 --- a/gui/src/loader.rs +++ b/gui/src/loader.rs @@ -361,8 +361,12 @@ pub async fn start_bitcoind_and_daemon( info!("Internal bitcoind is already running"); } else { info!("Starting internal bitcoind"); - start_internal_bitcoind(&config.bitcoin_config.network, exe_config) - .map_err(Error::Bitcoind)?; + start_internal_bitcoind( + &config.bitcoin_config.network, + &exe_config.data_dir, + &exe_config.exe_path, + ) + .map_err(Error::Bitcoind)?; if !utils::poll_for_file(&bitcoind_config.cookie_path, 200, 15) { return Err(Error::Bitcoind( StartInternalBitcoindError::CookieFileNotFound(