CompactBlockDownloading
public protocol CompactBlockDownloading
Represents what a compact block downloaded should provide to its clients
-
Downloads and stores the given block range. Non-Blocking
Declaration
Swift
func downloadBlockRange(_ heightRange: CompactBlockRange, completion: @escaping (Error?) -> Void)
-
Remove newer blocks and go back to the given height
Declaration
Swift
func rewind(to height: BlockHeight, completion: @escaping (Error?) -> Void)
Parameters
height
the given height to rewind to
completion
block to be executed after completing rewind
-
returns the height of the latest compact block stored locally BlockHeight.empty() if no blocks are stored yet non-blocking
Declaration
Swift
func lastDownloadedBlockHeight(result: @escaping (Result<BlockHeight, Error>) -> Void)
-
Returns the last height on the blockchain Non-blocking
Declaration
Swift
func latestBlockHeight(result: @escaping (Result<BlockHeight, Error>) -> Void)
-
Downloads and stores the given block range. Blocking
Declaration
Swift
func downloadBlockRange(_ range: CompactBlockRange) throws
-
Restore the download progress up to the given height.
Declaration
Swift
func rewind(to height: BlockHeight) throws
-
returns the height of the latest compact block stored locally. BlockHeight.empty() if no blocks are stored yet Blocking
Declaration
Swift
func lastDownloadedBlockHeight() throws -> BlockHeight
-
Returns the latest block height Blocking
Declaration
Swift
func latestBlockHeight() throws -> BlockHeight