Update networking code to libp2p 0.14 (#4383)

* Entirely update substrate-telemetry to futures 0.3

* Add a Closed error

* Update to libp2p 0.14

* More work

* More work

* More work

* More work

* Fix warnings

* Remove unwrap()

* Work on tests fixing

* Fix network tests

* Fix external network tests

* Update libp2p and restore Yamux in discovery test

* Ignore DNS if initializatio nfails

* Restore variables ordering

* Forgot browser-utils

* Fix downfall after merge

* Fix tests
This commit is contained in:
Pierre Krieger
2020-01-09 19:01:23 +01:00
committed by Gavin Wood
parent 6e572a9477
commit ca997cf1e4
29 changed files with 842 additions and 812 deletions
+2 -1
View File
@@ -59,6 +59,7 @@ pub use self::state_machine::{TopicNotification, MessageIntent};
pub use self::state_machine::{Validator, ValidatorContext, ValidationResult};
pub use self::state_machine::DiscardAll;
use futures::prelude::*;
use sc_network::{specialization::NetworkSpecialization, Event, ExHashT, NetworkService, PeerId, ReputationChange};
use sp_runtime::{traits::Block as BlockT, ConsensusEngineId};
use std::sync::Arc;
@@ -97,7 +98,7 @@ pub trait Network<B: BlockT> {
impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> Network<B> for Arc<NetworkService<B, S, H>> {
fn event_stream(&self) -> Box<dyn futures01::Stream<Item = Event, Error = ()> + Send> {
Box::new(NetworkService::event_stream(self))
Box::new(NetworkService::event_stream(self).map(|v| Ok::<_, ()>(v)).compat())
}
fn report_peer(&self, peer_id: PeerId, reputation: ReputationChange) {