[#700] Add documentation for CompactBlockProcessor state machine

- plantuml tool is used to generate diagram.
This commit is contained in:
Michal Fousek 2023-05-08 10:40:24 +02:00
parent 5810294b3a
commit cfc5fa12fa
2 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,84 @@
@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
[*] -> validateServer
validateServer : ValidateServerAction
validateServer -[#green,bold]-> computeSyncRanges
validateServer -[#red]-> failed : Error occured.
validateServer -[#blue]-> stopped : Sync was stopped.
computeSyncRanges : ComputeSyncRangesAction
computeSyncRanges -[#green,bold]-> checksBeforeSync
computeSyncRanges -[#red]-> failed : Error occured.
computeSyncRanges -[#blue]-> stopped : Sync was stopped.
checksBeforeSync : ChecksBeforeSyncAction
checksBeforeSync -[#green,bold]-> fetchUTXO
checksBeforeSync -[#red]-> failed : Error occured.
checksBeforeSync -[#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]-> scanDownloaded
handleSaplingParams -[#red]-> failed : Error occured.
handleSaplingParams -[#blue]-> stopped : Sync was stopped.
scanDownloaded : ScanDownloadedButUnscannedAction
scanDownloaded -[#green,bold]-> download
scanDownloaded -[#red]-> failed : Error occured.
scanDownloaded -[#blue]-> stopped : Sync was stopped.
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.
scan : ScanAction
scan -[#green,bold]-> clearAlreadyScannedBlocks
clearAlreadyScannedBlocks : ClearAlreadyScannedBlocksAction
clearAlreadyScannedBlocks -[#green,bold]-> enhance
enhance : EnhanceAction
enhance -[#green,bold]-> download : Not all blocks in the\nsync range are downloaded\nand scanned yet.
enhance -[#green,bold]-> clearCache : All the blocks in\nthe sync range are downloaded\nand scanned.
enhance -[#red]-> failed : Error occured.
enhance -[#blue]-> stopped : Sync was stopped.
note right of enhance
Enhance transactions in batches of 1000
blocks. Dont't do it for each scan batch
which is usualy 100 blocks.
end note
clearCache : ClearCacheAction
clearCache --> finished
clearCache -[#red]-> failed : Error occured.
clearCache -[#blue]-> stopped : Sync was stopped.
finished --> [*]
failed --> [*]
stopped --> [*]
@enduml

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB