Companion for substrate#9128 (#3268)

* support async selectchain

* update Substrate

Co-authored-by: parity-processbot <>
This commit is contained in:
André Silva
2021-06-20 12:39:20 +01:00
committed by GitHub
parent 03813cdc10
commit fc7f6dbfd9
2 changed files with 162 additions and 158 deletions
+156 -155
View File
File diff suppressed because it is too large Load Diff
+6 -3
View File
@@ -478,7 +478,7 @@ impl IsCollator {
/// Returns the active leaves the overseer should start with. /// Returns the active leaves the overseer should start with.
#[cfg(feature = "full-node")] #[cfg(feature = "full-node")]
fn active_leaves<RuntimeApi, Executor>( async fn active_leaves<RuntimeApi, Executor>(
select_chain: &sc_consensus::LongestChain<FullBackend, Block>, select_chain: &sc_consensus::LongestChain<FullBackend, Block>,
client: &FullClient<RuntimeApi, Executor>, client: &FullClient<RuntimeApi, Executor>,
) -> Result<Vec<BlockInfo>, Error> ) -> Result<Vec<BlockInfo>, Error>
@@ -488,10 +488,11 @@ where
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>, RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
Executor: NativeExecutionDispatch + 'static, Executor: NativeExecutionDispatch + 'static,
{ {
let best_block = select_chain.best_chain()?; let best_block = select_chain.best_chain().await?;
let mut leaves = select_chain let mut leaves = select_chain
.leaves() .leaves()
.await
.unwrap_or_default() .unwrap_or_default()
.into_iter() .into_iter()
.filter_map(|hash| { .filter_map(|hash| {
@@ -673,7 +674,9 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
let overseer_client = client.clone(); let overseer_client = client.clone();
let spawner = task_manager.spawn_handle(); let spawner = task_manager.spawn_handle();
let active_leaves = active_leaves(&select_chain, &*client)?; let active_leaves = futures::executor::block_on(
active_leaves(&select_chain, &*client)
)?;
let authority_discovery_service = if role.is_authority() || is_collator.is_collator() { let authority_discovery_service = if role.is_authority() || is_collator.is_collator() {
use sc_network::Event; use sc_network::Event;