open class CompactBlockDownloader
Serves as a source of compact blocks received from the light wallet server. Once started, it will use the given lightwallet service to request all the appropriate blocks and compact block store to persist them. By delegating to these dependencies, the downloader remains agnostic to the particular implementation of how to retrieve and store data; although, by default the SDK uses gRPC and SQL.
<init> |
Serves as a source of compact blocks received from the light wallet server. Once started, it will use the given lightwallet service to request all the appropriate blocks and compact block store to persist them. By delegating to these dependencies, the downloader remains agnostic to the particular implementation of how to retrieve and store data; although, by default the SDK uses gRPC and SQL. CompactBlockDownloader(lightwalletService: LightWalletService, compactBlockStore: CompactBlockStore) |
compactBlockStore |
responsible for persisting the compact blocks that are received val compactBlockStore: CompactBlockStore |
lightwalletService |
the service used for requesting compact blocks val lightwalletService: LightWalletService |
downloadBlockRange |
Requests the given range of blocks from the lightwalletService and then persists them to the compactBlockStore. suspend fun downloadBlockRange(heightRange: IntRange): Int |
getLastDownloadedHeight |
Return the latest block height that has been persisted into the CompactBlockStore. suspend fun getLastDownloadedHeight(): Int |
getLatestBlockHeight |
Return the latest block height known by the lightwalletService. suspend fun getLatestBlockHeight(): Int |
rewindToHeight |
Rewind the storage to the given height, usually to handle reorgs. suspend fun rewindToHeight(height: Int): Unit |
stop |
Stop this downloader and cleanup any resources being used. fun stop(): Unit |