From f6981d6cf727dd34c4a6137472c03e5fc21c29d7 Mon Sep 17 00:00:00 2001 From: Alastair Holmes <42404303+AlastairHolmes@users.noreply.github.com> Date: Tue, 7 Nov 2023 11:19:11 +0100 Subject: [PATCH] cleanup scc (#4213) cleanup --- engine/src/state_chain_observer/client/mod.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/engine/src/state_chain_observer/client/mod.rs b/engine/src/state_chain_observer/client/mod.rs index 7e49d013b9..f517d8b9b0 100644 --- a/engine/src/state_chain_observer/client/mod.rs +++ b/engine/src/state_chain_observer/client/mod.rs @@ -212,7 +212,7 @@ async fn create_finalized_block_subscription< "sparse_finalized_block_header_stream unexpectedly ended" ))))); - let mut sparse_finalized_block_header_stream = Box::pin( + let mut finalized_block_header_stream = Box::pin( inject_intervening_headers( sparse_finalized_block_header_stream, base_rpc_client.clone(), @@ -221,9 +221,9 @@ async fn create_finalized_block_subscription< ); let latest_finalized_header: state_chain_runtime::Header = - sparse_finalized_block_header_stream.next().await.unwrap()?; + finalized_block_header_stream.next().await.unwrap()?; - sparse_finalized_block_header_stream + finalized_block_header_stream .make_try_cached(latest_finalized_header, |header| header.clone()) }; @@ -418,7 +418,6 @@ async fn inject_intervening_headers< let stream_rest = utilities::assert_stream_send( sparse_block_header_stream .and_then({ - // 1 let mut latest_finalized_header = latest_finalized_header.clone(); move |next_finalized_header| { assert!( @@ -432,7 +431,6 @@ async fn inject_intervening_headers< ); let base_rpc_client = base_rpc_client.clone(); - // 2 async move { let base_rpc_client = &base_rpc_client; let intervening_headers: Vec<_> = futures::stream::iter( @@ -451,7 +449,6 @@ async fn inject_intervening_headers< .try_collect() .await?; - // 3 for (block_hash, next_block_header) in Iterator::zip( std::iter::once(&prev_finalized_header.hash()) .chain(intervening_headers.iter().map(|(hash, _header)| hash)), @@ -463,7 +460,6 @@ async fn inject_intervening_headers< assert_eq!(*block_hash, next_block_header.parent_hash); } - // 4 Result::<_, anyhow::Error>::Ok(futures::stream::iter( intervening_headers .into_iter()