aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/bdb.h
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2020-06-15 17:59:24 -0400
committerAndrew Chow <achow101-github@achow101.com>2020-07-14 11:07:16 -0400
commit27b27663849932971eb5deadb1f19234b9cd97ea (patch)
treef8fa0655e170c4c2b1edbc7eaa440cdc101295a7 /src/wallet/bdb.h
parent834ac4c0f50c0795b55f5586ecc4b1db251be58d (diff)
downloadbitcoin-27b27663849932971eb5deadb1f19234b9cd97ea.tar.xz
walletdb: Move BerkeleyDatabase::Flush(true) to Close()
Instead of having Flush optionally shutdown the database and environment, add a Close() function that does that.
Diffstat (limited to 'src/wallet/bdb.h')
-rw-r--r--src/wallet/bdb.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/wallet/bdb.h b/src/wallet/bdb.h
index e54776fc0d..52cd9d92df 100644
--- a/src/wallet/bdb.h
+++ b/src/wallet/bdb.h
@@ -115,12 +115,7 @@ public:
assert(inserted.second);
}
- ~BerkeleyDatabase() {
- if (env) {
- size_t erased = env->m_databases.erase(strFile);
- assert(erased == 1);
- }
- }
+ ~BerkeleyDatabase();
/** Rewrite the entire database on disk, with the exception of key pszSkip if non-zero
*/
@@ -130,9 +125,13 @@ public:
*/
bool Backup(const std::string& strDest) const;
- /** Make sure all changes are flushed to disk.
+ /** Make sure all changes are flushed to database file.
+ */
+ void Flush();
+ /** Flush to the database file and close the database.
+ * Also close the environment if no other databases are open in it.
*/
- void Flush(bool shutdown);
+ void Close();
/* flush the wallet passively (TRY_LOCK)
ideal to be called periodically */
bool PeriodicFlush();