Allow many attestation instances to live at once in network (#46)

* multiple consensus sessions in network

* tests compile, add a test for RecentSessionKeys

* track recently received session keys from validators

* add a test for desired key-sending behavior
This commit is contained in:
Robert Habermeier
2018-11-28 15:14:06 +01:00
committed by Gav Wood
parent 7b46856159
commit e008813f8b
6 changed files with 437 additions and 156 deletions
+9 -1
View File
@@ -36,7 +36,8 @@ use std::collections::{HashMap, HashSet};
use std::io;
use std::sync::Arc;
use super::{NetworkService, Knowledge};
use consensus::Knowledge;
use super::NetworkService;
fn attestation_topic(parent_hash: Hash) -> Hash {
let mut v = parent_hash.as_ref().to_vec();
@@ -242,6 +243,13 @@ impl<P: ProvideRuntimeApi + Send> TableRouter for Router<P>
}
}
impl<P> Drop for Router<P> {
fn drop(&mut self) {
let parent_hash = &self.parent_hash;
self.network.with_spec(|spec, _| spec.remove_consensus(parent_hash));
}
}
/// Receiver for block data.
pub struct BlockDataReceiver {
inner: ::futures::sync::oneshot::Receiver<BlockData>,