diff --git a/consensus/core/src/network/tonic_network.rs b/consensus/core/src/network/tonic_network.rs index d4698c52963..7d820ced652 100644 --- a/consensus/core/src/network/tonic_network.rs +++ b/consensus/core/src/network/tonic_network.rs @@ -932,19 +932,19 @@ impl NetworkManager for TonicManager { } } -/// Attempts to convert a multiaddr of the form `/[ip4,ip6,dns]/{}/udp/{port}` +/// Attempts to convert a multiaddr of the form `/[ip4,ip6,dns]/{}/[udp,tcp]/{port}` /// into a host:port string. fn to_host_port_str(addr: &Multiaddr) -> Result { let mut iter = addr.iter(); match (iter.next(), iter.next()) { - (Some(Protocol::Ip4(ipaddr)), Some(Protocol::Udp(port))) => { + (Some(Protocol::Ip4(ipaddr)), Some(Protocol::Udp(port) | Protocol::Tcp(port))) => { Ok(format!("{}:{}", ipaddr, port)) } - (Some(Protocol::Ip6(ipaddr)), Some(Protocol::Udp(port))) => { + (Some(Protocol::Ip6(ipaddr)), Some(Protocol::Udp(port) | Protocol::Tcp(port))) => { Ok(format!("{}:{}", ipaddr, port)) } - (Some(Protocol::Dns(hostname)), Some(Protocol::Udp(port))) => { + (Some(Protocol::Dns(hostname)), Some(Protocol::Udp(port) | Protocol::Tcp(port))) => { Ok(format!("{}:{}", hostname, port)) } diff --git a/crates/iota-network-stack/src/multiaddr.rs b/crates/iota-network-stack/src/multiaddr.rs index 3d5ab1c4869..536aa52875b 100644 --- a/crates/iota-network-stack/src/multiaddr.rs +++ b/crates/iota-network-stack/src/multiaddr.rs @@ -8,7 +8,7 @@ use std::{ }; pub use ::multiaddr::{Error, Protocol}; -use eyre::{eyre, Result}; +use eyre::{Result, eyre}; use tracing::error; #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]