Class DownloadProgressTracker

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void await()
      Wait for the chain to be downloaded.
      protected void doneDownload()
      Called when we are done downloading the block chain.
      com.google.common.util.concurrent.ListenableFuture<java.lang.Long> getFuture()
      Returns a listenable future that completes with the height of the best chain (as reported by the peer) once chain download seems to be finished.
      void onBlocksDownloaded​(Peer peer, Block block, FilteredBlock filteredBlock, int blocksLeft)
      Called on a Peer thread when a block is received.
      void onChainDownloadStarted​(Peer peer, int blocksLeft)
      Called when a download is started with the initial number of blocks to be downloaded.
      protected void progress​(double pct, int blocksSoFar, java.util.Date date)
      Called when download progress is made.
      protected void startDownload​(int blocks)
      Called when download is initiated.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DownloadProgressTracker

        public DownloadProgressTracker()
    • Method Detail

      • onBlocksDownloaded

        public void onBlocksDownloaded​(Peer peer,
                                       Block block,
                                       @Nullable
                                       FilteredBlock filteredBlock,
                                       int blocksLeft)
        Description copied from interface: BlocksDownloadedEventListener

        Called on a Peer thread when a block is received.

        The block may be a Block object that contains transactions, a Block object that is only a header when fast catchup is being used. If set, filteredBlock can be used to retrieve the list of associated transactions.

        Specified by:
        onBlocksDownloaded in interface BlocksDownloadedEventListener
        Overrides:
        onBlocksDownloaded in class AbstractPeerDataEventListener
        Parameters:
        peer - the peer receiving the block
        block - the downloaded block
        filteredBlock - if non-null, the object that wraps the block header passed as the block param.
        blocksLeft - the number of blocks left to download
      • progress

        protected void progress​(double pct,
                                int blocksSoFar,
                                java.util.Date date)
        Called when download progress is made.
        Parameters:
        pct - the percentage of chain downloaded, estimated
        date - the date of the last block downloaded
      • startDownload

        protected void startDownload​(int blocks)
        Called when download is initiated.
        Parameters:
        blocks - the number of blocks to download, estimated
      • doneDownload

        protected void doneDownload()
        Called when we are done downloading the block chain.
      • await

        public void await()
                   throws java.lang.InterruptedException
        Wait for the chain to be downloaded.
        Throws:
        java.lang.InterruptedException
      • getFuture

        public com.google.common.util.concurrent.ListenableFuture<java.lang.Long> getFuture()
        Returns a listenable future that completes with the height of the best chain (as reported by the peer) once chain download seems to be finished.