Never remove database files on shutdown, it caused unreadable wallets on some testers' machines.

This commit is contained in:
Gavin Andresen
2011-11-20 10:39:01 -05:00
parent 1c15f88653
commit b2d3b2d65d
3 changed files with 1 additions and 28 deletions

View File

@@ -28,11 +28,6 @@ DbEnv dbenv(0);
static map<string, int> mapFileUseCount;
static map<string, Db*> mapDb;
static bool fRemoveLogFiles = false;
void RemoveLogFilesOnShutdown(bool fIn)
{
fRemoveLogFiles = fIn;
}
static void EnvShutdown()
{
if (!fDbEnvInit)
@@ -48,24 +43,6 @@ static void EnvShutdown()
printf("EnvShutdown exception: %s (%d)\n", e.what(), e.get_errno());
}
DbEnv(0).remove(GetDataDir().c_str(), 0);
if (fRemoveLogFiles)
{
filesystem::path datadir(GetDataDir());
filesystem::directory_iterator it(datadir / "database");
while (it != filesystem::directory_iterator())
{
const filesystem::path& p = it->path();
#if BOOST_FILESYSTEM_VERSION >= 3
std::string f = p.filename().generic_string();
#else
std::string f = p.filename();
#endif
if (f.find("log.") == 0)
filesystem::remove(p);
++it;
}
}
}
class CDBInit