Skip to content

Commit

Permalink
fix: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
atanmarko committed Jun 24, 2024
1 parent dff9f29 commit 0ac615d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions zero_bin/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ where
let chain_id = provider.get_chain_id().await?;

let previous_block_numbers =
std::iter::successors(Some(target_block_number as i128), |&it| it.checked_sub(1))
.skip(1)
std::iter::successors(Some(target_block_number as i128 - 1), |&it| Some(it - 1))
.take(PREVIOUS_HASHES_SIZE)
.filter(|i| *i >= 0)
.collect::<Vec<_>>();
Expand Down Expand Up @@ -129,7 +128,7 @@ where
collected_hashes
.into_iter()
.flatten()
.filter(|(_, block_num)| block_num.is_some_and(|v| v as u64 != target_block_number))
.filter(|(_, block_num)| block_num.is_some())
.for_each(|(hash, block_num)| {
if let (Some(hash), Some(block_num)) = (hash, block_num) {
// Most recent previous block hash is expected at the end of the array
Expand Down

0 comments on commit 0ac615d

Please sign in to comment.