diff --git a/network-libp2p/src/connection_pool/behaviour.rs b/network-libp2p/src/connection_pool/behaviour.rs index 8f45e5cc31..0f3cbd65d5 100644 --- a/network-libp2p/src/connection_pool/behaviour.rs +++ b/network-libp2p/src/connection_pool/behaviour.rs @@ -598,15 +598,35 @@ impl NetworkBehaviour for ConnectionPoolBehaviour { _handler: Self::ProtocolsHandler, error: &DialError, ) { - let peer_id = match peer_id { - Some(id) => id, - // Not interested in dial failures to unknown peers right now. - None => return, - }; - - log::debug!("Failed to dial peer {}: {:?}", peer_id, error); - self.peer_ids.mark_failed(peer_id); - self.maintain_peers(); + match error { + DialError::Banned + | DialError::ConnectionLimit(_) + | DialError::LocalPeerId + | DialError::InvalidPeerId + | DialError::Aborted + | DialError::ConnectionIo(_) + | DialError::Transport(_) + | DialError::NoAddresses => { + let peer_id = match peer_id { + Some(id) => id, + // Not interested in dial failures to unknown peers right now. + None => return, + }; + + log::debug!("Failed to dial peer {}: {:?}", peer_id, error); + self.peer_ids.mark_failed(peer_id); + self.maintain_peers(); + } + DialError::DialPeerConditionFalse( + DialPeerCondition::Disconnected | DialPeerCondition::NotDialing, + ) => { + // We might (still) be connected, or about to be connected, thus do not report the + // failure. + } + DialError::DialPeerConditionFalse(DialPeerCondition::Always) => { + unreachable!("DialPeerCondition::Always can not trigger DialPeerConditionFalse."); + } + } } fn poll( diff --git a/network-libp2p/src/network.rs b/network-libp2p/src/network.rs index 78cae6a9e0..bfeacdb199 100644 --- a/network-libp2p/src/network.rs +++ b/network-libp2p/src/network.rs @@ -1,6 +1,5 @@ #![allow(dead_code)] -use std::num::NonZeroU8; use std::{collections::HashMap, sync::Arc}; use async_trait::async_trait; @@ -213,7 +212,6 @@ impl Network { // TODO add proper config SwarmBuilder::new(transport, behaviour, local_peer_id) .connection_limits(limits) - .dial_concurrency_factor(NonZeroU8::new(10).unwrap()) .executor(Box::new(|fut| { tokio::spawn(fut); })) diff --git a/validator/src/validator.rs b/validator/src/validator.rs index 223bcff073..3e4e3f9ab6 100644 --- a/validator/src/validator.rs +++ b/validator/src/validator.rs @@ -595,7 +595,7 @@ impl tokio::spawn(async move { debug!("Sending unpark transaction"); if cn.send_transaction(unpark_transaction).await.is_err() { - error!("Failed to send unpark transatction"); + error!("Failed to send unpark transaction"); } }); self.unpark_sent = true;