From 00d1980b8fb8b834cb729b213834dfb38cb01bbf Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Fri, 27 Jun 2014 14:41:11 +0200 Subject: [PATCH] init.cpp: log fee estimates filename on error - small changes to Shutdown(), buffer __func__, which is now used in all LogPrintf() calls and format for better readability - order using namespace alpabetically --- src/init.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index f9e568a2..a1d75c96 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -38,8 +38,8 @@ #include #include -using namespace std; using namespace boost; +using namespace std; #ifdef ENABLE_WALLET CWallet* pwalletMain; @@ -109,10 +109,11 @@ static CCoinsViewDB *pcoinsdbview; void Shutdown() { - LogPrintf("Shutdown : In progress...\n"); + LogPrintf("%s: In progress...\n", __func__); static CCriticalSection cs_Shutdown; TRY_LOCK(cs_Shutdown, lockShutdown); - if (!lockShutdown) return; + if (!lockShutdown) + return; RenameThread("bitcoin-shutoff"); mempool.AddTransactionsUpdated(1); @@ -130,7 +131,7 @@ void Shutdown() if (est_fileout) mempool.WriteFeeEstimates(est_fileout); else - LogPrintf("failed to write fee estimates"); + LogPrintf("%s: Failed to write fee estimates to %s\n", __func__, est_path.string()); { LOCK(cs_main); @@ -142,9 +143,12 @@ void Shutdown() pblocktree->Flush(); if (pcoinsTip) pcoinsTip->Flush(); - delete pcoinsTip; pcoinsTip = NULL; - delete pcoinsdbview; pcoinsdbview = NULL; - delete pblocktree; pblocktree = NULL; + delete pcoinsTip; + pcoinsTip = NULL; + delete pcoinsdbview; + pcoinsdbview = NULL; + delete pblocktree; + pblocktree = NULL; } #ifdef ENABLE_WALLET if (pwalletMain) @@ -156,7 +160,7 @@ void Shutdown() if (pwalletMain) delete pwalletMain; #endif - LogPrintf("Shutdown : done\n"); + LogPrintf("%s: done\n", __func__); } // @@ -315,6 +319,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += "\n" + _("Node relay options:") + "\n"; strUsage += " -datacarrier " + _("Relay and mine data carrier transactions (default: 1)") + "\n"; + strUsage += "\n" + _("Block creation options:") + "\n"; strUsage += " -blockminsize= " + _("Set minimum block size in bytes (default: 0)") + "\n"; strUsage += " -blockmaxsize= " + strprintf(_("Set maximum block size in bytes (default: %d)"), DEFAULT_BLOCK_MAX_SIZE) + "\n"; @@ -564,9 +569,9 @@ bool AppInit2(boost::thread_group& threadGroup) if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), string("0")) != categories.end()) fDebug = false; - // Check for -debugnet (deprecated) + // Check for -debugnet if (GetBoolArg("-debugnet", false)) - InitWarning(_("Warning: Deprecated argument -debugnet ignored, use -debug=net")); + InitWarning(_("Warning: Unsupported argument -debugnet ignored, use -debug=net.")); // Check for -socks - as this is a privacy risk to continue, exit here if (mapArgs.count("-socks")) return InitError(_("Error: Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported.")); @@ -994,6 +999,7 @@ bool AppInit2(boost::thread_group& threadGroup) boost::filesystem::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; CAutoFile est_filein = CAutoFile(fopen(est_path.string().c_str(), "rb"), SER_DISK, CLIENT_VERSION); + // Allowed to fail as this file IS missing on first startup. if (est_filein) mempool.ReadFeeEstimates(est_filein);