Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shim/cli: query best block by default #253

Merged
merged 1 commit into from
Feb 23, 2024
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
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