Make basic collation working

This commit is contained in:
Bastian Köcher
2019-10-18 14:16:32 +02:00
parent d9c6bc408c
commit b5bc9a21a3
12 changed files with 506 additions and 292 deletions
+5 -5
View File
@@ -66,12 +66,12 @@ pub struct HeadUpdate {
/// Helper for the Polkadot client. This is expected to be a lightweight handle
/// like an `Arc`.
pub trait PolkadotClient: Clone {
pub trait PolkadotClient: Clone + 'static {
/// The error type for interacting with the Polkadot client.
type Error: std::fmt::Debug + Send;
/// A stream that yields finalized head-data for a certain parachain.
type Finalized: Stream<Item = Vec<u8>> + Send;
type Finalized: Stream<Item = Vec<u8>> + Send + Unpin;
/// Get a stream of finalized heads.
fn finalized_heads(&self, para_id: ParaId) -> ClientResult<Self::Finalized>;
@@ -85,11 +85,11 @@ pub trait PolkadotClient: Clone {
}
/// Spawns a future that follows the Polkadot relay chain for the given parachain.
pub fn follow_polkadot<'a, L: 'a, P: 'a>(para_id: ParaId, local: Arc<L>, polkadot: P)
-> ClientResult<impl Future<Output = ()> + Send + 'a>
pub fn follow_polkadot<L, P>(para_id: ParaId, local: Arc<L>, polkadot: P)
-> ClientResult<impl Future<Output = ()> + Send + Unpin>
where
L: LocalClient + Send + Sync,
P: PolkadotClient + Send + Sync,
P: PolkadotClient,
{
let finalized_heads = polkadot.finalized_heads(para_id)?;