Merge #224: Windows watchonly wallet path workaround

48e4909e7ad83c21f788802953327f8041a69b7d daemon: store the watchonly wallet file in bitcoind's datadir on Windows (Antoine Poinsot)

Pull request description:

  Turns out that providing an absolute path to bitcoind when loading a wallet on Windows results in surprising behaviour.

ACKs for top commit:
  edouardparis:
    ACK 48e4909e7ad83c21f788802953327f8041a69b7d

Tree-SHA512: b432460d529cf5b879361452af1e7947ec877c293f8a8a2e1740975a2957c0cdb288d1f9a1fa07e56193c7c65edf1f985d9e24dd3412f2bfc10922df239de766
This commit is contained in:
Antoine Poinsot 2022-12-15 19:16:27 +01:00
commit 3ac9f39aa1
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