Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show All 12 Lines | |||||
#include "dstencode.h" | #include "dstencode.h" | ||||
#include "fs.h" | #include "fs.h" | ||||
#include "key.h" | #include "key.h" | ||||
#include "keystore.h" | #include "keystore.h" | ||||
#include "net.h" | #include "net.h" | ||||
#include "policy/policy.h" | #include "policy/policy.h" | ||||
#include "primitives/block.h" | #include "primitives/block.h" | ||||
#include "primitives/transaction.h" | #include "primitives/transaction.h" | ||||
#include "scheduler.h" | |||||
#include "script/script.h" | #include "script/script.h" | ||||
#include "script/sighashtype.h" | #include "script/sighashtype.h" | ||||
#include "script/sign.h" | #include "script/sign.h" | ||||
#include "timedata.h" | #include "timedata.h" | ||||
#include "txmempool.h" | #include "txmempool.h" | ||||
#include "ui_interface.h" | #include "ui_interface.h" | ||||
#include "util.h" | #include "util.h" | ||||
#include "utilmoneystr.h" | #include "utilmoneystr.h" | ||||
▲ Show 20 Lines • Show All 4,166 Lines • ▼ Show 20 Lines | if (!pwallet) { | ||||
return false; | return false; | ||||
} | } | ||||
pwalletMain = pwallet; | pwalletMain = pwallet; | ||||
return true; | return true; | ||||
} | } | ||||
std::atomic<bool> CWallet::fFlushThreadRunning(false); | std::atomic<bool> CWallet::fFlushScheduled(false); | ||||
void CWallet::postInitProcess(boost::thread_group &threadGroup) { | void CWallet::postInitProcess(CScheduler &scheduler) { | ||||
// Add wallet transactions that aren't already in a block to mempool. | // Add wallet transactions that aren't already in a block to mempool. | ||||
// Do this here as mempool requires genesis block to be loaded. | // Do this here as mempool requires genesis block to be loaded. | ||||
ReacceptWalletTransactions(); | ReacceptWalletTransactions(); | ||||
// Run a thread to flush wallet periodically. | // Run a thread to flush wallet periodically. | ||||
if (!CWallet::fFlushThreadRunning.exchange(true)) { | if (!CWallet::fFlushScheduled.exchange(true)) { | ||||
threadGroup.create_thread(ThreadFlushWalletDB); | scheduler.scheduleEvery(MaybeCompactWalletDB, 500); | ||||
} | } | ||||
} | } | ||||
bool CWallet::ParameterInteraction() { | bool CWallet::ParameterInteraction() { | ||||
if (GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) { | if (GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) { | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 241 Lines • Show Last 20 Lines |