Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
rebase issues
Browse files Browse the repository at this point in the history
  • Loading branch information
samelamin committed Dec 19, 2022
1 parent d4d36cc commit 351783a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
27 changes: 21 additions & 6 deletions client/network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,20 +453,35 @@ async fn wait_to_announce<Block: BlockT>(
}
}

#[derive(Clone)]
pub struct WaitForParachainTargetBlock<Block> {
phantom: PhantomData<Block>,
}

pub async fn warp_sync_get<B>(
para_id: ParaId,
relay_chain_interface: Arc<dyn RelayChainInterface>,
spawner: Arc<dyn SpawnNamed + Send + Sync>,
) -> Result<oneshot::Receiver<<B as BlockT>::Header>, BoxedError>
where
B: BlockT + 'static,
{
let (sender, receiver) = oneshot::channel::<B::Header>();
wait_for_target_block::<B>(sender, para_id, relay_chain_interface).await?;
spawner.spawn(
"cumulus-parachain-wait-for-target-block",
None,
async move {
tracing::debug!(
target: "cumulus-network",
"waiting for announce block in a background task...",
);
tracing::debug!(target: LOG_TARGET, "waiting for target block in a background task...",);
wait_for_target_block::<B>(sender, para_id, relay_chain_interface)
.await
.map_err(|e| {
tracing::error!(target: LOG_TARGET, "Unable to determine sync status. {}", e)
})
.unwrap();
tracing::debug!(target: LOG_TARGET, "target block reached",);
}
.boxed(),
);

return Ok(receiver)
}

Expand Down
1 change: 1 addition & 0 deletions client/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ where
let warp_sync_params = if let Ok(target_block) = cumulus_client_network::warp_sync_get::<Block>(
para_id,
Arc::new(relay_chain_interface.clone()),
Arc::new(task_manager.spawn_handle()),
)
.await
{
Expand Down

0 comments on commit 351783a

Please sign in to comment.