Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wallet] Reopen CDBEnv after encryption instead of shutting down #12493

Merged
merged 4 commits into from Sep 14, 2018
Merged
Diff settings

Always

Just for now

@@ -697,7 +697,6 @@ void BerkeleyEnvironment::Flush(bool fShutdown)
if (!fMockDb) {
fs::remove_all(fs::path(strPath) / "database");
}
g_dbenvs.erase(strPath);

This comment has been minimized.

Copy link
@ryanofsky

ryanofsky Sep 14, 2018

Contributor

In commit "Move BerkeleyEnvironment deletion from internal method to callsite" (a769461)

@achow101 do remember if this change was this done for specific reason? It seems like an odd thing to include here.

This comment has been minimized.

Copy link
@achow101

achow101 Sep 14, 2018

Author Member

IIRC there are two reasons for this. The first was that we needed this in the next commit to avoid having a destroyed db environment because we want to reopen it. The second reason that I don't think it is good for an object to destroy its own references as that's what it does here.

}
}
}
@@ -796,6 +795,10 @@ 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;
}
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.