Skip to content

Commit

Permalink
shim/cli: query best block by default
Browse files Browse the repository at this point in the history
  • Loading branch information
pepyakin authored and rphmeier committed Feb 23, 2024
1 parent ad11422 commit 8ee7ea8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ikura/shim/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pub mod query {
///
/// Hashes must be 32 bytes, hex-encoded, and prefixed with "0x".
#[arg(value_name = "BLOCK_REF")]
pub block_ref: BlockRef,
pub block_ref: Option<BlockRef>,

/// By default, if the block is not available (e.g. not yet produced), the shim will return immediately.
///
Expand Down
6 changes: 3 additions & 3 deletions ikura/shim/src/cmd/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ pub async fn get_block_at(
block: BlockParams,
) -> anyhow::Result<ikura_rpc::Block> {
let maybe_hash = match block.block_ref {
BlockRef::Best => None,
BlockRef::Hash(h) => Some(h),
BlockRef::Number(n) => Some(match block.wait {
None | Some(BlockRef::Best) => None,
Some(BlockRef::Hash(h)) => Some(h),
Some(BlockRef::Number(n)) => Some(match block.wait {
true => client.await_block_hash(n).await,
false => client
.block_hash(n)
Expand Down

0 comments on commit 8ee7ea8

Please sign in to comment.