Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions zebra-state/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added `ReadRequest::IsTransparentOutputSpent` and `ReadResponse::IsTransparentOutputSpent` to the read state service ([#10235](https://github.com/ZcashFoundation/zebra/pull/10235))
- Added `{ReadRequest, Request}::AnyChainBlock` to the read state service ([#10325](https://github.com/ZcashFoundation/zebra/pull/10325))


## [4.0.0] - 2026-02-05
Expand Down
31 changes: 30 additions & 1 deletion zebra-state/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,18 @@ pub enum Request {
/// [`block::Height`] using `.into()`.
Block(HashOrHeight),

/// Looks up a block by hash in any current chain or by height in the current best chain.
///
/// Returns
///
/// * [`Response::Block(Some(Arc<Block>))`](Response::Block) if the block hash is in any chain, or,
/// if the block height is in the best chain;
/// * [`Response::Block(None)`](Response::Block) otherwise.
///
/// Note: the [`HashOrHeight`] can be constructed from a [`block::Hash`] or
/// [`block::Height`] using `.into()`.
AnyChainBlock(HashOrHeight),

//// Same as Block, but also returns serialized block size.
////
/// Returns
Expand Down Expand Up @@ -1032,7 +1044,6 @@ impl Request {
match self {
Request::CommitSemanticallyVerifiedBlock(_) => "commit_semantically_verified_block",
Request::CommitCheckpointVerifiedBlock(_) => "commit_checkpoint_verified_block",

Request::AwaitUtxo(_) => "await_utxo",
Request::Depth(_) => "depth",
Request::Tip => "tip",
Expand All @@ -1041,6 +1052,7 @@ impl Request {
Request::AnyChainTransaction(_) => "any_chain_transaction",
Request::UnspentBestChainUtxo { .. } => "unspent_best_chain_utxo",
Request::Block(_) => "block",
Request::AnyChainBlock(_) => "any_chain_block",
Request::BlockAndSize(_) => "block_and_size",
Request::BlockHeader(_) => "block_header",
Request::FindBlockHashes { .. } => "find_block_hashes",
Expand Down Expand Up @@ -1109,6 +1121,19 @@ pub enum ReadRequest {
/// [`block::Height`] using `.into()`.
Block(HashOrHeight),

/// Looks up a block by hash in any current chain or by height in the current best chain.
///
/// Returns
///
/// * [`ReadResponse::Block(Some(Arc<Block>))`](ReadResponse::Block) if the block hash is in any chain, or
/// if the block height is in any chain, checking the best chain first
/// followed by side chains in order from most to least work.
/// * [`ReadResponse::Block(None)`](ReadResponse::Block) otherwise.
///
/// Note: the [`HashOrHeight`] can be constructed from a [`block::Hash`] or
/// [`block::Height`] using `.into()`.
AnyChainBlock(HashOrHeight),

//// Same as Block, but also returns serialized block size.
////
/// Returns
Expand Down Expand Up @@ -1393,6 +1418,7 @@ impl ReadRequest {
ReadRequest::BlockInfo(_) => "block_info",
ReadRequest::Depth(_) => "depth",
ReadRequest::Block(_) => "block",
ReadRequest::AnyChainBlock(_) => "any_chain_block",
ReadRequest::BlockAndSize(_) => "block_and_size",
ReadRequest::BlockHeader(_) => "block_header",
ReadRequest::Transaction(_) => "transaction",
Expand Down Expand Up @@ -1452,6 +1478,9 @@ impl TryFrom<Request> for ReadRequest {
Request::BestChainBlockHash(hash) => Ok(ReadRequest::BestChainBlockHash(hash)),

Request::Block(hash_or_height) => Ok(ReadRequest::Block(hash_or_height)),
Request::AnyChainBlock(hash_or_height) => {
Ok(ReadRequest::AnyChainBlock(hash_or_height))
}
Request::BlockAndSize(hash_or_height) => Ok(ReadRequest::BlockAndSize(hash_or_height)),
Request::BlockHeader(hash_or_height) => Ok(ReadRequest::BlockHeader(hash_or_height)),
Request::Transaction(tx_hash) => Ok(ReadRequest::Transaction(tx_hash)),
Expand Down
Loading
Loading