Skip to content

Commit e0e05d5

Browse files
committed
return addresses actually used for announcement
1 parent a9a3071 commit e0e05d5

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/lib.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,10 @@ impl Node {
457457
continue;
458458
}
459459

460-
let addresses = if let Some(addresses) = bcast_config.announcement_addresses.clone() {
461-
addresses
462-
} else if let Some(addresses) = bcast_config.listening_addresses.clone() {
463-
addresses
460+
let addresses = if let Some(announcement_addresses) = bcast_config.announcement_addresses.clone() {
461+
announcement_addresses
462+
} else if let Some(listening_addresses) = bcast_config.listening_addresses.clone() {
463+
listening_addresses
464464
} else {
465465
debug_assert!(false, "We checked whether the node may announce, so listening addresses should always be set");
466466
continue;
@@ -804,9 +804,12 @@ impl Node {
804804
self.config.listening_addresses.clone()
805805
}
806806

807-
/// Returns our own announcement addresses.
807+
/// Returns the addresses that the node will announce to the network.
808808
pub fn announcement_addresses(&self) -> Option<Vec<SocketAddress>> {
809-
self.config.announcement_addresses.clone()
809+
self.config
810+
.announcement_addresses
811+
.clone()
812+
.or_else(|| self.config.listening_addresses.clone())
810813
}
811814

812815
/// Returns our node alias.

0 commit comments

Comments
 (0)