aboutsummaryrefslogtreecommitdiff
path: root/src/db.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/db.cpp')
-rw-r--r--src/db.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/db.cpp b/src/db.cpp
index 670f0a876c..5bd0528202 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -28,6 +28,7 @@ unsigned int nWalletDBUpdated;
CCriticalSection cs_db;
static bool fDbEnvInit = false;
+bool fDetachDB = false;
DbEnv dbenv(0);
map<string, int> mapFileUseCount;
static map<string, Db*> mapDb;
@@ -307,9 +308,13 @@ void DBFlush(bool fShutdown)
{
// Move log data to the dat file
CloseDb(strFile);
+ printf("%s checkpoint\n", strFile.c_str());
dbenv.txn_checkpoint(0, 0, 0);
- printf("%s flush\n", strFile.c_str());
- dbenv.lsn_reset(strFile.c_str(), 0);
+ if ((strFile != "blkindex.dat" && strFile != "addr.dat") || fDetachDB) {
+ printf("%s detach\n", strFile.c_str());
+ dbenv.lsn_reset(strFile.c_str(), 0);
+ }
+ printf("%s closed\n", strFile.c_str());
mapFileUseCount.erase(mi++);
}
else
@@ -648,7 +653,7 @@ bool CTxDB::LoadBlockIndex()
}
}
// check level 4: check whether spent txouts were spent within the main chain
- int nOutput = 0;
+ unsigned int nOutput = 0;
if (nCheckLevel>3)
{
BOOST_FOREACH(const CDiskTxPos &txpos, txindex.vSpent)