Simplify consensus message sending (#1166)

* Create gossip_consensus_message helper on service, simplify consensus_gossip access
This commit is contained in:
Benjamin Kampmann
2018-11-27 09:06:58 +01:00
committed by GitHub
parent 59af4de4fd
commit dbe31230c3
4 changed files with 17 additions and 13 deletions
+1 -4
View File
@@ -229,10 +229,7 @@ impl<V: 'static + Verifier<Block>, D> Peer<V, D> {
/// Push a message into the gossip network and relay to peers.
/// `TestNet::sync_step` needs to be called to ensure it's propagated.
pub fn gossip_message(&self, topic: Hash, data: Vec<u8>) {
let gossip = self.sync.consensus_gossip();
self.sync.with_spec(&mut TestIo::new(&self.queue, None), move |_s, context|{
gossip.write().multicast(context, topic, data);
});
self.sync.gossip_consensus_message(&mut TestIo::new(&self.queue, None), topic, data);
}
/// Add blocks to the peer -- edit the block before adding