From 48e4909e7ad83c21f788802953327f8041a69b7d Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Wed, 14 Dec 2022 10:36:41 +0100 Subject: [PATCH] daemon: store the watchonly wallet file in bitcoind's datadir on Windows --- src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index a12932f5..78d0d940 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -188,10 +188,17 @@ fn setup_bitcoind( data_dir: &path::Path, fresh_data_dir: bool, ) -> Result { - // 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