Skip to content

Commit 5912031

Browse files
committed
wallet: Create IsDatabaseLoaded function
1 parent 15c93f0 commit 5912031

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/wallet/db.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ bool IsWalletLoaded(const fs::path& wallet_path)
8080
LOCK(cs_db);
8181
auto env = g_dbenvs.find(env_directory.string());
8282
if (env == g_dbenvs.end()) return false;
83-
auto db = env->second.m_databases.find(database_filename);
84-
return db != env->second.m_databases.end();
83+
return env->second.IsDatabaseLoaded(database_filename);
8584
}
8685

8786
BerkeleyEnvironment* GetWalletEnv(const fs::path& wallet_path, std::string& database_filename)

src/wallet/db.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class BerkeleyEnvironment
5656
void MakeMock();
5757
bool IsMock() const { return fMockDb; }
5858
bool IsInitialized() const { return fDbEnvInit; }
59+
bool IsDatabaseLoaded(const std::string& db_filename) const { return m_databases.find(db_filename) != m_databases.end(); }
5960
fs::path Directory() const { return strPath; }
6061

6162
/**

0 commit comments

Comments
 (0)