Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/master' into extract-syncing-out…
…-of-sc-network
  • Loading branch information
altonen committed Mar 6, 2023
commit 9c2c4149b27c32300324d24b6a15b3403e294f1c
50 changes: 0 additions & 50 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,56 +666,6 @@ impl IsCollator {
}
}

/// Returns the active leaves the overseer should start with.
#[cfg(feature = "full-node")]
async fn active_leaves<RuntimeApi, ExecutorDispatch>(
select_chain: &impl SelectChain<Block>,
client: &FullClient<RuntimeApi, ExecutorDispatch>,
) -> Result<Vec<BlockInfo>, Error>
where
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>
+ Send
+ Sync
+ 'static,
RuntimeApi::RuntimeApi:
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
ExecutorDispatch: NativeExecutionDispatch + 'static,
{
let best_block = select_chain.best_chain().await?;

let mut leaves = select_chain
.leaves()
.await
.unwrap_or_default()
.into_iter()
.filter_map(|hash| {
let number = HeaderBackend::number(client, hash).ok()??;

// Only consider leaves that are in maximum an uncle of the best block.
if number < best_block.number().saturating_sub(1) {
return None;
} else if hash == best_block.hash() {
return None;
};

let parent_hash = client.header(hash).ok()??.parent_hash;

Some(BlockInfo { hash, parent_hash, number })
})
.collect::<Vec<_>>();

// Sort by block number and get the maximum number of leaves
leaves.sort_by_key(|b| b.number);

leaves.push(BlockInfo {
hash: best_block.hash(),
parent_hash: *best_block.parent_hash(),
number: *best_block.number(),
});

Ok(leaves.into_iter().rev().take(MAX_ACTIVE_LEAVES).collect())
}

pub const AVAILABILITY_CONFIG: AvailabilityConfig = AvailabilityConfig {
col_data: parachains_db::REAL_COLUMNS.col_availability_data,
col_meta: parachains_db::REAL_COLUMNS.col_availability_meta,
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.