Some gossip improvements (#1892)

* queue messages in future

* use new gossip API in GRANDPA

* implement message_expired for grandpa

* fix indent
This commit is contained in:
Robert Habermeier
2019-02-28 14:19:42 -05:00
committed by Gav Wood
parent c21d7436cc
commit 4c8fec17fc
4 changed files with 200 additions and 81 deletions
+2 -1
View File
@@ -369,11 +369,12 @@ impl<D, S: NetworkSpecialization<Block> + Clone> Peer<D, S> {
/// access the underlying consensus gossip handler
pub fn consensus_gossip_messages_for(
&self,
engine_id: ConsensusEngineId,
topic: <Block as BlockT>::Hash,
) -> mpsc::UnboundedReceiver<Vec<u8>> {
let (tx, rx) = oneshot::channel();
self.with_gossip(move |gossip, _| {
let inner_rx = gossip.messages_for(topic);
let inner_rx = gossip.messages_for(engine_id, topic);
let _ = tx.send(inner_rx);
});
rx.wait().ok().expect("1. Network is running, 2. it should handle the above closure successfully")