mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Support absence of wallet (pwalletMain==NULL) in several locations,
notably RPC.
This commit is contained in:
28
src/init.cpp
28
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user