Unverified Commit ba0efca4 authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

Make sure that the `start_collator` future implements `Send` (#915)


Co-authored-by: default avatarGav Wood <gavin@parity.io>
parent 8b9791dc
Pipeline #84019 failed with stages
in 9 minutes and 3 seconds
......@@ -343,7 +343,8 @@ where
P::ParachainContext: Send + 'static,
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
{
match (config.expect_chain_spec().is_kusama(), config.roles) {
let is_kusama = config.expect_chain_spec().is_kusama();
match (is_kusama, config.roles) {
(_, Roles::LIGHT) => return Err(
polkadot_service::Error::Other("light nodes are unsupported as collator".into())
).into(),
......@@ -435,4 +436,32 @@ mod tests {
))
}
}
struct BuildDummyParachainContext;
impl BuildParachainContext for BuildDummyParachainContext {
type ParachainContext = DummyParachainContext;
fn build<B, E, R, SP, Extrinsic>(
self,
_: Arc<PolkadotClient<B, E, R>>,
_: SP,
_: impl Network + Clone + 'static,
) -> Result<Self::ParachainContext, ()> {
Ok(DummyParachainContext)
}
}
// Make sure that the future returned by `start_collator` implementes `Send`.
#[test]
fn start_collator_is_send() {
fn check_send<T: Send>(_: T) {}
check_send(start_collator(
BuildDummyParachainContext,
0.into(),
Arc::new(CollatorPair::generate().0),
Default::default(),
));
}
}
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