Add -maxblocksintransit: tunable per-peer block-download window
The per-peer in-flight block window (MAX_BLOCKS_IN_TRANSIT_PER_PEER) was a hardcoded 16. On a single, high-latency peer during IBD the transfer is bandwidth-delay-product bound (window / RTT), so with tiny sub-checkpoint blocks the window, not bandwidth, is the ceiling — measured ~4x throughput going 16 -> 64 on a 350ms-RTT peer. Make it a runtime flag (default 16, clamped 1..4096), logged at startup. No behavior change at the default. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1439,6 +1439,15 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
else if (nRandomXVerifyThreads > MAX_SCRIPTCHECK_THREADS)
|
||||
nRandomXVerifyThreads = MAX_SCRIPTCHECK_THREADS;
|
||||
|
||||
// Per-peer block-download window (see MAX_BLOCKS_IN_TRANSIT_PER_PEER). Raising this lifts
|
||||
// the bandwidth-delay-product ceiling on high-latency peers during IBD. Clamp to a sane range.
|
||||
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;
|
||||
LogPrintf("Per-peer max blocks in transit: %d\n", MAX_BLOCKS_IN_TRANSIT_PER_PEER);
|
||||
|
||||
fServer = GetBoolArg("-server", false);
|
||||
//fprintf(stderr,"%s tik6\n", __FUNCTION__);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user