diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index 5c26fa1ab70fe..047df48fd4c7d 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -763,7 +763,7 @@ bool CWalletDBWrapper::Backup(const std::string& strDest) env->mapFileUseCount.erase(strFile); // Copy wallet file - fs::path pathSrc = GetWalletDir() / strFile; + fs::path pathSrc = env->Directory() / strFile; fs::path pathDest(strDest); if (fs::is_directory(pathDest)) pathDest /= strFile; diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py index 52a0abc4a2aff..304c0a8d5bb6c 100755 --- a/test/functional/wallet_multiwallet.py +++ b/test/functional/wallet_multiwallet.py @@ -28,6 +28,11 @@ def run_test(self): wallet_dir = lambda *p: data_dir('wallets', *p) wallet = lambda name: node.get_wallet_rpc(name) + def wallet_file(name): + if os.path.isdir(wallet_dir(name)): + return wallet_dir(name, "wallet.dat") + return wallet_dir(name) + # check wallet.dat is created self.stop_nodes() assert_equal(os.path.isfile(wallet_dir('wallet.dat')), True) @@ -57,10 +62,7 @@ def run_test(self): # check that all requested wallets were created self.stop_node(0) for wallet_name in wallet_names: - if os.path.isdir(wallet_dir(wallet_name)): - assert_equal(os.path.isfile(wallet_dir(wallet_name, "wallet.dat")), True) - else: - assert_equal(os.path.isfile(wallet_dir(wallet_name)), True) + assert_equal(os.path.isfile(wallet_file(wallet_name)), True) # should not initialize if wallet path can't be created self.assert_start_raises_init_error(0, ['-wallet=wallet.dat/bad'], 'Not a directory') @@ -159,5 +161,6 @@ def run_test(self): assert_equal(batch[0]["result"]["chain"], "regtest") #assert_equal(batch[1]["result"]["walletname"], "w1") + if __name__ == '__main__': MultiWalletTest().main()