wallet: Create IsDatabaseLoaded function

Github-Pull: #14552
Rebased-From: 5912031
This commit is contained in:
Chun Kuan Lee 2018-11-08 11:41:56 +08:00 committed by João Barbosa
parent 7751ea37b6
commit 0a9af2d4cb
2 changed files with 2 additions and 2 deletions

View file

@ -80,8 +80,7 @@ bool IsWalletLoaded(const fs::path& wallet_path)
LOCK(cs_db); LOCK(cs_db);
auto env = g_dbenvs.find(env_directory.string()); auto env = g_dbenvs.find(env_directory.string());
if (env == g_dbenvs.end()) return false; if (env == g_dbenvs.end()) return false;
auto db = env->second.m_databases.find(database_filename); return env->second.IsDatabaseLoaded(database_filename);
return db != env->second.m_databases.end();
} }
BerkeleyEnvironment* GetWalletEnv(const fs::path& wallet_path, std::string& database_filename) BerkeleyEnvironment* GetWalletEnv(const fs::path& wallet_path, std::string& database_filename)

View file

@ -56,6 +56,7 @@ public:
void MakeMock(); void MakeMock();
bool IsMock() const { return fMockDb; } bool IsMock() const { return fMockDb; }
bool IsInitialized() const { return fDbEnvInit; } 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; } fs::path Directory() const { return strPath; }
/** /**