Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion crates/node/gossip/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ libp2p-stream.workspace = true
discv5 = { workspace = true, features = ["libp2p"] }
openssl = { workspace = true, features = ["vendored"] }
libp2p-identity = { workspace = true, features = ["secp256k1"] }
libp2p = { workspace = true, features = ["macros", "tokio", "tcp", "noise", "gossipsub", "ping", "yamux", "identify"] }
libp2p = { workspace = true, features = ["macros", "tokio", "tcp", "dns", "noise", "gossipsub", "ping", "yamux", "identify"] }
ipnet = { workspace = true, features = ["serde"] }

# Misc
Expand Down
5 changes: 4 additions & 1 deletion crates/node/gossip/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ impl GossipDriverBuilder {
.accept(sync_protocol_name)
.map_err(|_| GossipDriverBuilderError::SyncReqRespAlreadyAccepted)?;

// Build the swarm.
// Build the swarm with DNS+TCP transport.
// Note: with_dns() must be called after with_tcp() to wrap TCP with DNS resolution.
debug!(target: "gossip", "Building Swarm with Peer ID: {}", keypair.public().to_peer_id());
let swarm = SwarmBuilder::with_existing_identity(keypair)
.with_tokio()
Expand All @@ -205,6 +206,8 @@ impl GossipDriverBuilder {
YamuxConfig::default,
)
.map_err(|_| GossipDriverBuilderError::TcpError)?
.with_dns()
.map_err(|_| GossipDriverBuilderError::TcpError)?
.with_behaviour(|_| behaviour)
.map_err(|_| GossipDriverBuilderError::WithBehaviourError)?
.with_swarm_config(|c| c.with_idle_connection_timeout(timeout))
Expand Down
5 changes: 5 additions & 0 deletions crates/node/gossip/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ where
}

// Let the gate know we are dialing the address.
// Note: libp2p-dns will automatically resolve DNS multiaddrs at the transport layer.
self.connection_gate.dialing(&addr);

// Dial
Expand Down Expand Up @@ -409,6 +410,10 @@ where
}
SwarmEvent::OutgoingConnectionError { peer_id: _peer_id, error, .. } => {
debug!(target: "gossip", "Outgoing connection error: {:?}", error);
// Remove the peer from current_dials so it can be dialed again
if let Some(peer_id) = _peer_id {
self.connection_gate.remove_dial(&peer_id);
}
kona_macros::inc!(
gauge,
crate::Metrics::GOSSIPSUB_CONNECTION,
Expand Down
Loading