Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use the master branch of libp2p
  • Loading branch information
tomaka committed Sep 3, 2018
commit 98fb53faf0f52d48ec6bb39c733f280e1a43e5cf
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions substrate/network-libp2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bytes = "0.4"
error-chain = { version = "0.12", default-features = false }
fnv = "1.0"
futures = "0.1"
libp2p = { git = "https://github.com/tomaka/libp2p-rs", rev = "5159f3aeae2ba6cc7015c511816a5f965c444779", default-features = false, features = ["libp2p-secio", "libp2p-secio-secp256k1"] }
libp2p = { git = "https://github.com/libp2p/rust-libp2p", rev = "02576eecf140a06134519ed9438d061d99bb2e69", default-features = false, features = ["libp2p-secio", "libp2p-secio-secp256k1"] }
ethcore-io = { git = "https://github.com/paritytech/parity.git" }
ethkey = { git = "https://github.com/paritytech/parity.git" }
ethereum-types = "0.3"
Expand All @@ -25,7 +25,7 @@ serde_json = "1.0.24"
tokio = "0.1"
tokio-io = "0.1"
tokio-timer = "0.2"
unsigned-varint = { version = "0.1", features = ["codec"] }
unsigned-varint = { version = "0.2", features = ["codec"] }

[dev-dependencies]
assert_matches = "1.2"
Expand Down
2 changes: 1 addition & 1 deletion substrate/network-libp2p/src/network_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ fn parse_and_add_to_topology(
let mut addr = addr_str.to_multiaddr().map_err(|_| ErrorKind::AddressParse)?;
let who = match addr.pop() {
Some(AddrComponent::P2P(key)) =>
PeerId::from_bytes(key).map_err(|_| ErrorKind::AddressParse)?,
PeerId::from_multihash(key).map_err(|_| ErrorKind::AddressParse)?,
_ => return Err(ErrorKind::AddressParse.into()),
};

Expand Down
4 changes: 2 additions & 2 deletions substrate/network-libp2p/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl NetworkService {
let local_peer_id = network_state.local_public_key().clone()
.into_peer_id();
for mut addr in config.listen_addresses.iter().cloned() {
addr.append(AddrComponent::P2P(local_peer_id.clone().into_bytes()));
addr.append(AddrComponent::P2P(local_peer_id.clone().into()));
info!(target: "sub-libp2p", "Local node address is: {}", addr);
}

Expand Down Expand Up @@ -1148,7 +1148,7 @@ fn process_identify_info(
);
listened_addrs.push(ext_addr.clone());
ext_addr.append(AddrComponent::P2P(shared.kad_system
.local_peer_id().clone().into_bytes()));
.local_peer_id().clone().into()));
info!(target: "sub-libp2p", "New external node address: {}", ext_addr);
}
}
Expand Down
7 changes: 6 additions & 1 deletion substrate/network-libp2p/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,24 @@ use libp2p::{self, PeerId, Transport, mplex, secio, yamux};
use libp2p::core::{MuxedTransport, either, upgrade};
use libp2p::transport_timeout::TransportTimeout;
use std::time::Duration;
use std::usize;
use tokio_io::{AsyncRead, AsyncWrite};

/// Builds the transport that serves as a common ground for all connections.
pub fn build_transport(
local_private_key: secio::SecioKeyPair
) -> impl MuxedTransport<Output = (PeerId, impl AsyncRead + AsyncWrite)> + Clone {
let mut mplex_config = mplex::MplexConfig::new();
mplex_config.max_buffer_len_behaviour(mplex::MaxBufferBehaviour::Block);
mplex_config.max_buffer_len(usize::MAX);

let base = libp2p::CommonTransport::new()
.with_upgrade(secio::SecioConfig {
key: local_private_key,
})
.and_then(move |out, endpoint, client_addr| {
let upgrade = upgrade::or(
upgrade::map(mplex::MplexConfig::new(), either::EitherOutput::First),
upgrade::map(mplex_config, either::EitherOutput::First),
upgrade::map(yamux::Config::default(), either::EitherOutput::Second),
);
let key = out.remote_key;
Expand Down