UNIQUE Constraint bug when coming from background. fixed and logged warning to keep investigating

This commit is contained in:
Francisco Gindre 2021-07-15 20:31:28 -03:00
parent 2491114b71
commit 442bc95fd0
1 changed files with 8 additions and 2 deletions

View File

@ -171,7 +171,7 @@ class CompactBlockBatchDownloadOperation: ZcashOperation {
self.batch = batchSize
self.maxRetries = maxRetries
super.init()
self.name = "Download Stream Operation"
self.name = "Download Batch Operation"
}
override func main() {
@ -185,8 +185,14 @@ class CompactBlockBatchDownloadOperation: ZcashOperation {
guard startHeight >= ZcashSDK.SAPLING_ACTIVATION_HEIGHT else {
throw CompactBlockBatchDownloadOperationError.startHeightMissing
}
var localDownloadedHeight = try self.storage.latestHeight()
if localDownloadedHeight != startHeight {
LoggerProxy.warn("provided startHeight (\(startHeight)) differs from local latest downloaded height (\(localDownloadedHeight))")
startHeight = localDownloadedHeight + 1
}
var currentHeight = startHeight
self.progressDelegate?.progressUpdated(.download(BlockProgress(startHeight: startHeight, targetHeight: targetHeight, progressHeight: currentHeight)))
self.progressDelegate?.progressUpdated(.download(BlockProgress(startHeight: currentHeight, targetHeight: targetHeight, progressHeight: currentHeight)))
while !isCancelled && currentHeight <= targetHeight {
var retries = 0