Skip to content

Commit

Permalink
Only add new external addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
ligustah committed May 1, 2024
1 parent c7bef07 commit 7de0b93
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::time::Duration;

use eyre::WrapErr;
use futures_ticker::Ticker;
use itertools::Itertools;
use libp2p::autonat::NatStatus;
use libp2p::core::ConnectedPoint;
use libp2p::futures::StreamExt;
Expand Down Expand Up @@ -279,7 +280,10 @@ impl SwarmController {
let pid = self.swarm.local_peer_id();
let local_address = if address.is_relayed() {
// if it's a relay address, let's assume it's an external address
self.swarm.add_external_address(address.clone());

if !self.swarm.external_addresses().contains(&address) {
self.swarm.add_external_address(address.clone());
}

address.to_string()
} else {
Expand Down

0 comments on commit 7de0b93

Please sign in to comment.