Skip to content

Commit

Permalink
edge case not needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
LesnyRumcajs committed Oct 30, 2024
1 parent 434fb3a commit f5d1adb
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/cli/subcommands/chain_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,7 @@ fn maybe_confirm(no_confirm: bool, prompt: impl Into<String>) -> anyhow::Result<
/// Print the first `n` tipsets from the head (inclusive).
async fn print_chain_head(client: &rpc::Client, n: u64) -> anyhow::Result<()> {
ensure!(n > 0, "number of tipsets must be positive");
let head = ChainHead::call(client, ()).await?;
let current_epoch = head.epoch() as u64;

// edge case for, e.g., stateless nodes.
if current_epoch == 0 {
println!("[0]");
print_rpc_res_cids(head)?;
return Ok(());
}
let current_epoch = ChainHead::call(client, ()).await?.epoch() as u64;

for epoch in (current_epoch.saturating_sub(n - 1)..=current_epoch).rev() {
let tipset = tipset_by_epoch_or_offset(client, epoch.try_into()?).await?;
Expand Down

0 comments on commit f5d1adb

Please sign in to comment.