Collators get incoming parachain messages (#149)

* refactor out a consensus data fetcher from table router

* move statement checking logic into router

* refuse to start authority if collator

* support building the table router asynchronously

* instantiate_consensus does not overwrite old

* update key in new consensus if there was none before

* collator collects ingress from network

* test produced egress roots

* fix adder-collator compilation

* address first grumbles

* integrate new gossip with collator network launch

* address review
This commit is contained in:
Robert Habermeier
2019-03-22 00:48:36 +01:00
committed by GitHub
parent 67275abe30
commit 454ddf8921
16 changed files with 960 additions and 657 deletions
+13 -7
View File
@@ -32,6 +32,7 @@ extern crate arrayvec;
extern crate parking_lot;
extern crate tokio;
extern crate slice_group_by;
extern crate exit_future;
#[macro_use]
extern crate futures;
@@ -66,7 +67,6 @@ use self::local_collations::LocalCollations;
use std::collections::{HashMap, HashSet};
#[cfg(test)]
mod tests;
@@ -213,10 +213,13 @@ impl PolkadotProtocol {
fn new_validation_session(
&mut self,
ctx: &mut Context<Block>,
parent_hash: Hash,
session: validation::ValidationSession,
) {
if let Some(new_local) = self.live_validation_sessions.new_validation_session(parent_hash, session) {
params: validation::SessionParams,
) -> validation::ValidationSession {
let (session, new_local) = self.live_validation_sessions
.new_validation_session(params);
if let Some(new_local) = new_local {
for (id, peer_data) in self.peers.iter_mut()
.filter(|&(_, ref info)| info.should_send_key())
{
@@ -227,10 +230,13 @@ impl PolkadotProtocol {
));
}
}
session
}
fn remove_validation_session(&mut self, parent_hash: &Hash) {
self.live_validation_sessions.remove(parent_hash);
// true indicates that it was removed actually.
fn remove_validation_session(&mut self, parent_hash: Hash) -> bool {
self.live_validation_sessions.remove(parent_hash)
}
fn dispatch_pending_requests(&mut self, ctx: &mut Context<Block>) {