Commit a2dbe42f authored by Cecile Tonglet's avatar Cecile Tonglet
Browse files

WIP

Forked at: 77de8b91
Parent branch: origin/master
parent e449dc9c
Pipeline #84999 failed with stage
in 10 minutes and 41 seconds
...@@ -66,7 +66,7 @@ use polkadot_cli::{ ...@@ -66,7 +66,7 @@ use polkadot_cli::{
ProvideRuntimeApi, AbstractService, ParachainHost, IsKusama, ProvideRuntimeApi, AbstractService, ParachainHost, IsKusama,
service::{self, Roles} service::{self, Roles}
}; };
pub use polkadot_cli::{VersionInfo, load_spec, service::Configuration}; pub use polkadot_cli::service::Configuration;
pub use polkadot_validation::SignedStatement; pub use polkadot_validation::SignedStatement;
pub use polkadot_primitives::parachain::CollatorId; pub use polkadot_primitives::parachain::CollatorId;
pub use sc_network::PeerId; pub use sc_network::PeerId;
...@@ -343,7 +343,7 @@ where ...@@ -343,7 +343,7 @@ where
P::ParachainContext: Send + 'static, P::ParachainContext: Send + 'static,
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send, <P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
{ {
let is_kusama = config.expect_chain_spec().is_kusama(); let is_kusama = config.chain_spec.is_kusama();
match (is_kusama, config.roles) { match (is_kusama, config.roles) {
(_, Roles::LIGHT) => return Err( (_, Roles::LIGHT) => return Err(
polkadot_service::Error::Other("light nodes are unsupported as collator".into()) polkadot_service::Error::Other("light nodes are unsupported as collator".into())
...@@ -375,45 +375,6 @@ fn compute_targets(para_id: ParaId, session_keys: &[ValidatorId], roster: DutyRo ...@@ -375,45 +375,6 @@ fn compute_targets(para_id: ParaId, session_keys: &[ValidatorId], roster: DutyRo
.collect() .collect()
} }
/// Run a collator node with the given `RelayChainContext` and `ParachainContext`
/// built by the given `BuildParachainContext` and arguments to the underlying polkadot node.
///
/// This function blocks until done.
pub fn run_collator<P>(
build_parachain_context: P,
para_id: ParaId,
key: Arc<CollatorPair>,
config: Configuration,
) -> polkadot_cli::Result<()> where
P: BuildParachainContext,
P::ParachainContext: Send + 'static,
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
{
match (config.expect_chain_spec().is_kusama(), config.roles) {
(_, Roles::LIGHT) => return Err(
polkadot_cli::Error::Input("light nodes are unsupported as collator".into())
).into(),
(true, _) =>
sc_cli::run_service_until_exit(config, |config| {
build_collator_service(
service::kusama_new_full(config, Some((key.public(), para_id)), None, false, 6000, None)?,
para_id,
key,
build_parachain_context,
)
}),
(false, _) =>
sc_cli::run_service_until_exit(config, |config| {
build_collator_service(
service::polkadot_new_full(config, Some((key.public(), para_id)), None, false, 6000, None)?,
para_id,
key,
build_parachain_context,
)
}),
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment