From 0235be1e7aa84ceb2c882c33fc279d4593e14968 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 23 Jan 2017 09:27:59 -0500 Subject: [PATCH] Rename FlushWalletDB -> CompactWalletDB, add function description --- src/wallet/wallet.cpp | 2 +- src/wallet/walletdb.cpp | 2 +- src/wallet/walletdb.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 88dbb77ab..04d5ea6ef 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3765,7 +3765,7 @@ void CWallet::postInitProcess(CScheduler& scheduler) // Run a thread to flush wallet periodically if (!CWallet::fFlushScheduled.exchange(true)) { - scheduler.scheduleEvery(MaybeFlushWalletDB, 500); + scheduler.scheduleEvery(MaybeCompactWalletDB, 500); } } diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index ae95fc4f2..5ba9f150a 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -777,7 +777,7 @@ DBErrors CWalletDB::ZapWalletTx(vector& vWtx) return DB_LOAD_OK; } -void MaybeFlushWalletDB() +void MaybeCompactWalletDB() { static std::atomic fOneThread; if (fOneThread.exchange(true)) { diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h index 85364c134..2e9899acc 100644 --- a/src/wallet/walletdb.h +++ b/src/wallet/walletdb.h @@ -193,6 +193,7 @@ private: void operator=(const CWalletDB&); }; -void MaybeFlushWalletDB(); +//! Compacts BDB state so that wallet.dat is self-contained (if there are changes) +void MaybeCompactWalletDB(); #endif // BITCOIN_WALLET_WALLETDB_H