parent
3737b841ef
commit
4b366b68c0
|
@ -8,14 +8,15 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class ValidateAction {
|
class ValidateAction {
|
||||||
init(container: DIContainer) { }
|
let validator: BlockValidator
|
||||||
|
init(container: DIContainer) {
|
||||||
|
validator = container.resolve(BlockValidator.self)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ValidateAction: Action {
|
extension ValidateAction: Action {
|
||||||
func run(with context: ActionContext, didUpdate: @escaping (ActionProgress) async -> Void) async throws -> ActionContext {
|
func run(with context: ActionContext, didUpdate: @escaping (ActionProgress) async -> Void) async throws -> ActionContext {
|
||||||
|
try await validator.validate()
|
||||||
// Wait until all blocks in range latestScannedHeight...latestScannedHeight+batchSize are downloaded and then run validation.
|
|
||||||
|
|
||||||
await context.update(state: .scan)
|
await context.update(state: .scan)
|
||||||
return context
|
return context
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue