Fix error handling in BlockDownloaderImpl

`lastError` inside the `BlockDownloaderImpl` was set even when
downloading task was canceled. And because it was canceled the
`lastError` has never been read by CBP before the next sync. And when
next sync was started it was immediately failed because of cancelation
error stored in `lastError`.
This commit is contained in:
Michal Fousek 2023-05-08 13:49:29 +02:00
parent c3335db54d
commit 9f333170c7
1 changed files with 1 additions and 1 deletions

View File

@ -139,10 +139,10 @@ actor BlockDownloaderImpl {
isDownloading = false
}
} catch {
lastError = error
if Task.isCancelled {
logger.debug("Blocks downloading canceled.")
} else {
lastError = error
logger.error("Blocks downloading failed: \(error)")
}
isDownloading = false