Skip to content
Permalink
Browse files

Merge #8977: [Wallet] Refactor wallet/init interaction (Reaccept wtx,…

… flush thread)

cab1da7 [Wallet] Refactor wallet/init interaction (Reaccept wtx, flush thread) (Jonas Schnelli)
  • Loading branch information...
laanwj committed Nov 2, 2016
2 parents c05db83 + cab1da7 commit 6a1343f73bd0f6744cfcfda1e3e1c8998f67e2d7
Showing with 19 additions and 11 deletions.
  1. +2 −11 src/init.cpp
  2. +10 −0 src/wallet/wallet.cpp
  3. +7 −0 src/wallet/wallet.h
@@ -1496,13 +1496,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
uiInterface.NotifyBlockTip.disconnect(BlockNotifyGenesisWait);
}

#ifdef ENABLE_WALLET
// Add wallet transactions that aren't already in a block to mempool
// Do this here as mempool requires genesis block to be loaded
if (pwalletMain)
pwalletMain->ReacceptWalletTransactions();
#endif

// ********************************************************* Step 11: start node

//// debug print
@@ -1540,10 +1533,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
uiInterface.InitMessage(_("Done loading"));

#ifdef ENABLE_WALLET
if (pwalletMain) {
// Run a thread to flush wallet periodically
threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(pwalletMain->strWalletFile)));
}
if (pwalletMain)
pwalletMain->postInitProcess(threadGroup);
#endif

return !fRequestShutdown;
@@ -3549,6 +3549,16 @@ bool CWallet::InitLoadWallet()
return true;
}

void CWallet::postInitProcess(boost::thread_group& threadGroup)
{
// Add wallet transactions that aren't already in a block to mempool
// Do this here as mempool requires genesis block to be loaded
ReacceptWalletTransactions();

// Run a thread to flush wallet periodically
threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(this->strWalletFile)));
}

bool CWallet::ParameterInteraction()
{
if (GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET))
@@ -27,6 +27,7 @@
#include <vector>

#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>

extern CWallet* pwalletMain;

@@ -912,6 +913,12 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
/* Initializes the wallet, returns a new CWallet instance or a null pointer in case of an error */
static bool InitLoadWallet();

/**
* Wallet post-init setup
* Gives the wallet a chance to register repetitive tasks and complete post-init tasks
*/
void postInitProcess(boost::thread_group& threadGroup);

/* Wallets parameter interaction */
static bool ParameterInteraction();

0 comments on commit 6a1343f

Please sign in to comment.
You can’t perform that action at this time.