daemon: store the watchonly wallet file in bitcoind's datadir on Windows

This commit is contained in:
Antoine Poinsot 2022-12-14 10:36:41 +01:00
parent 89d2e67625
commit 48e4909e7a
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -188,10 +188,17 @@ fn setup_bitcoind(
data_dir: &path::Path,
fresh_data_dir: bool,
) -> Result<BitcoinD, StartupError> {
// Now set up the bitcoind interface
// NOTE: this is a hack! We normally store the watchonly wallet within our data directory.
// But on windows bitcoind would prefix the wallet path with "C:\\\\?" when calling
// 'loadwallet'. Therefore instead on Windows store the wallet.dat in bitcoind's data directory
// instead by not providing an absolute path but the name of a wallet.
#[cfg(not(windows))]
let wo_path: path::PathBuf = [data_dir, path::Path::new("lianad_watchonly_wallet")]
.iter()
.collect();
#[cfg(windows)]
let wo_path = path::Path::new("lianad_watchonly_wallet");
let bitcoind = BitcoinD::new(
config
.bitcoind_config