diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 13fdbb5ecd0ef..cee21970c4cb7 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -122,7 +122,7 @@ bool WalletModel::upgradeWallet(std::string& upgradeError) QString WalletModel::getWalletPath() { - return QString::fromStdString(GetDataDir().string() + QDir::separator().toLatin1() + wallet->GetName()); + return QString::fromStdString(wallet->GetPathToDBFile().string()); } CAmount WalletModel::getBalance(const CCoinControl* coinControl, bool fIncludeDelegated, bool fUnlockedOnly, bool fIncludeShielded) const diff --git a/src/wallet/db.h b/src/wallet/db.h index 64445f4fd3ba3..d553e9b846967 100644 --- a/src/wallet/db.h +++ b/src/wallet/db.h @@ -153,7 +153,7 @@ class CWalletDBWrapper unsigned int nLastSeen; unsigned int nLastFlushed; int64_t nLastWalletUpdate; - unsigned int GetUpdateCounter(); + fs::path GetPathToFile() { return env->Directory() / strFile; } private: /** BerkeleyDB specific */ diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 6293a8475b58e..9ebc998ed09c0 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -744,6 +744,9 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface */ const std::string& GetName() const { return m_name; } + /** Get the path to the wallet's db file */ + fs::path GetPathToDBFile() { return dbw->GetPathToFile(); } + /** Construct wallet with specified name and database implementation. */ CWallet(std::string name, std::unique_ptr dbw_in); ~CWallet();