hygiene: Phase 3 follow-up — sweep commented-out debug cruft

Remove ~116 commented-out debug/dead-code lines the audit flagged as noise
(findings F6/F7/F15/F22): the Komodo "%s tikN" step-tracer comments and other
commented-out fprintf/printf/LogPrintf/std::cerr calls threaded through
AppInit2 (init.cpp), CreateNewBlock and the miner loops (miner.cpp), plus a
few commented-out dead-code fragments (sendmany SetLockTime/nLockTime, the
CCtx CC_vinselect random-pick block and AddNormalinputsLocal remote-mypk
redirect, miner adaptive-PoW assignments).

Comments only — no compiled behavior changes; the tree builds clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-27 13:25:17 -05:00
co-authored by Claude Opus 4.8
parent b7060c7de0
commit 0de30bbbd1
4 changed files with 0 additions and 116 deletions
-30
View File
@@ -1124,7 +1124,6 @@ static void AdjustCoinCacheForMemoryPressure()
bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
{
//fprintf(stderr,"%s start\n", __FUNCTION__);
// ********************************************************* Step 1: setup
#ifdef _MSC_VER
// Turn off Microsoft heap dump noise
@@ -1161,7 +1160,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
return InitError("Error: -sysperms is not allowed in combination with enabled wallet functionality");
#endif
} else {
//fprintf(stderr,"%s setting umask\n", __FUNCTION__);
umask(077);
}
@@ -1179,12 +1177,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
std::set_new_handler(new_handler_terminate);
//fprintf(stderr,"%s: set signal handlers\n", __FUNCTION__);
// ********************************************************* Step 2: parameter interactions
const CChainParams& chainparams = Params();
//fprintf(stderr,"%s: got chain params\n", __FUNCTION__);
// Set this early so that experimental features are correctly enabled/disabled
fExperimentalMode = GetBoolArg("-experimentalfeatures", true);
@@ -1199,7 +1195,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
return InitError(_("Wallet encryption requires -experimentalfeatures."));
}
}
//fprintf(stderr,"%s tik2\n", __FUNCTION__);
// Set this early so that parameter interactions go to console
fPrintToConsole = GetBoolArg("-printtoconsole", false);
@@ -1228,7 +1223,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
LogPrintf("%s: parameter interaction: -allowbind set -> setting -listen=1\n", __func__);
}
//fprintf(stderr,"%s tik3\n", __FUNCTION__);
if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0) {
// when only connecting to trusted nodes, do not seed via DNS, or listen by default
if (SoftSetBoolArg("-dnsseed", false))
@@ -1351,12 +1345,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if (SoftSetBoolArg("-rescan", true))
LogPrintf("%s: parameter interaction: -zapwallettxes=<mode> -> setting -rescan=1\n", __func__);
}
//fprintf(stderr,"%s tik4\n", __FUNCTION__);
// Make sure enough file descriptors are available
int nBind = std::max((int)mapArgs.count("-bind") + (int)mapArgs.count("-allowbind"), 1);
nMaxConnections = GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS);
//fprintf(stderr,"nMaxConnections %d\n",nMaxConnections);
nMaxConnections = std::max(std::min(nMaxConnections, (int)(FD_SETSIZE - nBind - MIN_CORE_FILEDESCRIPTORS)), 0);
int nFD = RaiseFileDescriptorLimit(nMaxConnections + MIN_CORE_FILEDESCRIPTORS);
fprintf(stderr,"nMaxConnections %d FD_SETSIZE.%d nBind.%d expr.%d \n",nMaxConnections,FD_SETSIZE,nBind,(int)(FD_SETSIZE - nBind - MIN_CORE_FILEDESCRIPTORS));
@@ -1364,7 +1356,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
return InitError(_("Not enough file descriptors available."));
if (nFD - MIN_CORE_FILEDESCRIPTORS < nMaxConnections)
nMaxConnections = nFD - MIN_CORE_FILEDESCRIPTORS;
//fprintf(stderr,"nMaxConnections %d\n",nMaxConnections);
// if using block pruning, then disable txindex
// also disable the wallet (for now, until SPV support is implemented in wallet)
if (GetArg("-prune", 0)) {
@@ -1413,7 +1404,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
fprintf(stderr,"%s: enabled randomx debug\n", __func__);
}
//fprintf(stderr,"%s tik5\n", __FUNCTION__);
// Check for -debugnet
if (GetBoolArg("-debugnet", false))
InitWarning(_("Warning: Unsupported argument -debugnet ignored, use -debug=net."));
@@ -1472,7 +1462,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
LogPrintf("Bulk block streaming: %s\n", fBulkBlockSync ? "enabled" : "disabled");
fServer = GetBoolArg("-server", false);
//fprintf(stderr,"%s tik6\n", __FUNCTION__);
// block pruning; get the amount of disk space (in MB) to allot for block & undo files
int64_t nSignedPruneTarget = GetArg("-prune", 0) * 1024 * 1024;
@@ -1560,7 +1549,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
expiryDelta = GetArg("-txexpirydelta", DEFAULT_TX_EXPIRY_DELTA);
bSpendZeroConfChange = GetBoolArg("-spendzeroconfchange", true);
fSendFreeTransactions = GetBoolArg("-sendfreetransactions", false);
//fprintf(stderr,"%s tik7\n", __FUNCTION__);
std::string strWalletFile = GetArg("-wallet", "wallet.dat");
#endif // ENABLE_WALLET
@@ -1577,7 +1565,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
nLocalServices |= NODE_BLOOM;
}
nMaxTipAge = GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
//fprintf(stderr,"%s tik8\n", __FUNCTION__);
#ifdef ENABLE_MINING
if (mapArgs.count("-mineraddress")) {
@@ -1600,7 +1587,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
}
//fprintf(stderr,"%s tik9\n", __FUNCTION__);
if (!mapMultiArgs["-nuparams"].empty()) {
// Allow overriding network upgrade parameters for testing
if (Params().NetworkIDString() != "regtest") {
@@ -1649,7 +1635,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
std::string sha256_algo = SHA256AutoDetect();
LogPrintf("Using the '%s' SHA256 implementation\n", sha256_algo);
//fprintf(stderr,"%s tik10\n", __FUNCTION__);
// Sanity check
if (!InitSanityCheck())
return InitError(_("Initialization sanity check failed. Please check for insanity. Hush is shutting down!"));
@@ -1666,7 +1651,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if (file) fclose(file);
//fprintf(stderr,"%s tik11\n", __FUNCTION__);
fprintf(stderr,"Attempting to obtain lock %s\n", pathLockFile.string().c_str());
try {
static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
@@ -1682,7 +1666,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if (GetBoolArg("-shrinkdebugfile", !fDebug))
ShrinkDebugFile();
//fprintf(stderr,"%s tik12\n", __FUNCTION__);
LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
LogPrintf("Hush version %s\n", FormatFullVersion());
@@ -1715,7 +1698,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
threadGroup.create_thread(&ThreadRandomXVerify);
}
//fprintf(stderr,"%s tik13\n", __FUNCTION__);
// Start the lightweight task scheduler thread
CScheduler::Function serviceLoop = boost::bind(&CScheduler::serviceQueue, &scheduler);
@@ -1723,7 +1705,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// Count uptime
MarkStartTime();
//fprintf(stderr,"%s tik14\n", __FUNCTION__);
if ((chainparams.NetworkIDString() != "regtest") &&
GetBoolArg("-showmetrics", 0) &&
@@ -1733,7 +1714,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
threadGroup.create_thread(&ThreadShowMetricsScreen);
}
//fprintf(stderr,"%s tik15\n", __FUNCTION__);
if ( HUSH_NSPV_FULLNODE )
{
@@ -1751,7 +1731,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if (!AppInitServers(threadGroup))
return InitError(_("Unable to start HTTP server. See debug log for details."));
}
//fprintf(stderr,"%s tik16\n", __FUNCTION__);
int64_t nStart;
@@ -1778,7 +1757,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
#endif // ENABLE_WALLET
// ********************************************************* Step 6: network initialization
//fprintf(stderr,"%s tik17\n", __FUNCTION__);
RegisterNodeSignals(GetNodeSignals());
// sanitize comments per BIP-0014, format user agent and check total size
@@ -1794,7 +1772,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
return InitError(strprintf("Total length of network version string %i exceeds maximum of %i characters. Reduce the number and/or size of uacomments.",
strSubVersion.size(), MAX_SUBVERSION_LENGTH));
}
//fprintf(stderr,"%s tik18\n", __FUNCTION__);
// Disable clearnet peers if -clearnet=0 for this node or -ac_clearnet=0 for this chain
if (ASSETCHAINS_CLEARNET == 0 || !GetBoolArg("-clearnet", DEFAULT_CLEARNET)) {
@@ -1853,7 +1830,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
SetReachable(NET_IPV4, false);
}
//fprintf(stderr,"%s tik19\n", __FUNCTION__);
if (mapArgs.count("-allowlist")) {
BOOST_FOREACH(const std::string& net, mapMultiArgs["-allowlist"]) {
CSubNet subnet;
@@ -1916,7 +1892,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
fDiscover = GetBoolArg("-discover", true);
fNameLookup = GetBoolArg("-dns", true);
//fprintf(stderr,"%s tik22\n", __FUNCTION__);
bool fBound = false;
if (fListen) {
if (mapArgs.count("-bind") || mapArgs.count("-allowbind")) {
@@ -1955,7 +1930,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
}
//fprintf(stderr,"%s tik23\n", __FUNCTION__);
BOOST_FOREACH(const std::string& strDest, mapMultiArgs["-seednode"])
AddOneShot(strDest);
@@ -1991,7 +1965,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
return !fRequestShutdown;
}
// ********************************************************* Step 7: load block chain
//fprintf(stderr,"%s tik24\n", __FUNCTION__);
fReindex = GetBoolArg("-reindex", false);
@@ -2238,7 +2211,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
mempool.ReadFeeEstimates(est_filein);
fFeeEstimatesInitialized = true;
//fprintf(stderr,"%s tik25\n", __FUNCTION__);
// ********************************************************* Step 8: load wallet
#ifdef ENABLE_WALLET
@@ -2452,7 +2424,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
for (int i = 0; i < vSweep.size(); i++) {
// LogPrintf("Sweep Address: %s\n", vSweep[i]);
auto zSweep = DecodePaymentAddress(vSweep[i]);
if (!IsValidPaymentAddress(zSweep)) {
return InitError("Invalid zsweep address");
@@ -2800,7 +2771,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// ********************************************************* Step 11: start node
//fprintf(stderr,"Checking disk space...\n");
if (!CheckDiskSpace())
return false;