Unverified Commit 1c9cf042 authored by Ashley's avatar Ashley
Browse files

Final changes to validation

parent 322cca52
......@@ -59,8 +59,8 @@ use txpool_api::{TransactionPool, InPoolTransaction};
use attestation_service::ServiceHandle;
use futures::{
future::{self, Either, select}, FutureExt, StreamExt, Stream,
stream::unfold, task::{Spawn, SpawnExt},
future::{self, Either, select}, FutureExt, StreamExt, Stream, TryFutureExt, stream::unfold,
task::{Spawn, SpawnExt},
};
use collation::CollationFetch;
use dynamic_inclusion::DynamicInclusion;
......@@ -122,13 +122,16 @@ pub trait TableRouter: Clone {
/// A long-lived network which can create parachain statement and BFT message routing processes on demand.
pub trait Network {
/// The error type of asynchronously building the table router.
type Error: std::fmt::Debug;
/// The table router type. This should handle importing of any statements,
/// routing statements to peers, and driving completion of any `StatementProducers`.
type TableRouter: TableRouter;
/// The future used for asynchronously building the table router.
/// This should not fail.
type BuildTableRouter: futures::Future<Output=Self::TableRouter>;
type BuildTableRouter: futures::Future<Output=Result<Self::TableRouter,Self::Error>>;
/// Instantiate a table router using the given shared table.
/// Also pass through any outgoing messages to be broadcast to peers.
......@@ -406,7 +409,7 @@ impl<C, N, P> ParachainValidation<C, N, P> where
})
};
let router = build_router.map(with_router);
let router = build_router.map_ok(with_router);
let cancellable_work = select(exit, router).map(|_| ());
......
......@@ -267,13 +267,13 @@ pub struct ParachainWork<Fetch> {
max_block_data_size: Option<u64>,
}
impl<Fetch: futures::Future> ParachainWork<Fetch> {
impl<Fetch: futures::Future + Unpin> ParachainWork<Fetch> {
/// Prime the parachain work with an API reference for extracting
/// chain information.
pub fn prime<P: ProvideRuntimeApi>(self, api: Arc<P>)
-> PrimedParachainWork<
Fetch,
impl Send + FnMut(&BlockId, &Collation) -> Result<OutgoingMessages, ()>,
impl Send + FnMut(&BlockId, &Collation) -> Result<OutgoingMessages, ()> + Unpin,
>
where
P: Send + Sync + 'static,
......
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