Package 

Interface CloseableSynchronizer

    • Method Detail

      • getNetwork

         abstract ZcashNetwork getNetwork()

        The network to which this synchronizer is connected and from which it is processing blocks.

      • getStatus

         abstract Flow<Synchronizer.Status> getStatus()

        A flow of values representing the Status of this Synchronizer. As the status changes, a new value will be emitted by this flow.

      • getProgress

         abstract Flow<PercentDecimal> getProgress()

        Indicates the download progress of the Synchronizer.

        When progress reaches PercentDecimal.ONE_HUNDRED_PERCENT, it signals that the Synchronizer is up-to-date with the network's current chain tip. Balances should be considered inaccurate and outbound transactions should be prevented until this sync is complete.

      • getAreFundsSpendable

         abstract Flow<Boolean> getAreFundsSpendable()

        Indicates whether are the shielded wallet balances spendable or not during the block synchronization process.

      • getProcessorInfo

         abstract Flow<CompactBlockProcessor.ProcessorInfo> getProcessorInfo()

        A flow of processor details, updated every time blocks are processed to include the latest block height, blocks downloaded and blocks scanned. Similar to the progress flow but with a lot more detail.

      • getNetworkHeight

         abstract StateFlow<BlockHeight> getNetworkHeight()

        The latest height observed on the network, which does not necessarily correspond to the latest downloaded height or scanned height. Although this is present in processorInfo, it is such a frequently used value that it is convenient to have the real-time value by itself.

      • getLatestBirthdayHeight

         abstract BlockHeight getLatestBirthdayHeight()

        An in-memory reference to the best known birthday height, which can change if the first transaction has not yet occurred.

      • getOnProcessorErrorHandler

         abstract Function1<Throwable, Boolean> getOnProcessorErrorHandler()

        An error handler for exceptions during processing. For instance, a block might be missing or a reorg may get mishandled or the database may get corrupted.

      • setOnProcessorErrorHandler

         abstract Unit setOnProcessorErrorHandler(Function1<Throwable, Boolean> onProcessorErrorHandler)

        An error handler for exceptions during processing. For instance, a block might be missing or a reorg may get mishandled or the database may get corrupted.

      • getOnSetupErrorHandler

         abstract Function1<Throwable, Boolean> getOnSetupErrorHandler()

        Callback for setup errors that occur prior to processing compact blocks. Can be used to override any errors encountered during setup. When this listener is missing then all setup errors will result in the synchronizer not starting. This is particularly useful for wallets to receive a callback right before the SDK will reject a lightwalletd server because it appears not to match.

      • setOnSetupErrorHandler

         abstract Unit setOnSetupErrorHandler(Function1<Throwable, Boolean> onSetupErrorHandler)

        Callback for setup errors that occur prior to processing compact blocks. Can be used to override any errors encountered during setup. When this listener is missing then all setup errors will result in the synchronizer not starting. This is particularly useful for wallets to receive a callback right before the SDK will reject a lightwalletd server because it appears not to match.

      • getOnChainErrorHandler

         abstract Function2<BlockHeight, BlockHeight, Object> getOnChainErrorHandler()

        A callback to invoke whenever a chain error is encountered. These occur whenever the processor detects a missing or non-chain-sequential block (i.e. a reorg). At a minimum, it is best to log these errors because they are the most common source of bugs and unexpected behavior in wallets, due to the chain data mutating and wallets becoming out of sync.

      • setOnChainErrorHandler

         abstract Unit setOnChainErrorHandler(Function2<BlockHeight, BlockHeight, Object> onChainErrorHandler)

        A callback to invoke whenever a chain error is encountered. These occur whenever the processor detects a missing or non-chain-sequential block (i.e. a reorg). At a minimum, it is best to log these errors because they are the most common source of bugs and unexpected behavior in wallets, due to the chain data mutating and wallets becoming out of sync.