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,6 +977,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if (!SetupNetworking()) if (!SetupNetworking())
return InitError("Error: Initializing networking failed"); return InitError("Error: Initializing networking failed");
if(fDebug)
fprintf(stderr,"%s networking setup\n", __FUNCTION__); fprintf(stderr,"%s networking setup\n", __FUNCTION__);
#ifndef _WIN32 #ifndef _WIN32
@@ -1022,6 +1023,7 @@ 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);
if(fDebug)
fprintf(stderr,"%s: fExperimentalMode=%d\n", __FUNCTION__, fExperimentalMode); 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
@@ -1029,10 +1031,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
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__);
@@ -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,6 +2204,7 @@ 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);
if(fDebug)
fprintf(stderr,"Starting txnotify thread\n"); fprintf(stderr,"Starting txnotify thread\n");
StartNode(threadGroup, scheduler); StartNode(threadGroup, scheduler);
@@ -2220,15 +2222,18 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// ********************************************************* Step 11: finished // ********************************************************* Step 11: finished
SetRPCWarmupFinished(); SetRPCWarmupFinished();
if(fDebug)
fprintf(stderr,"RPC warmump finished\n"); fprintf(stderr,"RPC warmump finished\n");
uiInterface.InitMessage(_("Done loading!")); uiInterface.InitMessage(_("Done loading!"));
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
if (pwalletMain) { if (pwalletMain) {
if(fDebug)
fprintf(stderr,"%s Reaccepting wallet xtns\n", __FUNCTION__); 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();
if(fDebug)
fprintf(stderr,"%s Starting wallet flusher thread\n", __FUNCTION__); 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));
if(fDebug)
fprintf(stderr,"%s end fRequestShutdown=%d\n", __FUNCTION__, !!fRequestShutdown); fprintf(stderr,"%s end fRequestShutdown=%d\n", __FUNCTION__, !!fRequestShutdown);
return !fRequestShutdown; return !fRequestShutdown;
} }