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)
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
extern unsigned int nWalletDBUpdated;
extern DbEnv dbenv;
-
-extern void RemoveLogFilesOnShutdown(bool fRemoveLogFiles);
extern void DBFlush(bool fShutdown);
void ThreadFlushWalletDB(void* parg);
bool BackupWallet(const CWallet& wallet, const std::string& strDest);
// Need to completely rewrite the wallet file; if we don't, bdb might keep
// bits of the unencrypted private key in slack space in the database file.
- if (CDB::Rewrite(strWalletFile))
- RemoveLogFilesOnShutdown(true);
+ CDB::Rewrite(strWalletFile);
}
return true;
{
if (CDB::Rewrite(strWalletFile, "\x04pool"))
{
- RemoveLogFilesOnShutdown(true);
setKeyPool.clear();
// Note: can't top-up keypool here, because wallet is locked.
// User will be prompted to unlock wallet the next operation