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
+1 -1
View File
@@ -12,7 +12,7 @@ futures01 = { package = "futures", version = "0.1.29" }
futures = { version = "0.3.1", features = ["compat"] }
futures-timer = "0.4.0"
lru = "0.1.2"
libp2p = { version = "0.13.2", default-features = false, features = ["libp2p-websocket"] }
libp2p = { version = "0.14.0-alpha.1", default-features = false, features = ["libp2p-websocket"] }
sc-network = { version = "0.8", path = "../network" }
parking_lot = "0.9.0"
sp-runtime = { version = "2.0.0", path = "../../primitives/runtime" }
+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) {