Rewind action continues to the processScanRanges

- the diagram png + puml updated
- rewind action continues to the process scan ranges
This commit is contained in:
Lukas Korba 2023-09-13 16:28:42 +02:00
parent 95c9746303
commit 5600e77a71
4 changed files with 12 additions and 50 deletions

View File

@ -21,7 +21,7 @@ final class RewindAction {
}
private func update(context: ActionContext) async -> ActionContext {
await context.update(state: .download)
await context.update(state: .processSuggestedScanRanges)
return context
}
}

View File

@ -39,7 +39,7 @@ final class RewindActionTests: ZcashTestCase {
"downloader.rewind(latestDownloadedBlockHeight:) is not expected to be called."
)
let acResult = nextContext.checkStateIs(.download)
let acResult = nextContext.checkStateIs(.processSuggestedScanRanges)
XCTAssertTrue(acResult == .true, "Check of state failed with '\(acResult)'")
} catch {
XCTFail("testRewindAction_requestedRewindHeightNil is not expected to fail. \(error)")
@ -80,7 +80,7 @@ final class RewindActionTests: ZcashTestCase {
"downloaderService.rewind(to:) is expected to be called."
)
let acResult = nextContext.checkStateIs(.download)
let acResult = nextContext.checkStateIs(.processSuggestedScanRanges)
XCTAssertTrue(acResult == .true, "Check of state failed with '\(acResult)'")
} catch {
XCTFail("testRewindAction_FullPass is not expected to fail. \(error)")

View File

@ -1,82 +1,49 @@
@startuml
hide empty description
note as Lines
Green lines are happy paths.
Red lines are error paths.
Blue lines are stop paths.
In general any action for any state can produce error.
And the sync process can be stopped during any action.
end note
[*] -> idle
idle -[#green,bold]-> migrateLegacyCacheDB
migrateLegacyCacheDB : MigrateLegacyCacheDBAction
migrateLegacyCacheDB -[#green,bold]-> validateServer
migrateLegacyCacheDB -[#red]-> failed : Error occured.
migrateLegacyCacheDB -[#blue]-> stopped : Sync was stopped.
validateServer : ValidateServerAction
validateServer -[#green,bold]-> fetchUTXO
validateServer -[#red]-> failed : Error occured.
validateServer -[#blue]-> stopped : Sync was stopped.
fetchUTXO : FetchUTXOAction
fetchUTXO -[#green,bold]-> handleSaplingParams
fetchUTXO -[#red]-> failed : Error occured.
fetchUTXO -[#blue]-> stopped : Sync was stopped.
handleSaplingParams : SaplingParamsAction
handleSaplingParams -[#green,bold]-> updateSubtreeRoots
handleSaplingParams -[#red]-> failed : Error occured.
handleSaplingParams -[#blue]-> stopped : Sync was stopped.
updateSubtreeRoots : UpdateSubtreeRootsAction
updateSubtreeRoots -[#green,bold]-> updateChainTip
updateSubtreeRoots -[#red]-> failed : Error occured.
updateSubtreeRoots -[#blue]-> stopped : Sync was stopped.
updateChainTip : UpdateChainTipAction
updateChainTip -[#green,bold]-> clearCache : Every 10mins or after updateSubtreeRoots
updateChainTip -[#green,bold]-> download : Processing of scan range continues
updateChainTip -[#red]-> failed : Error occured.
updateChainTip -[#blue]-> stopped : Sync was stopped.
processSuggestedScanRanges : ProcessSuggestedScanRangesAction
processSuggestedScanRanges -[#green,bold]-> download : Scan range available to process
processSuggestedScanRanges -[#green,bold]-> finished : Scan ranges processed
processSuggestedScanRanges -[#red]-> failed : Error occured.
processSuggestedScanRanges -[#blue]-> stopped : Sync was stopped.
processSuggestedScanRanges -[#green,bold]-> finished : Scan ranges FULLY processed
download : DownloadAction
download -[#green,bold]-> validate
download -[#red]-> failed : Error occured.
download -[#blue]-> stopped : Sync was stopped.
validate : ValidateAction
validate -[#green,bold]-> scan
validate -[#red]-> failed : Error occured.
validate -[#blue]-> stopped : Sync was stopped.
download -[#green,bold]-> scan
scan : ScanAction
scan -[#green,bold]-> clearAlreadyScannedBlocks
scan -[#red]-> failed : Error occured.
scan -[#blue]-> stopped : Sync was stopped.
scan -[#green,bold]-> clearAlreadyScannedBlocks : All ok
scan -[#green,bold]-> rewind : continuity error
rewind : RewindAction
rewind -[#green,bold]-> processSuggestedScanRanges
clearAlreadyScannedBlocks : ClearAlreadyScannedBlocksAction
clearAlreadyScannedBlocks -[#green,bold]-> enhance
clearAlreadyScannedBlocks -[#red]-> failed : Error occured.
clearAlreadyScannedBlocks -[#blue]-> stopped : Sync was stopped.
enhance : EnhanceAction
enhance -[#green,bold]-> updateChainTip : Not all blocks in the\nsync range are downloaded\nand scanned yet.
enhance -[#green,bold]-> clearCache : Clear cache and check the scan ranges
enhance -[#red]-> failed : Error occured.
enhance -[#blue]-> stopped : Sync was stopped.
enhance -[#green,bold]-> updateChainTip : Range NOT finished
enhance -[#green,bold]-> clearCache : Range finished, clear cache and check the scan ranges
note right of enhance
Enhance transactions in batches of 1000
@ -86,11 +53,6 @@ end note
clearCache : ClearCacheAction
clearCache -[#green,bold]-> processSuggestedScanRanges
clearCache -[#red]-> failed : Error occured.
clearCache -[#blue]-> stopped : Sync was stopped.
finished --> [*]
failed --> [*]
stopped --> [*]
@enduml

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 KiB

After

Width:  |  Height:  |  Size: 97 KiB