outbound relay fix

This commit is contained in:
Christien Rioux 2023-07-19 14:44:58 -04:00
parent 595992f734
commit 8d4f9cebab

View File

@ -404,7 +404,7 @@ impl RoutingDomainDetail for PublicInternetRoutingDomainDetail {
else if let Some(node_b_relay) = peer_b.signed_node_info().relay_info() { else if let Some(node_b_relay) = peer_b.signed_node_info().relay_info() {
// Note that relay_peer_info could be node_a, in which case a connection already exists // Note that relay_peer_info could be node_a, in which case a connection already exists
// and we only get here if the connection had dropped, in which case node_a is unreachable until // and we only get here if the connection had dropped, in which case node_b is unreachable until
// it gets a new relay connection up // it gets a new relay connection up
if peer_b.signed_node_info().relay_ids().contains_any(peer_a.node_ids()) { if peer_b.signed_node_info().relay_ids().contains_any(peer_a.node_ids()) {
return ContactMethod::Existing; return ContactMethod::Existing;
@ -430,12 +430,14 @@ impl RoutingDomainDetail for PublicInternetRoutingDomainDetail {
} }
// If node A can't reach the node by other means, it may need to use its own relay // If node A can't reach the node by other means, it may need to use its own relay
if peer_a.signed_node_info().node_info().network_class().outbound_wants_relay() {
if let Some(node_a_relay_id) = peer_a.signed_node_info().relay_ids().get(best_ck) { if let Some(node_a_relay_id) = peer_a.signed_node_info().relay_ids().get(best_ck) {
// Ensure it's not our relay we're trying to reach // Ensure it's not our relay we're trying to reach
if node_a_relay_id != node_b_id { if node_a_relay_id != node_b_id {
return ContactMethod::OutboundRelay(node_a_relay_id); return ContactMethod::OutboundRelay(node_a_relay_id);
} }
} }
}
ContactMethod::Unreachable ContactMethod::Unreachable
} }