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
This commit is contained in:
Philip Kaufmann 2014-06-27 14:41:11 +02:00
parent 2ee918d121
commit 00d1980b8f

View File

@ -38,8 +38,8 @@
#include <boost/interprocess/sync/file_lock.hpp>
#include <openssl/crypto.h>
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=<n> " + _("Set minimum block size in bytes (default: 0)") + "\n";
strUsage += " -blockmaxsize=<n> " + 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);