Generalize the Consensus Infrastructure (#883)

* Split out Consensus
* Supply ImportQueue through network-service
  - simplify ImportQueue.import_blocks
  - remove Deadlock on import_block
  - Adding Verifier-Trait
  - Implement import_queue provisioning in service; allow cli to import
* Allow to actually customize import queue
* Consensus Gossip: Cache Message hash per Topic
This commit is contained in:
Benjamin Kampmann
2018-10-16 13:40:33 +02:00
committed by GitHub
parent a24e61cb29
commit ac4bcf879f
61 changed files with 1937 additions and 3306 deletions
+3 -13
View File
@@ -625,22 +625,12 @@ mod tests {
type In = Box<Stream<Item=Vec<u8>,Error=()>>;
fn messages_for(&self, round: u64) -> Self::In {
use network::consensus_gossip::ConsensusMessage;
let messages = self.inner.lock().peer(self.peer_id)
.with_spec(|spec, _| spec.gossip.messages_for(round_to_topic(round)));
let messages = messages
.map_err(
move |_| panic!("Messages for round {} dropped too early", round)
)
.map(|msg| match msg {
ConsensusMessage::ChainSpecific(raw, _) => {
let message = GossipMessage::decode(&mut &raw[..]).unwrap();
message.data
}
_ => panic!("Only chain-specific messages come under this stream"),
});
let messages = messages.map_err(
move |_| panic!("Messages for round {} dropped too early", round)
);
Box::new(messages)
}