Have WalletBatch automatically flush every 1000 updates

Since it now automatically flushes, we don't need to have
UpgradeKeyMetadata count and flush separately
This commit is contained in:
Andrew Chow
2019-04-05 15:11:47 -04:00
parent 366fe0be0b
commit d6576e349e
3 changed files with 14 additions and 9 deletions

View File

@@ -614,7 +614,9 @@ void BerkeleyBatch::Flush()
if (fReadOnly)
nMinutes = 1;
env->dbenv->txn_checkpoint(nMinutes ? gArgs.GetArg("-dblogsize", DEFAULT_WALLET_DBLOGSIZE) * 1024 : 0, nMinutes, 0);
if (env) { // env is nullptr for dummy databases (i.e. in tests). Don't actually flush if env is nullptr so we don't segfault
env->dbenv->txn_checkpoint(nMinutes ? gArgs.GetArg("-dblogsize", DEFAULT_WALLET_DBLOGSIZE) * 1024 : 0, nMinutes, 0);
}
}
void BerkeleyDatabase::IncrementUpdateCounter()