Remove the 10-block range limit for during sandblasting.

The improved performance provided by `shardtree` is sufficient to allow
100-block scan ranges throughout the sandblasted range, and limiting to
10 blocks results in significant overhead.

A future release will switch to an adaptive strategy which can
dynamically adjust download and scan range sizes based upon observed
output counts and scanning times to provide consistent throughput.
This commit is contained in:
Kris Nuttycombe 2023-09-15 20:30:09 -06:00
parent 0abe7f8cdf
commit 4ef4b1172f
1 changed files with 1 additions and 15 deletions

View File

@ -49,8 +49,7 @@ extension BlockScannerImpl: BlockScanner {
let previousScannedHeight = lastScannedHeight
let startHeight = previousScannedHeight + 1
// TODO: [#576] remove this arbitrary batch size https://github.com/zcash/ZcashLightClientKit/issues/576
let batchSize = scanBatchSize(startScanHeight: startHeight, network: config.networkType)
let batchSize = UInt32(config.scanningBatchSize)
let scanStartTime = Date()
do {
@ -87,17 +86,4 @@ extension BlockScannerImpl: BlockScanner {
return lastScannedHeight
}
private func scanBatchSize(startScanHeight height: BlockHeight, network: NetworkType) -> UInt32 {
assert(config.scanningBatchSize > 0, "ZcashSDK.DefaultScanningBatch must be larger than 0!")
guard network == .mainnet else { return UInt32(config.scanningBatchSize) }
if height > 1_650_000 {
// librustzcash thread saturation at a number of blocks
// that contains 100 * num_cores Sapling outputs.
return UInt32(max(ProcessInfo().activeProcessorCount, 10))
}
return UInt32(config.scanningBatchSize)
}
}