Skip to content

Commit 00d1980

Browse files
author
Philip Kaufmann
committed
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
1 parent 2ee918d commit 00d1980

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/init.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
#include <boost/interprocess/sync/file_lock.hpp>
3939
#include <openssl/crypto.h>
4040

41-
using namespace std;
4241
using namespace boost;
42+
using namespace std;
4343

4444
#ifdef ENABLE_WALLET
4545
CWallet* pwalletMain;
@@ -109,10 +109,11 @@ static CCoinsViewDB *pcoinsdbview;
109109

110110
void Shutdown()
111111
{
112-
LogPrintf("Shutdown : In progress...\n");
112+
LogPrintf("%s: In progress...\n", __func__);
113113
static CCriticalSection cs_Shutdown;
114114
TRY_LOCK(cs_Shutdown, lockShutdown);
115-
if (!lockShutdown) return;
115+
if (!lockShutdown)
116+
return;
116117

117118
RenameThread("bitcoin-shutoff");
118119
mempool.AddTransactionsUpdated(1);
@@ -130,7 +131,7 @@ void Shutdown()
130131
if (est_fileout)
131132
mempool.WriteFeeEstimates(est_fileout);
132133
else
133-
LogPrintf("failed to write fee estimates");
134+
LogPrintf("%s: Failed to write fee estimates to %s\n", __func__, est_path.string());
134135

135136
{
136137
LOCK(cs_main);
@@ -142,9 +143,12 @@ void Shutdown()
142143
pblocktree->Flush();
143144
if (pcoinsTip)
144145
pcoinsTip->Flush();
145-
delete pcoinsTip; pcoinsTip = NULL;
146-
delete pcoinsdbview; pcoinsdbview = NULL;
147-
delete pblocktree; pblocktree = NULL;
146+
delete pcoinsTip;
147+
pcoinsTip = NULL;
148+
delete pcoinsdbview;
149+
pcoinsdbview = NULL;
150+
delete pblocktree;
151+
pblocktree = NULL;
148152
}
149153
#ifdef ENABLE_WALLET
150154
if (pwalletMain)
@@ -156,7 +160,7 @@ void Shutdown()
156160
if (pwalletMain)
157161
delete pwalletMain;
158162
#endif
159-
LogPrintf("Shutdown : done\n");
163+
LogPrintf("%s: done\n", __func__);
160164
}
161165

162166
//
@@ -315,6 +319,7 @@ std::string HelpMessage(HelpMessageMode mode)
315319

316320
strUsage += "\n" + _("Node relay options:") + "\n";
317321
strUsage += " -datacarrier " + _("Relay and mine data carrier transactions (default: 1)") + "\n";
322+
318323
strUsage += "\n" + _("Block creation options:") + "\n";
319324
strUsage += " -blockminsize=<n> " + _("Set minimum block size in bytes (default: 0)") + "\n";
320325
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)
564569
if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), string("0")) != categories.end())
565570
fDebug = false;
566571

567-
// Check for -debugnet (deprecated)
572+
// Check for -debugnet
568573
if (GetBoolArg("-debugnet", false))
569-
InitWarning(_("Warning: Deprecated argument -debugnet ignored, use -debug=net"));
574+
InitWarning(_("Warning: Unsupported argument -debugnet ignored, use -debug=net."));
570575
// Check for -socks - as this is a privacy risk to continue, exit here
571576
if (mapArgs.count("-socks"))
572577
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)
994999

9951000
boost::filesystem::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME;
9961001
CAutoFile est_filein = CAutoFile(fopen(est_path.string().c_str(), "rb"), SER_DISK, CLIENT_VERSION);
1002+
// Allowed to fail as this file IS missing on first startup.
9971003
if (est_filein)
9981004
mempool.ReadFeeEstimates(est_filein);
9991005

0 commit comments

Comments
 (0)