From 9f553eb7ca2ede06829b2fae0ac9e2e9aa1bfc27 Mon Sep 17 00:00:00 2001 From: Sergei Shulepov Date: Fri, 23 Feb 2024 22:14:22 +0700 Subject: [PATCH] shim/cli: query best block by default --- ikura/shim/src/cli.rs | 2 +- ikura/shim/src/cmd/query/mod.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ikura/shim/src/cli.rs b/ikura/shim/src/cli.rs index 9cb05945..4e391732 100644 --- a/ikura/shim/src/cli.rs +++ b/ikura/shim/src/cli.rs @@ -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, /// By default, if the block is not available (e.g. not yet produced), the shim will return immediately. /// diff --git a/ikura/shim/src/cmd/query/mod.rs b/ikura/shim/src/cmd/query/mod.rs index eb50e461..bafeb53e 100644 --- a/ikura/shim/src/cmd/query/mod.rs +++ b/ikura/shim/src/cmd/query/mod.rs @@ -23,9 +23,9 @@ pub async fn get_block_at( block: BlockParams, ) -> anyhow::Result { 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)