Move wallet initialization logic from AppInit2 to CWallet::InitLoadWallet

This commit is contained in:
Patrick Strateman 2016-08-19 15:50:48 -07:00
parent e86eb71604
commit 8680d3aa80
2 changed files with 10 additions and 12 deletions

View file

@ -1438,15 +1438,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
//// debug print //// debug print
LogPrintf("mapBlockIndex.size() = %u\n", mapBlockIndex.size()); LogPrintf("mapBlockIndex.size() = %u\n", mapBlockIndex.size());
LogPrintf("nBestHeight = %d\n", chainActive.Height()); LogPrintf("nBestHeight = %d\n", chainActive.Height());
#ifdef ENABLE_WALLET
if (pwalletMain) {
LOCK(pwalletMain->cs_wallet);
LogPrintf("setKeyPool.size() = %u\n", pwalletMain->GetKeyPoolSize());
LogPrintf("mapWallet.size() = %u\n", pwalletMain->mapWallet.size());
LogPrintf("mapAddressBook.size() = %u\n", pwalletMain->mapAddressBook.size());
}
#endif
if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION)) if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION))
StartTorControl(threadGroup, scheduler); StartTorControl(threadGroup, scheduler);
@ -1459,9 +1450,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
if (pwalletMain) { if (pwalletMain) {
// Add wallet transactions that aren't already in a block to mapTransactions
pwalletMain->ReacceptWalletTransactions();
// Run a thread to flush wallet periodically // Run a thread to flush wallet periodically
threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(pwalletMain->strWalletFile))); threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(pwalletMain->strWalletFile)));
} }

View file

@ -3411,7 +3411,17 @@ bool CWallet::InitLoadWallet()
} }
walletInstance->SetBroadcastTransactions(GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST)); walletInstance->SetBroadcastTransactions(GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST));
{
LOCK(walletInstance->cs_wallet);
LogPrintf("setKeyPool.size() = %u\n", walletInstance->GetKeyPoolSize());
LogPrintf("mapWallet.size() = %u\n", walletInstance->mapWallet.size());
LogPrintf("mapAddressBook.size() = %u\n", walletInstance->mapAddressBook.size());
}
// Add wallet transactions that aren't already in a block to mapTransactions
walletInstance->ReacceptWalletTransactions();
pwalletMain = walletInstance; pwalletMain = walletInstance;
return true; return true;
} }