CompactBlockProcessor states don't propagate correctly
Add MnemonicSwift to test target. Bump Alpha version solve dependency problem on podspec Remove MnemonicSwift from test target
This commit is contained in:
parent
d9ba4aebcc
commit
924ccb1c58
|
@ -21,7 +21,6 @@ target 'ZcashLightClientSample' do
|
|||
inherit! :search_paths
|
||||
# Pods for testing
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
target 'ZcashLightClientSample-Mainnet' do
|
||||
|
|
|
@ -68,13 +68,13 @@ PODS:
|
|||
- SwiftNIOFoundationCompat (< 3, >= 2.19.0)
|
||||
- SwiftNIOTLS (< 3, >= 2.19.0)
|
||||
- SwiftProtobuf (1.16.0)
|
||||
- ZcashLightClientKit (0.12.0-alpha.7):
|
||||
- ZcashLightClientKit (0.12.0-alpha.9):
|
||||
- gRPC-Swift (= 1.0.0)
|
||||
- SQLite.swift (~> 0.12.2)
|
||||
- ZcashLightClientKit/DerivationToolTests (0.12.0-alpha.7):
|
||||
- ZcashLightClientKit/DerivationToolTests (0.12.0-alpha.9):
|
||||
- gRPC-Swift (= 1.0.0)
|
||||
- SQLite.swift (~> 0.12.2)
|
||||
- ZcashLightClientKit/Tests (0.12.0-alpha.7):
|
||||
- ZcashLightClientKit/Tests (0.12.0-alpha.9):
|
||||
- gRPC-Swift (= 1.0.0)
|
||||
- SQLite.swift (~> 0.12.2)
|
||||
|
||||
|
@ -153,8 +153,8 @@ SPEC CHECKSUMS:
|
|||
SwiftNIOTLS: 4f8df225f03393f08e0b47b4d876ae38167f8a27
|
||||
SwiftNIOTransportServices: 896c9a4ac98698d32aa2feea7657ade219ae80bb
|
||||
SwiftProtobuf: 4e16842b83c6fda06b10fac50d73b3f1fce8ab7b
|
||||
ZcashLightClientKit: 1cfac611b29b8e6b14e0515cf22c98d433a5f095
|
||||
ZcashLightClientKit: 7dc0eabb989d3f34b102c9342a44e970151bef1e
|
||||
|
||||
PODFILE CHECKSUM: f80c264274518f30ca62d2d474439fe257444aec
|
||||
PODFILE CHECKSUM: 315a67042788e1eccd948b2b8fe580222fd83cd9
|
||||
|
||||
COCOAPODS: 1.10.1
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'ZcashLightClientKit'
|
||||
s.version = '0.12.0-alpha.8'
|
||||
s.version = '0.12.0-alpha.9'
|
||||
s.summary = 'Zcash Light Client wallet SDK for iOS'
|
||||
|
||||
s.description = <<-DESC
|
||||
|
@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|||
s.source = { :git => 'https://github.com/zcash/ZcashLightClientKit.git', :tag => s.version.to_s }
|
||||
|
||||
s.source_files = 'ZcashLightClientKit/**/*.{swift,h}'
|
||||
s.swift_version = '5.3'
|
||||
s.swift_version = '5.4'
|
||||
s.ios.deployment_target = '12.0'
|
||||
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
|
||||
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
|
||||
|
|
|
@ -636,27 +636,31 @@ public class CompactBlockProcessor {
|
|||
progressDelegate: self)
|
||||
|
||||
downloadBlockOperation.startedHandler = { [weak self] in
|
||||
self?.state = .downloading
|
||||
DispatchQueue.main.async {
|
||||
self?.state = .downloading
|
||||
}
|
||||
}
|
||||
|
||||
downloadBlockOperation.errorHandler = { [weak self] (error) in
|
||||
guard let self = self else { return }
|
||||
|
||||
self.processingError = error
|
||||
self.fail(error)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
guard let self = self else { return }
|
||||
self.processingError = error
|
||||
self.fail(error)
|
||||
}
|
||||
}
|
||||
|
||||
let validateChainOperation = CompactBlockValidationOperation(rustWelding: self.rustBackend, cacheDb: cfg.cacheDb, dataDb: cfg.dataDb)
|
||||
|
||||
let downloadValidateAdapterOperation = BlockOperation { [weak validateChainOperation, weak downloadBlockOperation] in
|
||||
|
||||
validateChainOperation?.error = downloadBlockOperation?.error
|
||||
}
|
||||
|
||||
validateChainOperation.completionHandler = { [weak self] (finished, cancelled) in
|
||||
guard !cancelled else {
|
||||
self?.state = .stopped
|
||||
LoggerProxy.debug("Warning: validateChainOperation operation cancelled")
|
||||
DispatchQueue.main.async {
|
||||
self?.state = .stopped
|
||||
LoggerProxy.debug("Warning: validateChainOperation operation cancelled")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -664,30 +668,34 @@ public class CompactBlockProcessor {
|
|||
}
|
||||
|
||||
validateChainOperation.errorHandler = { [weak self] (error) in
|
||||
guard let self = self else { return }
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let self = self else { return }
|
||||
|
||||
guard let validationError = error as? CompactBlockValidationError else {
|
||||
LoggerProxy.error("Warning: validateChain operation returning generic error: \(error)")
|
||||
return
|
||||
}
|
||||
|
||||
switch validationError {
|
||||
case .validationFailed(let height):
|
||||
LoggerProxy.debug("chain validation at height: \(height)")
|
||||
self.validationFailed(at: height)
|
||||
case .failedWithError(let e):
|
||||
guard let validationFailure = e else {
|
||||
LoggerProxy.error("validation failed without a specific error")
|
||||
self.fail(CompactBlockProcessorError.generalError(message: "validation failed without a specific error"))
|
||||
guard let validationError = error as? CompactBlockValidationError else {
|
||||
LoggerProxy.error("Warning: validateChain operation returning generic error: \(error)")
|
||||
return
|
||||
}
|
||||
|
||||
self.fail(validationFailure)
|
||||
switch validationError {
|
||||
case .validationFailed(let height):
|
||||
LoggerProxy.debug("chain validation at height: \(height)")
|
||||
self.validationFailed(at: height)
|
||||
case .failedWithError(let e):
|
||||
guard let validationFailure = e else {
|
||||
LoggerProxy.error("validation failed without a specific error")
|
||||
self.fail(CompactBlockProcessorError.generalError(message: "validation failed without a specific error"))
|
||||
return
|
||||
}
|
||||
|
||||
self.fail(validationFailure)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
validateChainOperation.startedHandler = { [weak self] in
|
||||
self?.state = .validating
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.state = .validating
|
||||
}
|
||||
}
|
||||
|
||||
let scanBlocksOperation = CompactBlockBatchScanningOperation(rustWelding: rustBackend, cacheDb: config.cacheDb, dataDb: config.dataDb, transactionRepository: transactionRepository, range: range, progressDelegate: self)
|
||||
|
@ -696,28 +704,36 @@ public class CompactBlockProcessor {
|
|||
scanBlocksOperation?.error = validateChainOperation?.error
|
||||
}
|
||||
scanBlocksOperation.startedHandler = { [weak self] in
|
||||
self?.state = .scanning
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.state = .scanning
|
||||
}
|
||||
}
|
||||
|
||||
scanBlocksOperation.completionHandler = { [weak self] (finished, cancelled) in
|
||||
guard !cancelled else {
|
||||
self?.state = .stopped
|
||||
LoggerProxy.debug("Warning: scanBlocksOperation operation cancelled")
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.state = .stopped
|
||||
LoggerProxy.debug("Warning: scanBlocksOperation operation cancelled")
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
scanBlocksOperation.errorHandler = { [weak self] (error) in
|
||||
guard let self = self else { return }
|
||||
|
||||
self.processingError = error
|
||||
self.fail(error)
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let self = self else { return }
|
||||
self.processingError = error
|
||||
self.fail(error)
|
||||
}
|
||||
}
|
||||
|
||||
let enhanceOperation = CompactBlockEnhancementOperation(rustWelding: rustBackend, dataDb: config.dataDb, downloader: downloader, repository: transactionRepository, range: range.blockRange())
|
||||
|
||||
enhanceOperation.startedHandler = {
|
||||
LoggerProxy.debug("Started Enhancing range: \(range)")
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.state = .enhancing
|
||||
}
|
||||
}
|
||||
|
||||
enhanceOperation.txFoundHandler = { [weak self] (txs,range) in
|
||||
|
@ -732,10 +748,12 @@ public class CompactBlockProcessor {
|
|||
}
|
||||
|
||||
enhanceOperation.errorHandler = { [weak self] (error) in
|
||||
guard let self = self else { return }
|
||||
|
||||
self.processingError = error
|
||||
self.fail(error)
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let self = self else { return }
|
||||
|
||||
self.processingError = error
|
||||
self.fail(error)
|
||||
}
|
||||
}
|
||||
|
||||
let scanEnhanceAdapterOperation = BlockOperation { [weak enhanceOperation, weak scanBlocksOperation] in
|
||||
|
@ -745,7 +763,9 @@ public class CompactBlockProcessor {
|
|||
let fetchOperation = FetchUnspentTxOutputsOperation(accountRepository: accountRepository, downloader: self.downloader, rustbackend: rustBackend, dataDb: config.dataDb, startHeight: config.walletBirthday)
|
||||
|
||||
fetchOperation.startedHandler = { [weak self] in
|
||||
self?.state = .fetching
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.state = .fetching
|
||||
}
|
||||
}
|
||||
|
||||
fetchOperation.completionHandler = { [weak self] (finished, cancelled) in
|
||||
|
@ -753,14 +773,17 @@ public class CompactBlockProcessor {
|
|||
LoggerProxy.debug("Warning: fetch operation on range \(range) cancelled")
|
||||
return
|
||||
}
|
||||
|
||||
self?.processBatchFinished(range: range)
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.processBatchFinished(range: range)
|
||||
}
|
||||
}
|
||||
fetchOperation.errorHandler = { [weak self] (error) in
|
||||
guard let self = self else { return }
|
||||
|
||||
self.processingError = error
|
||||
self.fail(error)
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let self = self else { return }
|
||||
|
||||
self.processingError = error
|
||||
self.fail(error)
|
||||
}
|
||||
}
|
||||
fetchOperation.fetchedUTXOsHandler = { result in
|
||||
NotificationCenter.default.post(name: .blockProcessorStoredUTXOs, object: self, userInfo: [CompactBlockProcessorNotificationKey.refreshedUTXOs : result])
|
||||
|
@ -1300,3 +1323,4 @@ extension CompactBlockProcessor {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -237,10 +237,17 @@ public class SDKSynchronizer: Synchronizer {
|
|||
selector: #selector(processorStartedScanning(_:)),
|
||||
name: Notification.Name.blockProcessorStartedScanning,
|
||||
object: processor)
|
||||
|
||||
center.addObserver(self,
|
||||
selector: #selector(processorStartedScanning(_:)),
|
||||
name: Notification.Name.blockProcessorStartedScanning,
|
||||
selector: #selector(processorStartedEnhancing(_:)),
|
||||
name: Notification.Name.blockProcessorStartedEnhancing,
|
||||
object: processor)
|
||||
|
||||
center.addObserver(self,
|
||||
selector: #selector(processorStartedFetching(_:)),
|
||||
name: Notification.Name.blockProcessorStartedFetching,
|
||||
object: processor)
|
||||
|
||||
center.addObserver(self,
|
||||
selector: #selector(processorStopped(_:)),
|
||||
name: Notification.Name.blockProcessorStopped,
|
||||
|
@ -739,7 +746,7 @@ public class SDKSynchronizer: Synchronizer {
|
|||
case .generalError(let message):
|
||||
return SynchronizerError.generalError(message: message)
|
||||
case .maxAttemptsReached(attempts: let attempts):
|
||||
return SynchronizerError.maxRetryAttemptsReached(attempts: attempts)
|
||||
return SynchronizerError.maxRetryAttemptsReached(attempts: attempts)
|
||||
case .grpcError(let statusCode, let message):
|
||||
return SynchronizerError.connectionError(status: statusCode, message: message)
|
||||
case .connectionTimeout:
|
||||
|
@ -829,3 +836,4 @@ fileprivate struct NullProgress: BlockProgressReporting {
|
|||
0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue