diff --git a/crates/mysten-network/src/multiaddr.rs b/crates/mysten-network/src/multiaddr.rs index 76a3c202b4c85..b628f6a4bdf97 100644 --- a/crates/mysten-network/src/multiaddr.rs +++ b/crates/mysten-network/src/multiaddr.rs @@ -179,6 +179,20 @@ impl Multiaddr { } None } + + pub fn rewrite_udp_to_tcp(&self) -> Self { + let mut new = Self::empty(); + + for component in self.iter() { + if let Protocol::Udp(port) = component { + new.push(Protocol::Tcp(port)); + } else { + new.push(component); + } + } + + new + } } impl std::fmt::Display for Multiaddr { diff --git a/crates/sui-core/src/authority_client.rs b/crates/sui-core/src/authority_client.rs index e3c9f2d01c28d..7f2a438a913d9 100644 --- a/crates/sui-core/src/authority_client.rs +++ b/crates/sui-core/src/authority_client.rs @@ -235,9 +235,15 @@ pub fn make_network_authority_clients_with_network_config( SuiError::from("Missing network metadata in CommitteeWithNetworkMetadata") })? .network_address; - let channel = network_config - .connect_lazy(address) - .map_err(|err| anyhow!(err.to_string()))?; + let address = address.rewrite_udp_to_tcp(); + let channel = network_config.connect_lazy(&address).map_err(|e| { + tracing::error!( + address = %address, + name = %name, + "unable to create authority client: {e}" + ); + anyhow!(err.to_string()) + })?; let client = NetworkAuthorityClient::new(channel); authority_clients.insert(*name, client); }