Merge pull request #578 from zcash/decrease_batches_on_bloated_chain

[#577] Fix: reduce batch size when reaching increased load part of th…
This commit is contained in:
Francisco Gindre 2022-10-26 17:27:51 -03:00 committed by GitHub
commit c1c3762ce5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -13,7 +13,9 @@ extension CompactBlockProcessor {
try Task.checkCancellation()
setState(.scanning)
let batchSize = UInt32(config.scanningBatchSize)
// TODO: remove this arbitrary batch size https://github.com/zcash/ZcashLightClientKit/issues/576
let batchSize = scanBatchSize(for: range, network: self.config.network.networkType)
do {
if batchSize == 0 {
@ -92,6 +94,17 @@ extension CompactBlockProcessor {
throw error
}
}
fileprivate func scanBatchSize(for range: CompactBlockRange, network: NetworkType) -> UInt32 {
guard network == .mainnet else {
return UInt32(config.scanningBatchSize)
}
if range.lowerBound > 1_600_000 {
return 5
}
return UInt32(config.scanningBatchSize)
}
}
extension CompactBlockProcessor {

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'ZcashLightClientKit'
s.version = '0.16.10-beta'
s.version = '0.17.0-alpha.1'
s.summary = 'Zcash Light Client wallet SDK for iOS'
s.description = <<-DESC