diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2011-11-17 14:21:32 -0500 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2011-11-17 14:29:18 -0500 |
commit | c4a3bf9e552f25a5ad0efb8cf62d344a7dad53ed (patch) | |
tree | aafa2dc7d55650358dd822825dfcc7a2ac415023 /src/db.cpp | |
parent | 90de05e88ecc879b75315eebacb488b44353f5d9 (diff) | |
download | bitcoin-c4a3bf9e552f25a5ad0efb8cf62d344a7dad53ed.tar.xz |
Only remove database log files on shutdown after wallet encryption/rewrite
Diffstat (limited to 'src/db.cpp')
-rw-r--r-- | src/db.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/db.cpp b/src/db.cpp index b48be7ab75..77000ab00e 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -28,7 +28,12 @@ DbEnv dbenv(0); static map<string, int> mapFileUseCount; static map<string, Db*> mapDb; -static void EnvShutdown(bool fRemoveLogFiles) +static bool fRemoveLogFiles = false; +void RemoveLogFilesOnShutdown(bool fIn) +{ + fRemoveLogFiles = fIn; +} +static void EnvShutdown() { if (!fDbEnvInit) return; @@ -71,7 +76,7 @@ public: } ~CDBInit() { - EnvShutdown(false); + EnvShutdown(); } } instance_of_cdbinit; @@ -289,7 +294,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) } -void DBFlush(bool fShutdown, bool fRemoveLogFiles) +void DBFlush(bool fShutdown) { // Flush log data to the actual data file // on all files that are not in use @@ -322,7 +327,7 @@ void DBFlush(bool fShutdown, bool fRemoveLogFiles) if (mapFileUseCount.empty()) { dbenv.log_archive(&listp, DB_ARCH_REMOVE); - EnvShutdown(fRemoveLogFiles); + EnvShutdown(); } } } |