Packages

case class ChainHandlerCached(blockHeaderDAO: BlockHeaderDAO, filterHeaderDAO: CompactFilterHeaderDAO, filterDAO: CompactFilterDAO, blockchains: Vector[Blockchain], blockFilterCheckpoints: Map[DoubleSha256DigestBE, DoubleSha256DigestBE])(implicit chainConfig: ChainAppConfig, executionContext: ExecutionContext) extends ChainHandler with Product with Serializable

An optimized version of ChainHandler that avoids database reads for determining what the best block header is. This should be used with care as it is possible the cached blockchains may be out of date! Unless you know what you are doing, you should probably use ChainHandler

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ChainHandlerCached
  2. Serializable
  3. Product
  4. Equals
  5. ChainHandler
  6. ChainVerificationLogger
  7. Logging
  8. ChainApi
  9. ChainQueryApi
  10. AnyRef
  11. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new ChainHandlerCached(blockHeaderDAO: BlockHeaderDAO, filterHeaderDAO: CompactFilterHeaderDAO, filterDAO: CompactFilterDAO, blockchains: Vector[Blockchain], blockFilterCheckpoints: Map[DoubleSha256DigestBE, DoubleSha256DigestBE])(implicit chainConfig: ChainAppConfig, executionContext: ExecutionContext)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. val blockFilterCheckpoints: Map[DoubleSha256DigestBE, DoubleSha256DigestBE]
    Definition Classes
    ChainHandlerCachedChainHandler
  6. val blockHeaderDAO: BlockHeaderDAO
    Definition Classes
    ChainHandlerCachedChainHandler
  7. val blockchains: Vector[Blockchain]
  8. implicit val chainConfig: ChainAppConfig
    Definition Classes
    ChainHandlerCachedChainHandler
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  10. def copyWith(blockHeaderDAO: BlockHeaderDAO = blockHeaderDAO, filterHeaderDAO: CompactFilterHeaderDAO = filterHeaderDAO, filterDAO: CompactFilterDAO = filterDAO, blockFilterCheckpoints: Map[DoubleSha256DigestBE, DoubleSha256DigestBE] = blockFilterCheckpoints): ChainHandler
    Definition Classes
    ChainHandler
  11. def debug(mkr: Marker, msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  12. def debug(msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  13. def debug(msg: => Any): Unit
    Attributes
    protected
    Definition Classes
    Logging
  14. def epochSecondToBlockHeight(time: Long): Future[Int]

    Gets the block height of the closest block to the given time

    Gets the block height of the closest block to the given time

    Definition Classes
    ChainHandlerChainQueryApi
  15. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. def error(mkr: Marker, msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  17. def error(msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  18. def error(msg: => Any): Unit
    Attributes
    protected
    Definition Classes
    Logging
  19. val filterDAO: CompactFilterDAO
    Definition Classes
    ChainHandlerCachedChainHandler
  20. val filterHeaderDAO: CompactFilterHeaderDAO
    Definition Classes
    ChainHandlerCachedChainHandler
  21. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  22. def getBestBlockHash(): Future[DoubleSha256DigestBE]

    Gets the hash of the block that is what we consider "best"

    Gets the hash of the block that is what we consider "best"

    Definition Classes
    ChainHandlerChainQueryApi
  23. def getBestBlockHeader(): Future[BlockHeaderDb]

    Gets the best block header from the given blockchains parameter

    Gets the best block header from the given blockchains parameter

    Definition Classes
    ChainHandlerCachedChainHandlerChainApi
  24. def getBestBlockHeaderHelper(chains: Vector[Blockchain]): BlockHeaderDb

    Given a set of blockchains, determines which one has the best header

    Given a set of blockchains, determines which one has the best header

    Attributes
    protected
    Definition Classes
    ChainHandler
  25. def getBestFilter(): Future[Option[CompactFilterDb]]
    Definition Classes
    ChainHandlerChainApi
  26. def getBestFilterHeader(): Future[Option[CompactFilterHeaderDb]]

    Finds the "best" filter header we have stored in our database What this means in practice is the latest filter header we have received from our peer.

    Finds the "best" filter header we have stored in our database What this means in practice is the latest filter header we have received from our peer. Returns none if we have no filters in the database

    Definition Classes
    ChainHandlerCachedChainHandlerChainApi
  27. def getBestFilterHeaderWithChains(blockchains: Vector[Blockchain]): Future[Option[CompactFilterHeaderDb]]
    Attributes
    protected
    Definition Classes
    ChainHandler
  28. def getBestHashBlockHeight()(implicit ec: ExecutionContext): Future[Int]
    Definition Classes
    ChainQueryApi
  29. def getBlockCount(): Future[Int]

    Gets the number of blocks in the database

    Gets the number of blocks in the database

    Definition Classes
    ChainHandlerChainApi
  30. def getBlockHeight(blockHash: DoubleSha256DigestBE): Future[Option[Int]]

    Gets the height of the given block

    Gets the height of the given block

    Definition Classes
    ChainHandlerChainQueryApi
  31. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  32. def getFilter(blockHash: DoubleSha256DigestBE): Future[Option[CompactFilterDb]]

    Looks up a compact filter by its hash.

    Looks up a compact filter by its hash.

    Definition Classes
    ChainHandlerChainApi
  33. def getFilterCount(): Future[Int]

    Gets the number of compact filters in the database

    Gets the number of compact filters in the database

    Definition Classes
    ChainHandlerChainApiChainQueryApi
  34. def getFilterHeader(blockHash: DoubleSha256DigestBE): Future[Option[CompactFilterHeaderDb]]

    Looks up a compact filter header by its hash.

    Looks up a compact filter header by its hash.

    Definition Classes
    ChainHandlerChainApi
  35. def getFilterHeaderCount(): Future[Int]

    Gets the number of compact filter headers in the database

    Gets the number of compact filter headers in the database

    Definition Classes
    ChainHandlerChainApi
  36. def getFilterHeadersAtHeight(height: Int): Future[Vector[CompactFilterHeaderDb]]

    Looks up a compact filter header by its height.

    Looks up a compact filter header by its height.

    Definition Classes
    ChainHandlerChainApi
  37. def getFiltersAtHeight(height: Int): Future[Vector[CompactFilterDb]]

    Looks up a compact filter by its height.

    Looks up a compact filter by its height.

    Definition Classes
    ChainHandlerChainApi
  38. def getFiltersBetweenHeights(startHeight: Int, endHeight: Int): Future[Vector[FilterResponse]]
    Definition Classes
    ChainHandlerChainQueryApi
  39. def getHeader(hash: DoubleSha256DigestBE): Future[Option[BlockHeaderDb]]

    Gets a org.bitcoins.core.api.chain.db.BlockHeaderDb from the chain's database

    Gets a org.bitcoins.core.api.chain.db.BlockHeaderDb from the chain's database

    Definition Classes
    ChainHandlerChainApi
  40. def getHeaders(hashes: Vector[DoubleSha256DigestBE]): Future[Vector[Option[BlockHeaderDb]]]
    Definition Classes
    ChainHandlerChainApi
  41. def getHeadersAtHeight(height: Int): Future[Vector[BlockHeaderDb]]

    Gets all org.bitcoins.core.api.chain.db.BlockHeaderDbs at a given height

    Definition Classes
    ChainHandlerChainApi
  42. def getHeadersBetween(from: BlockHeaderDb, to: BlockHeaderDb): Future[Vector[BlockHeaderDb]]

    Fetchs the block headers between from and to (inclusive).

    Fetchs the block headers between from and to (inclusive).

    Definition Classes
    ChainHandlerChainApi
  43. def getHeightByBlockStamp(blockStamp: BlockStamp): Future[Int]

    Returns the block height of the given block stamp

    Returns the block height of the given block stamp

    Definition Classes
    ChainHandlerChainApiChainQueryApi
  44. def getMedianTimePast(): Future[Long]

    calculates the median time passed

    calculates the median time passed

    Definition Classes
    ChainHandlerChainQueryApi
  45. def getNumberOfConfirmations(blockHash: DoubleSha256DigestBE): Future[Option[Int]]

    Gets number of confirmations for the given block hash

    Gets number of confirmations for the given block hash

    Definition Classes
    ChainHandlerChainQueryApi
  46. def info(mkr: Marker, msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  47. def info(msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  48. def info(msg: => Any): Unit
    Attributes
    protected
    Definition Classes
    Logging
  49. def isDebugEnabled: Boolean
    Attributes
    protected
    Definition Classes
    Logging
  50. def isErrorEnabled: Boolean
    Attributes
    protected
    Definition Classes
    Logging
  51. def isInfoEnabled: Boolean
    Attributes
    protected
    Definition Classes
    Logging
  52. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  53. def isMissingChainWork: Future[Boolean]
    Definition Classes
    ChainHandler
  54. def isTraceEnabled: Boolean
    Attributes
    protected
    Definition Classes
    Logging
  55. def isWarnEnabled: Boolean
    Attributes
    protected
    Definition Classes
    Logging
  56. def logger: Logger
    Attributes
    protected
    Definition Classes
    Logging
  57. def loggerName: String
    Attributes
    protected
    Definition Classes
    Logging
  58. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  59. def nextBlockHeaderBatchRange(prevStopHash: DoubleSha256DigestBE, batchSize: Int): Future[Option[FilterSyncMarker]]

    Generates a block range in form of (startHeight, stopHash) by the given stop hash.

    Generates a block range in form of (startHeight, stopHash) by the given stop hash.

    Definition Classes
    ChainHandlerCachedChainHandlerChainApi
  60. def nextBlockHeaderBatchRangeWithChains(prevStopHash: DoubleSha256DigestBE, batchSize: Int, blockchains: Vector[Blockchain]): Future[Option[FilterSyncMarker]]
    Attributes
    protected
    Definition Classes
    ChainHandler
  61. def nextFilterHeaderBatchRange(filterHeight: Int, batchSize: Int): Future[Option[FilterSyncMarker]]

    Generates a filter header range in form of (startHeight, stopHash) by the given stop hash.

    Generates a filter header range in form of (startHeight, stopHash) by the given stop hash.

    Definition Classes
    ChainHandlerChainApi
  62. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  63. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  64. def processCheckpoint(filterHeaderHash: DoubleSha256DigestBE, blockHash: DoubleSha256DigestBE): Future[ChainApi]

    Adds a compact filter header check point into the list of check points.

    Adds a compact filter header check point into the list of check points.

    Definition Classes
    ChainApi
  65. def processCheckpoints(checkpoints: Vector[DoubleSha256DigestBE], blockHash: DoubleSha256DigestBE): Future[ChainApi]

    Process all ompact filter header check points.

    Process all ompact filter header check points.

    Definition Classes
    ChainHandlerChainApi
  66. def processFilter(message: CompactFilterMessage): Future[ChainApi]

    Adds a compact filter into the filter database.

    Adds a compact filter into the filter database.

    Definition Classes
    ChainApi
  67. def processFilterHeader(filterHeader: FilterHeader, blockHash: DoubleSha256DigestBE): Future[ChainApi]

    Adds a compact filter header into the filter header chain and returns a new chain api that contains this header

    Adds a compact filter header into the filter header chain and returns a new chain api that contains this header

    Definition Classes
    ChainApi
  68. def processFilterHeaders(filterHeaders: Vector[FilterHeader], stopHash: DoubleSha256DigestBE): Future[ChainApi]

    Process all of the given compact filter headers and returns a new chain api that contains these headers.

    Process all of the given compact filter headers and returns a new chain api that contains these headers.

    Definition Classes
    ChainHandlerChainApi
  69. def processFilters(messages: Vector[CompactFilterMessage]): Future[ChainApi]

    Process all of the given compact filters and returns a new chain api that contains these headers.

    Process all of the given compact filters and returns a new chain api that contains these headers.

    Definition Classes
    ChainHandlerChainApi
  70. def processHeader(header: BlockHeader): Future[ChainApi]

    Adds a block header to our chain project.

    Adds a block header to our chain project. This will return a failed future when the given header is invalid.

    Definition Classes
    ChainApi
  71. def processHeaders(headers: Vector[BlockHeader]): Future[ChainApi]

    Process all of the given headers and returns a new chain api that contains these headers.

    Process all of the given headers and returns a new chain api that contains these headers. This method processes headers in the order that they are given. If the headers are out of order, this method will fail.

    This method will also fail when there are zero headers given that are valid.

    Definition Classes
    ChainHandlerCachedChainHandlerChainApi
  72. def processHeadersWithChains(headers: Vector[BlockHeader], blockchains: Vector[Blockchain]): Future[ChainApi]
    Attributes
    protected
    Definition Classes
    ChainHandler
  73. def productElementNames: Iterator[String]
    Definition Classes
    Product
  74. def recalculateChainWork: Future[ChainHandler]
    Definition Classes
    ChainHandler
  75. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  76. def toChainHandlerCached: Future[ChainHandlerCached]
    Definition Classes
    ChainHandler
  77. def trace(mkr: Marker, msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  78. def trace(msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  79. def trace(msg: => Any): Unit
    Attributes
    protected
    Definition Classes
    Logging
  80. def verifyFilterHeaders(filterHeaders: Vector[CompactFilterHeaderDb]): Future[Unit]

    Verifies if the previous headers exist either in the batch filterHeaders or in the database, throws if it doesn't

    Verifies if the previous headers exist either in the batch filterHeaders or in the database, throws if it doesn't

    Definition Classes
    ChainHandler
  81. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  82. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  83. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  84. def warn(mkr: Marker, msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  85. def warn(msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  86. def warn(msg: => Any): Unit
    Attributes
    protected
    Definition Classes
    Logging

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from ChainHandler

Inherited from ChainVerificationLogger

Inherited from Logging

Inherited from ChainApi

Inherited from ChainQueryApi

Inherited from AnyRef

Inherited from Any

Ungrouped