class CompactBlockProcessor
Responsible for processing the compact blocks that are received from the lightwallet server. This class encapsulates all the business logic required to validate and scan the blockchain and is therefore tightly coupled with librustzcash.
ProcessorInfo |
Data class for holding detailed information about the processor. data class ProcessorInfo |
State |
Sealed class representing the various states of this processor. sealed class State |
WalletBalance |
Data structure to hold the total and available balance of the wallet. This is what is received on the balance channel. data class WalletBalance |
<init> |
Responsible for processing the compact blocks that are received from the lightwallet server. This class encapsulates all the business logic required to validate and scan the blockchain and is therefore tightly coupled with librustzcash. CompactBlockProcessor(downloader: CompactBlockDownloader, repository: TransactionRepository, rustBackend: RustBackendWelding, minimumHeight: Int = SAPLING_ACTIVATION_HEIGHT) |
downloader |
the component responsible for downloading compact blocks and persisting them locally for processing. val downloader: CompactBlockDownloader |
onChainErrorListener |
Callbaqck for reorgs. This callback is invoked when validation fails with the height at which an error was found and the lower bound to which the data will rewind, at most. var onChainErrorListener: ((Int, Int) -> Any)? |
onProcessorErrorListener |
Callback for any critical errors that occur while processing compact blocks. var onProcessorErrorListener: ((Throwable) -> Boolean)? |
processorInfo |
The flow of detailed processorInfo like the range of blocks that shall be downloaded and scanned. This gives the wallet a lot of insight into the work of this processor. val processorInfo: Flow<ProcessorInfo> |
progress |
The flow of progress values so that a wallet can monitor how much downloading remains without needing to poll. val progress: Flow<Int> |
state |
The flow of state values so that a wallet can monitor the state of this class without needing to poll. val state: Flow<State> |
getAddress |
Get address corresponding to the given account for this wallet. suspend fun getAddress(accountId: Int): String |
getBalanceInfo |
Calculates the latest balance info. Defaults to the first account. suspend fun getBalanceInfo(accountIndex: Int = 0): WalletBalance |
getLastDownloadedHeight |
Get the height of the last block that was downloaded by this processor. suspend fun getLastDownloadedHeight(): Int |
getLastScannedHeight |
Get the height of the last block that was scanned by this processor. suspend fun getLastScannedHeight(): Int |
start |
Download compact blocks, verify and scan them until stop is called. suspend fun start(): Unit |
stop |
Sets the state to Stopped, which causes the processor loop to exit. suspend fun stop(): Unit |