BitcoinKernel BlockchainSync BlockchainSync.Update BlockchainSync.Update.State Enumeration BlockchainSync.Update.State Lifecycle phase of a sync run. Mirrors Bitcoin Core’s SynchronizationState conceptually while remaining a distinct Swift type — see SynchronizationState for how the two enums differ. enum State Overview A sync run produces exactly one emission per state transition: exactly one BlockchainSync.Update.State.preparing, zero or more BlockchainSync.Update.State.syncing, and exactly one of BlockchainSync.Update.State.finished or BlockchainSync.Update.State.failed(_:). Cancellation produces no final emission at all — the sequence ends silently. Topics Enumeration Cases case failed(String)Sync stopped due to an error. The associated String is a human-readable reason for UI / logs (e.g., "fetching block at height 523: … not found"). Terminal. case finishedLocal chain has reached the source’s tip. Terminal state — the sequence finishes after emitting this. case preparingInitializing — resolving the remote tip, computing the fork point if resuming from non-genesis. Always the first emitted state; if it’s also the last, the source or fork-point check failed before any blocks were fetched. case syncingActively fetching and validating blocks. Emitted once per successfully validated block — tip advances monotonically, remoteTip advances whenever a re-poll catches source-side growth. Instance Properties var isTerminal: Booltrue for terminal states (BlockchainSync.Update.State.finished, BlockchainSync.Update.State.failed(_:)) — after which the sequence will emit no further BlockchainSync.Updates.