Make AppInit2 less noisy unless -debug

This commit is contained in:
Duke Leto
2020-12-07 08:18:04 -05:00
parent 12af889486
commit ca774f2948

View File

@@ -950,7 +950,7 @@ extern int32_t KOMODO_REWIND;
bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
{ {
fprintf(stderr,"%s start\n", __FUNCTION__); //fprintf(stderr,"%s start\n", __FUNCTION__);
// ********************************************************* Step 1: setup // ********************************************************* Step 1: setup
#ifdef _MSC_VER #ifdef _MSC_VER
// Turn off Microsoft heap dump noise // Turn off Microsoft heap dump noise
@@ -977,7 +977,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if (!SetupNetworking()) if (!SetupNetworking())
return InitError("Error: Initializing networking failed"); return InitError("Error: Initializing networking failed");
fprintf(stderr,"%s networking setup\n", __FUNCTION__); if(fDebug)
fprintf(stderr,"%s networking setup\n", __FUNCTION__);
#ifndef _WIN32 #ifndef _WIN32
if (GetBoolArg("-sysperms", false)) { if (GetBoolArg("-sysperms", false)) {
@@ -1022,25 +1023,25 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// Set this early so that experimental features are correctly enabled/disabled // Set this early so that experimental features are correctly enabled/disabled
fExperimentalMode = GetBoolArg("-experimentalfeatures", true); fExperimentalMode = GetBoolArg("-experimentalfeatures", true);
fprintf(stderr,"%s: fExperimentalMode=%d\n", __FUNCTION__, fExperimentalMode); if(fDebug)
fprintf(stderr,"%s: fExperimentalMode=%d\n", __FUNCTION__, fExperimentalMode);
// Fail early if user has set experimental options without the global flag // Fail early if user has set experimental options without the global flag
if (!fExperimentalMode) { if (!fExperimentalMode) {
if (mapArgs.count("-developerencryptwallet")) { if (mapArgs.count("-developerencryptwallet")) {
fprintf(stderr,"%s wallet encryption error\n", __FUNCTION__); fprintf(stderr,"%s wallet encryption error\n", __FUNCTION__);
return InitError(_("Wallet encryption requires -experimentalfeatures.")); return InitError(_("Wallet encryption requires -experimentalfeatures."));
//TODO: make this non experimental
} else if (mapArgs.count("-zmergetoaddress")) { } else if (mapArgs.count("-zmergetoaddress")) {
fprintf(stderr,"%s zmerge error\n", __FUNCTION__); //fprintf(stderr,"%s zmerge error\n", __FUNCTION__);
return InitError(_("RPC method z_mergetoaddress requires -experimentalfeatures.")); //return InitError(_("RPC method z_mergetoaddress requires -experimentalfeatures."));
} }
} }
//fprintf(stderr,"%s tik2\n", __FUNCTION__); //fprintf(stderr,"%s tik2\n", __FUNCTION__);
// Set this early so that parameter interactions go to console // Set this early so that parameter interactions go to console
fPrintToConsole = GetBoolArg("-printtoconsole", false); fPrintToConsole = GetBoolArg("-printtoconsole", false);
fLogTimestamps = GetBoolArg("-logtimestamps", true); fLogTimestamps = GetBoolArg("-logtimestamps", true);
fLogIPs = GetBoolArg("-logips", false); fLogIPs = GetBoolArg("-logips", false);
LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
@@ -2184,7 +2185,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// ********************************************************* Step 11: start node // ********************************************************* Step 11: start node
fprintf(stderr,"Checking disk space...\n"); //fprintf(stderr,"Checking disk space...\n");
if (!CheckDiskSpace()) if (!CheckDiskSpace())
return false; return false;
@@ -2203,7 +2204,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION)) if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION))
StartTorControl(threadGroup, scheduler); StartTorControl(threadGroup, scheduler);
fprintf(stderr,"Starting txnotify thread\n"); if(fDebug)
fprintf(stderr,"Starting txnotify thread\n");
StartNode(threadGroup, scheduler); StartNode(threadGroup, scheduler);
#ifdef ENABLE_MINING #ifdef ENABLE_MINING
@@ -2220,16 +2222,19 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// ********************************************************* Step 11: finished // ********************************************************* Step 11: finished
SetRPCWarmupFinished(); SetRPCWarmupFinished();
fprintf(stderr,"RPC warmump finished\n"); if(fDebug)
fprintf(stderr,"RPC warmump finished\n");
uiInterface.InitMessage(_("Done loading!")); uiInterface.InitMessage(_("Done loading!"));
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
if (pwalletMain) { if (pwalletMain) {
fprintf(stderr,"%s Reaccepting wallet xtns\n", __FUNCTION__); if(fDebug)
fprintf(stderr,"%s Reaccepting wallet xtns\n", __FUNCTION__);
// Add wallet transactions that aren't already in a block to mapTransactions // Add wallet transactions that aren't already in a block to mapTransactions
pwalletMain->ReacceptWalletTransactions(); pwalletMain->ReacceptWalletTransactions();
fprintf(stderr,"%s Starting wallet flusher thread\n", __FUNCTION__); if(fDebug)
fprintf(stderr,"%s Starting wallet flusher thread\n", __FUNCTION__);
// Run a thread to flush wallet periodically // Run a thread to flush wallet periodically
threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(pwalletMain->strWalletFile))); threadGroup.create_thread(boost::bind(&ThreadFlushWalletDB, boost::ref(pwalletMain->strWalletFile)));
} }
@@ -2238,6 +2243,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// SENDALERT // SENDALERT
threadGroup.create_thread(boost::bind(ThreadSendAlert)); threadGroup.create_thread(boost::bind(ThreadSendAlert));
fprintf(stderr,"%s end fRequestShutdown=%d\n", __FUNCTION__, !!fRequestShutdown); if(fDebug)
fprintf(stderr,"%s end fRequestShutdown=%d\n", __FUNCTION__, !!fRequestShutdown);
return !fRequestShutdown; return !fRequestShutdown;
} }