mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 10:27:59 +00:00
Make sure that the start_collator future implements Send (#915)
Co-authored-by: Gav Wood <gavin@parity.io>
This commit is contained in:
@@ -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(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user