[wallet] setup wallet background flushing in WalletInit directly

WalletInit::Start calls postInitProcess() for each wallet. Previously
each call to postInitProcess() would attempt to schedule wallet
background flushing.

Just start wallet background flushing once from WalletInit::Start().
This commit is contained in:
John Newbery
2018-04-19 17:42:40 -04:00
parent 59b87a27ef
commit 470316c3bf
3 changed files with 7 additions and 13 deletions

View File

@@ -6,6 +6,7 @@
#include <chainparams.h>
#include <init.h>
#include <net.h>
#include <scheduler.h>
#include <util.h>
#include <utilmoneystr.h>
#include <validation.h>
@@ -264,8 +265,11 @@ bool WalletInit::Open() const
void WalletInit::Start(CScheduler& scheduler) const
{
for (CWallet* pwallet : GetWallets()) {
pwallet->postInitProcess(scheduler);
pwallet->postInitProcess();
}
// Run a thread to flush wallet periodically
scheduler.scheduleEvery(MaybeCompactWalletDB, 500);
}
void WalletInit::Flush() const