-
public class CompactBlockDownloaderServes as a source of compact blocks received from the light wallet server. Once started, it will use the given lightWallet client 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classCompactBlockDownloader.Companion
-
Field Summary
Fields Modifier and Type Field Description private final CompactBlockRepositorycompactBlockRepository
-
Constructor Summary
Constructors Constructor Description CompactBlockDownloader(LightWalletClient lightWalletClient, CompactBlockRepository compactBlockRepository)
-
Method Summary
Modifier and Type Method Description final CompactBlockRepositorygetCompactBlockRepository()final List<JniBlockMeta>downloadBlockRange(ClosedRange<BlockHeight> heightRange)Requests the given range of blocks from the lightWalletClient and then persists them to the compactBlockStore. final UnitrewindToHeight(BlockHeight height)Rewind the storage to the given height, usually to handle reorgs. final Response<BlockHeightUnsafe>getLatestBlockHeight()Return the latest block height known by the lightWalletClient. final BlockHeightgetLastDownloadedHeight()Return the latest block height that has been persisted into the CompactBlockRepository. final LightWalletEndpointInfoUnsafegetServerInfo()final Unitstop()Stop this downloader and cleanup any resources being used. final Unitreconnect()Reconnect to the same or a different server. final Response<RawTransactionUnsafe>fetchTransaction(ByteArray txId)Fetch the details of a known transaction. final <ERROR CLASS>getTAddressTransactions(String transparentAddress, ClosedRange<BlockHeight> blockHeightRange)Get transactions belonging to the given transparent address final Flow<Response<GetAddressUtxosReplyUnsafe>>fetchUtxos(List<String> tAddresses, BlockHeightUnsafe startHeight)Fetch all UTXOs for the given addresses and from the given height. final Flow<Response<SubtreeRootUnsafe>>getSubtreeRoots(UInt startIndex, ShieldedProtocolEnum shieldedProtocol, UInt maxEntries)Returns a stream of information about roots of subtrees of the Sapling and Orchard note commitment trees. final Response<TreeStateUnsafe>getTreeState(BlockHeightUnsafe height)Returns information about roots of subtrees of the Sapling and Orchard note commitment trees. -
-
Constructor Detail
-
CompactBlockDownloader
CompactBlockDownloader(LightWalletClient lightWalletClient, CompactBlockRepository compactBlockRepository)
-
-
Method Detail
-
getCompactBlockRepository
final CompactBlockRepository getCompactBlockRepository()
-
downloadBlockRange
final List<JniBlockMeta> downloadBlockRange(ClosedRange<BlockHeight> heightRange)
Requests the given range of blocks from the lightWalletClient and then persists them to the compactBlockStore.
- Parameters:
heightRange- the inclusive range of heights to request.
-
rewindToHeight
final Unit rewindToHeight(BlockHeight height)
Rewind the storage to the given height, usually to handle reorgs. Deletes all blocks above the given height.
- Parameters:
height- the height to which the data will rewind.
-
getLatestBlockHeight
final Response<BlockHeightUnsafe> getLatestBlockHeight()
Return the latest block height known by the lightWalletClient.
-
getLastDownloadedHeight
final BlockHeight getLastDownloadedHeight()
Return the latest block height that has been persisted into the CompactBlockRepository.
-
getServerInfo
final LightWalletEndpointInfoUnsafe getServerInfo()
-
reconnect
final Unit reconnect()
Reconnect to the same or a different server. This is useful when the connection is unrecoverable. That might be time to switch to a mirror or just reconnect.
-
fetchTransaction
final Response<RawTransactionUnsafe> fetchTransaction(ByteArray txId)
Fetch the details of a known transaction.
-
getTAddressTransactions
final <ERROR CLASS> getTAddressTransactions(String transparentAddress, ClosedRange<BlockHeight> blockHeightRange)
Get transactions belonging to the given transparent address
-
fetchUtxos
final Flow<Response<GetAddressUtxosReplyUnsafe>> fetchUtxos(List<String> tAddresses, BlockHeightUnsafe startHeight)
Fetch all UTXOs for the given addresses and from the given height.
-
getSubtreeRoots
final Flow<Response<SubtreeRootUnsafe>> getSubtreeRoots(UInt startIndex, ShieldedProtocolEnum shieldedProtocol, UInt maxEntries)
Returns a stream of information about roots of subtrees of the Sapling and Orchard note commitment trees.
-
getTreeState
final Response<TreeStateUnsafe> getTreeState(BlockHeightUnsafe height)
Returns information about roots of subtrees of the Sapling and Orchard note commitment trees.
-
-
-
-