Adds construct_simple_protocol macro for simplifying the creation of protocols (#897)

* Make `on_message` take the message as `&mut Option<_>`

* Make `ConsensusGossip` implement `Specialization`

* Move `new_session` into `ConsensusGossip`

* Adds `construct_simple_protocol` macro for simplifying the creation of protocols
This commit is contained in:
Bastian Köcher
2018-10-12 13:10:36 +02:00
committed by Gav Wood
parent 671b0e0007
commit db427cb45c
7 changed files with 167 additions and 74 deletions
+1 -1
View File
@@ -275,7 +275,7 @@ impl<P: AuthoringApi + Send + Sync + 'static> Network for ConsensusNetwork<P> {
// spin up a task in the background that processes all incoming statements
// TODO: propagate statements on a timer?
let process_task = self.network.with_spec(|spec, _ctx| {
spec.new_consensus(parent_hash);
spec.consensus_gossip.new_session(parent_hash);
MessageProcessTask {
inner_stream: spec.consensus_gossip.messages_for(parent_hash),
bft_messages: bft_send,