aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wallet/db.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp
index 679cb200b7..2d57c92ccc 100644
--- a/src/wallet/db.cpp
+++ b/src/wallet/db.cpp
@@ -724,7 +724,6 @@ void BerkeleyEnvironment::Flush(bool fShutdown)
if (!fMockDb) {
fs::remove_all(fs::path(strPath) / "database");
}
- g_dbenvs.erase(strPath);
}
}
}
@@ -823,7 +822,11 @@ void BerkeleyDatabase::Flush(bool shutdown)
{
if (!IsDummy()) {
env->Flush(shutdown);
- if (shutdown) env = nullptr;
+ if (shutdown) {
+ LOCK(cs_db);
+ g_dbenvs.erase(env->Directory().string());
+ env = nullptr;
+ }
}
}