case class ChainHandlerCached(blockHeaderDAO: BlockHeaderDAO, filterHeaderDAO: CompactFilterHeaderDAO, filterDAO: CompactFilterDAO, stateDAO: ChainStateDescriptorDAO, 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
- Alphabetic
- By Inheritance
- ChainHandlerCached
- Serializable
- Product
- Equals
- ChainHandler
- ChainVerificationLogger
- BitcoinSLogger
- ChainApi
- ChainQueryApi
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new ChainHandlerCached(blockHeaderDAO: BlockHeaderDAO, filterHeaderDAO: CompactFilterHeaderDAO, filterDAO: CompactFilterDAO, stateDAO: ChainStateDescriptorDAO, blockchains: Vector[Blockchain], blockFilterCheckpoints: Map[DoubleSha256DigestBE, DoubleSha256DigestBE])(implicit chainConfig: ChainAppConfig, executionContext: ExecutionContext)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val blockFilterCheckpoints: Map[DoubleSha256DigestBE, DoubleSha256DigestBE]
- Definition Classes
- ChainHandlerCached → ChainHandler
- val blockHeaderDAO: BlockHeaderDAO
- Definition Classes
- ChainHandlerCached → ChainHandler
- val blockchains: Vector[Blockchain]
- implicit val chainConfig: ChainAppConfig
- Definition Classes
- ChainHandlerCached → ChainHandler
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def copyWith(blockHeaderDAO: BlockHeaderDAO = blockHeaderDAO, filterHeaderDAO: CompactFilterHeaderDAO = filterHeaderDAO, filterDAO: CompactFilterDAO = filterDAO, stateDAO: ChainStateDescriptorDAO = stateDAO, blockFilterCheckpoints: Map[DoubleSha256DigestBE, DoubleSha256DigestBE] = blockFilterCheckpoints): ChainHandler
- Definition Classes
- ChainHandler
- 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
- ChainHandler → ChainQueryApi
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- val filterDAO: CompactFilterDAO
- Definition Classes
- ChainHandlerCached → ChainHandler
- val filterHeaderDAO: CompactFilterHeaderDAO
- Definition Classes
- ChainHandlerCached → ChainHandler
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- 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
- ChainHandler → ChainQueryApi
- 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
- ChainHandlerCached → ChainHandler → ChainApi
- 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
- def getBestChainTips(): Future[Vector[BlockHeaderDb]]
Gets all chain tips with the heaviest work
Gets all chain tips with the heaviest work
- Definition Classes
- ChainHandler → ChainApi
- def getBestFilter(): Future[Option[CompactFilterDb]]
- Definition Classes
- ChainHandler → ChainApi
- 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
- ChainHandlerCached → ChainHandler → ChainApi
- def getBestFilterHeaderWithChains(blockchains: Vector[Blockchain]): Future[Option[CompactFilterHeaderDb]]
- Attributes
- protected
- Definition Classes
- ChainHandler
- def getBestHashBlockHeight()(implicit ec: ExecutionContext): Future[Int]
- Definition Classes
- ChainQueryApi
- def getBlockCount(): Future[Int]
Gets the number of blocks in the database
Gets the number of blocks in the database
- Definition Classes
- ChainHandler → ChainApi
- def getBlockHeight(blockHash: DoubleSha256DigestBE): Future[Option[Int]]
Gets the height of the given block
Gets the height of the given block
- Definition Classes
- ChainHandler → ChainQueryApi
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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
- ChainHandler → ChainApi
- def getFilterCount(): Future[Int]
Gets the number of compact filters in the database
Gets the number of compact filters in the database
- Definition Classes
- ChainHandler → ChainApi → ChainQueryApi
- 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
- ChainHandler → ChainApi
- 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
- ChainHandler → ChainApi
- 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
- ChainHandler → ChainApi
- 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
- ChainHandler → ChainApi
- def getFiltersBetweenHeights(startHeight: Int, endHeight: Int): Future[Vector[FilterResponse]]
- Definition Classes
- ChainHandler → ChainQueryApi
- 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
- ChainHandler → ChainApi
- def getHeaders(hashes: Vector[DoubleSha256DigestBE]): Future[Vector[Option[BlockHeaderDb]]]
- Definition Classes
- ChainHandler → ChainApi
- def getHeadersAtHeight(height: Int): Future[Vector[BlockHeaderDb]]
Gets all org.bitcoins.core.api.chain.db.BlockHeaderDbs at a given height
Gets all org.bitcoins.core.api.chain.db.BlockHeaderDbs at a given height
- Definition Classes
- ChainHandler → ChainApi
- 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
- ChainHandler → ChainApi
- 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
- ChainHandler → ChainApi → ChainQueryApi
- def getMedianTimePast(): Future[Long]
calculates the median time passed
calculates the median time passed
- Definition Classes
- ChainHandler → ChainQueryApi
- 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
- ChainHandler → ChainQueryApi
- def isIBD(): Future[Boolean]
- Definition Classes
- ChainHandler → ChainApi
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isMissingChainWork: Future[Boolean]
- Definition Classes
- ChainHandler
- def isSyncing(): Future[Boolean]
- Definition Classes
- ChainHandler → ChainApi
- def isTipStale(): Future[Boolean]
Checks if our chain tip is stale
Checks if our chain tip is stale
- def logger: Logger
- Definition Classes
- BitcoinSLogger
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def nextBlockHeaderBatchRange(prevStopHash: DoubleSha256DigestBE, stopHash: 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. Returns None if we are synced
- prevStopHash
our previous block hash where filter header sync stopped
- stopHash
the block hash we want to sync the new batch of filters to
- batchSize
the batch size of filter headers
- Definition Classes
- ChainHandler → ChainApi
- def nextFilterHeaderBatchRange(stopBlockHash: DoubleSha256DigestBE, batchSize: Int, startHeightOpt: Option[Int]): Future[Option[FilterSyncMarker]]
Generates a query for a range of compact filters
Generates a query for a range of compact filters
- stopBlockHash
the block hash to stop receiving filters at
- startHeightOpt
the block height to start syncing filters from. If None, we query our chainstate for the last filter we've seen
- Definition Classes
- ChainHandler → ChainApi
- final def nextFilterHeaderBatchRange(stopBlockHash: DoubleSha256DigestBE, 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
- ChainApi
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- 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
- def processCheckpoints(checkpoints: Vector[DoubleSha256DigestBE], blockHash: DoubleSha256DigestBE): Future[ChainApi]
Process all compact filter header check points.
Process all compact filter header check points.
- Definition Classes
- ChainHandler → ChainApi
- 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
- 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
- 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
- ChainHandler → ChainApi
- 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
- ChainHandler → ChainApi
- 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
- 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
- ChainHandlerCached → ChainHandler → ChainApi
- def processHeadersWithChains(headers: Vector[BlockHeader], blockchains: Vector[Blockchain]): Future[ChainApi]
- Attributes
- protected
- Definition Classes
- ChainHandler
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def recalculateChainWork: Future[ChainHandler]
- Definition Classes
- ChainHandler
- def setIBD(value: Boolean): Future[ChainApi]
- Definition Classes
- ChainHandler → ChainApi
- def setSyncing(value: Boolean): Future[ChainApi]
- Definition Classes
- ChainHandler → ChainApi
- val stateDAO: ChainStateDescriptorDAO
- Definition Classes
- ChainHandlerCached → ChainHandler
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toChainHandlerCached: Future[ChainHandlerCached]
- Definition Classes
- ChainHandler
- 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
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()