wallet: Fix backupwallet for multiwallets

backupwallet was broken for multiwallets in their own directories
(i.e. something like DATADIR/wallets/mywallet/wallet.dat).  In this
case, the backup would use DATADIR/wallets/wallet.dat as source file
and not take the specific wallet's directory into account.

This led to either an error during the backup (if the wrong source
file was not present) or would silently back up the wrong wallet;
especially the latter behaviour can be quite bad for users.
This commit is contained in:
Daniel Kraft
2018-07-15 11:17:50 +02:00
parent 8803c9132a
commit a1a998cf24
2 changed files with 33 additions and 5 deletions

View File

@@ -768,7 +768,7 @@ bool BerkeleyDatabase::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;