From fa7b164d62d9f12e9cda79bf28bf435acf2d1e38 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 11 May 2020 17:49:05 +0200 Subject: [PATCH] wallet: Never schedule MaybeCompactWalletDB when -flushwallet is off --- src/wallet/load.cpp | 5 ++++- src/wallet/walletdb.cpp | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wallet/load.cpp b/src/wallet/load.cpp index 66fc98eaaf..c2818a41e7 100644 --- a/src/wallet/load.cpp +++ b/src/wallet/load.cpp @@ -11,6 +11,7 @@ #include #include #include +#include bool VerifyWallets(interfaces::Chain& chain, const std::vector& wallet_files) { @@ -89,7 +90,9 @@ void StartWallets(CScheduler& scheduler, const ArgsManager& args) } // Schedule periodic wallet flushes and tx rebroadcasts - scheduler.scheduleEvery(MaybeCompactWalletDB, std::chrono::milliseconds{500}); + if (args.GetBoolArg("-flushwallet", DEFAULT_FLUSHWALLET)) { + scheduler.scheduleEvery(MaybeCompactWalletDB, std::chrono::milliseconds{500}); + } scheduler.scheduleEvery(MaybeResendWalletTxs, std::chrono::milliseconds{1000}); } diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index 7da477d5b7..98ccc3198a 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -952,9 +952,6 @@ void MaybeCompactWalletDB() if (fOneThread.exchange(true)) { return; } - if (!gArgs.GetBoolArg("-flushwallet", DEFAULT_FLUSHWALLET)) { - return; - } for (const std::shared_ptr& pwallet : GetWallets()) { WalletDatabase& dbh = pwallet->GetDBHandle();