@@ -28,7 +28,6 @@ static bool fDbEnvInit = false;
28
28
DbEnv dbenv (0 );
29
29
static map<string, int > mapFileUseCount;
30
30
static map<string, Db*> mapDb;
31
- static int64 nTxn = 0 ;
32
31
33
32
static void EnvShutdown ()
34
33
{
@@ -164,13 +163,7 @@ void CDB::Close()
164
163
if (strFile == " blkindex.dat" && IsInitialBlockDownload ())
165
164
nMinutes = 5 ;
166
165
167
- if (nMinutes == 0 || nTxn > 200000 )
168
- {
169
- nTxn = 0 ;
170
- nMinutes = 0 ;
171
- }
172
-
173
- dbenv.txn_checkpoint (0 , nMinutes, 0 );
166
+ dbenv.txn_checkpoint (nMinutes ? GetArg (" -dblogsize" , 100 )*1024 : 0 , nMinutes, 0 );
174
167
175
168
CRITICAL_BLOCK (cs_db)
176
169
--mapFileUseCount[strFile];
@@ -344,7 +337,6 @@ bool CTxDB::ReadTxIndex(uint256 hash, CTxIndex& txindex)
344
337
bool CTxDB::UpdateTxIndex (uint256 hash, const CTxIndex& txindex)
345
338
{
346
339
assert (!fClient );
347
- nTxn++;
348
340
return Write (make_pair (string (" tx" ), hash), txindex);
349
341
}
350
342
@@ -355,7 +347,6 @@ bool CTxDB::AddTxIndex(const CTransaction& tx, const CDiskTxPos& pos, int nHeigh
355
347
// Add to tx index
356
348
uint256 hash = tx.GetHash ();
357
349
CTxIndex txindex (pos, tx.vout .size ());
358
- nTxn++;
359
350
return Write (make_pair (string (" tx" ), hash), txindex);
360
351
}
361
352
0 commit comments