diff --git a/src/init.cpp b/src/init.cpp index c1b53af7b..61c7c8466 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -283,6 +283,7 @@ void Shutdown() } #endif UnregisterAllValidationInterfaces(); + RandomXValidatorShutdown(); // release the ~256MB shared RandomX pre-verify cache (was leaked at exit) #ifdef ENABLE_WALLET delete pwalletMain; pwalletMain = NULL; @@ -396,7 +397,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-mempooltxinputlimit=", _("[DEPRECATED/IGNORED] Set the maximum number of transparent inputs in a transaction that the mempool will accept (default: 0 = no limit applied)")); strUsage += HelpMessageOpt("-par=", strprintf(_("Set the number of script verification threads (%u to %d, 0 = auto, <0 = leave that many cores free, default: %d)"), -(int)boost::thread::hardware_concurrency(), MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS)); - strUsage += HelpMessageOpt("-randomxverifythreads=", strprintf(_("Number of threads for parallel RandomX PoW pre-verification of post-checkpoint blocks during sync (0 = inline only, max %d, default: same as -par)"), MAX_SCRIPTCHECK_THREADS)); + strUsage += HelpMessageOpt("-randomxverifythreads=", strprintf(_("Number of threads for parallel RandomX PoW pre-verification of post-checkpoint blocks during network sync; no effect on reindex (0 = inline only, max %d, default: same as -par)"), MAX_SCRIPTCHECK_THREADS)); #ifndef _WIN32 strUsage += HelpMessageOpt("-pid=", strprintf(_("Specify pid file (default: %s)"), "hushd.pid")); #endif @@ -1448,8 +1449,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) MAX_BLOCKS_IN_TRANSIT_PER_PEER = GetArg("-maxblocksintransit", DEFAULT_MAX_BLOCKS_IN_TRANSIT_PER_PEER); if (MAX_BLOCKS_IN_TRANSIT_PER_PEER < 1) MAX_BLOCKS_IN_TRANSIT_PER_PEER = 1; - else if (MAX_BLOCKS_IN_TRANSIT_PER_PEER > 4096) - MAX_BLOCKS_IN_TRANSIT_PER_PEER = 4096; + else if (MAX_BLOCKS_IN_TRANSIT_PER_PEER > (int)BLOCK_DOWNLOAD_WINDOW) { + // Values above BLOCK_DOWNLOAD_WINDOW are a silent no-op: FindNextBlocksToDownload never fetches + // beyond pindexLastCommonBlock + BLOCK_DOWNLOAD_WINDOW, so clamp to the real effective ceiling. + LogPrintf("-maxblocksintransit=%d exceeds the effective ceiling BLOCK_DOWNLOAD_WINDOW=%u; clamping\n", MAX_BLOCKS_IN_TRANSIT_PER_PEER, BLOCK_DOWNLOAD_WINDOW); + MAX_BLOCKS_IN_TRANSIT_PER_PEER = (int)BLOCK_DOWNLOAD_WINDOW; + } LogPrintf("Per-peer max blocks in transit: %d\n", MAX_BLOCKS_IN_TRANSIT_PER_PEER); // Opt-in bulk block streaming (DragonX). Drives the requester branch in SendMessages and, when