diff options
author | Chun Kuan Lee <ken2812221@gmail.com> | 2018-11-08 11:41:56 +0800 |
---|---|---|
committer | Chun Kuan Lee <ken2812221@gmail.com> | 2018-11-08 11:54:37 +0800 |
commit | 591203149f1700f594f781862e88cbbfe83d8d37 (patch) | |
tree | 58f2a5790dfe0261664395c76d050daef6d60f5e | |
parent | 15c93f075a881deb3ad7b1dd8a4516a9b06e5e11 (diff) | |
download | bitcoin-591203149f1700f594f781862e88cbbfe83d8d37.tar.xz |
wallet: Create IsDatabaseLoaded function
-rw-r--r-- | src/wallet/db.cpp | 3 | ||||
-rw-r--r-- | src/wallet/db.h | 1 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index bdd7b41b9d..d75e30d336 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -80,8 +80,7 @@ bool IsWalletLoaded(const fs::path& wallet_path) LOCK(cs_db); auto env = g_dbenvs.find(env_directory.string()); if (env == g_dbenvs.end()) return false; - auto db = env->second.m_databases.find(database_filename); - return db != env->second.m_databases.end(); + return env->second.IsDatabaseLoaded(database_filename); } BerkeleyEnvironment* GetWalletEnv(const fs::path& wallet_path, std::string& database_filename) diff --git a/src/wallet/db.h b/src/wallet/db.h index 9832094ccb..e453d441d7 100644 --- a/src/wallet/db.h +++ b/src/wallet/db.h @@ -56,6 +56,7 @@ public: void MakeMock(); bool IsMock() const { return fMockDb; } bool IsInitialized() const { return fDbEnvInit; } + bool IsDatabaseLoaded(const std::string& db_filename) const { return m_databases.find(db_filename) != m_databases.end(); } fs::path Directory() const { return strPath; } /** |