Update to latest substrate master (#491)

* update to latest substrate master

* Fix compilation
This commit is contained in:
André Silva
2019-10-23 16:17:49 +01:00
committed by Gavin Wood
parent 8dc443dc5b
commit dd2b43cd10
10 changed files with 136 additions and 107 deletions
+6 -5
View File
@@ -26,8 +26,9 @@ pub mod validation;
pub mod gossip;
use codec::{Decode, Encode};
use futures::sync::{oneshot, mpsc};
use futures::sync::oneshot;
use futures::prelude::*;
use futures03::{channel::mpsc, compat::Compat, StreamExt};
use polkadot_primitives::{Block, Hash, Header};
use polkadot_primitives::parachain::{
Id as ParaId, BlockData, CollatorId, CandidateReceipt, Collation, PoVBlock,
@@ -108,7 +109,7 @@ impl NetworkService for PolkadotNetworkService {
Err(_) => mpsc::unbounded().1, // return empty channel.
};
GossipMessageStream::new(topic_stream)
GossipMessageStream::new(Box::new(Compat::new(topic_stream.map(Ok))))
}
fn gossip_message(&self, topic: Hash, message: GossipMessage) {
@@ -151,14 +152,14 @@ impl GossipService for consensus_gossip::ConsensusGossip<Block> {
/// A stream of gossip messages and an optional sender for a topic.
pub struct GossipMessageStream {
topic_stream: mpsc::UnboundedReceiver<TopicNotification>,
topic_stream: Box<dyn Stream<Item = TopicNotification, Error = ()> + Send>,
}
impl GossipMessageStream {
/// Create a new instance with the given topic stream.
pub fn new(topic_stream: mpsc::UnboundedReceiver<TopicNotification>) -> Self {
pub fn new(topic_stream: Box<dyn Stream<Item = TopicNotification, Error = ()> + Send>) -> Self {
Self {
topic_stream
topic_stream,
}
}
}
+1 -1
View File
@@ -148,7 +148,7 @@ impl NetworkService for TestNetwork {
fn gossip_messages_for(&self, topic: Hash) -> GossipMessageStream {
let (tx, rx) = mpsc::unbounded();
let _ = self.gossip.send_listener.unbounded_send((topic, tx));
GossipMessageStream::new(rx)
GossipMessageStream::new(Box::new(rx))
}
fn gossip_message(&self, topic: Hash, message: GossipMessage) {