diff options
| author | Jeff Garzik <[email protected]> | 2013-10-01 16:18:50 -0400 |
|---|---|---|
| committer | Jeff Garzik <[email protected]> | 2013-10-01 16:18:50 -0400 |
| commit | 19e5ae7369de8ff556b2ea008850a62b1fde9a1b (patch) | |
| tree | 4b712da1581c88940fd7fcf1a4dc184419eec792 /src/init.cpp | |
| parent | Merge pull request #2991 from Diapolo/translation_fixes (diff) | |
| parent | Support absence of wallet (pwalletMain==NULL) in several locations, (diff) | |
| download | discoin-19e5ae7369de8ff556b2ea008850a62b1fde9a1b.tar.xz discoin-19e5ae7369de8ff556b2ea008850a62b1fde9a1b.zip | |
Merge branch 'pwalletmain' - checking pwalletMain for NULL,
a pre-req for no-wallet support.
Diffstat (limited to 'src/init.cpp')
| -rw-r--r-- | src/init.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/init.cpp b/src/init.cpp index d8d1a55fc..1f6826413 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -108,7 +108,8 @@ void Shutdown() nTransactionsUpdated++; StopRPCThreads(); ShutdownRPCMining(); - bitdb.Flush(false); + if (pwalletMain) + bitdb.Flush(false); GenerateBitcoins(false, NULL); StopNode(); { @@ -123,10 +124,12 @@ void Shutdown() delete pcoinsdbview; pcoinsdbview = NULL; delete pblocktree; pblocktree = NULL; } - bitdb.Flush(true); + if (pwalletMain) + bitdb.Flush(true); boost::filesystem::remove(GetPidFile()); UnregisterAllWallets(); - delete pwalletMain; + if (pwalletMain) + delete pwalletMain; } // @@ -981,9 +984,9 @@ bool AppInit2(boost::thread_group& threadGroup) //// debug print LogPrintf("mapBlockIndex.size() = %"PRIszu"\n", mapBlockIndex.size()); LogPrintf("nBestHeight = %d\n", nBestHeight); - LogPrintf("setKeyPool.size() = %"PRIszu"\n", pwalletMain->setKeyPool.size()); - LogPrintf("mapWallet.size() = %"PRIszu"\n", pwalletMain->mapWallet.size()); - LogPrintf("mapAddressBook.size() = %"PRIszu"\n", pwalletMain->mapAddressBook.size()); + LogPrintf("setKeyPool.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0); + LogPrintf("mapWallet.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapWallet.size() : 0); + LogPrintf("mapAddressBook.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0); StartNode(threadGroup); @@ -993,17 +996,20 @@ bool AppInit2(boost::thread_group& threadGroup) StartRPCThreads(); // Generate coins in the background - GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain); + if (pwalletMain) + GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain); // ********************************************************* Step 12: finished uiInterface.InitMessage(_("Done loading")); - // Add wallet transactions that aren't already in a block to mapTransactions - pwalletMain->ReacceptWalletTransactions(); + if (pwalletMain) { + // Add wallet transactions that aren't already in a block to mapTransactions + pwalletMain->ReacceptWalletTransactions(); - // Run a thread to flush wallet periodically - threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(pwalletMain->strWalletFile))); + // Run a thread to flush wallet periodically + threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(pwalletMain->strWalletFile))); + } return !fRequestShutdown; } |