const MIN_PEER_CHANNELS: usize = 3;
let network_graph = self.network_graph.deref().read_only();
+ let is_recipient_announced =
+ network_graph.nodes().contains_key(&NodeId::from_pubkey(&recipient));
+
let mut peer_info = peers.iter()
// Limit to peers with announced channels
.filter_map(|pubkey|
.filter(|info| info.channels.len() >= MIN_PEER_CHANNELS)
.map(|info| (*pubkey, info.is_tor_only(), info.channels.len()))
)
+ // Exclude Tor-only nodes when the recipient is announced.
+ .filter(|(_, is_tor_only, _)| !(*is_tor_only && is_recipient_announced))
.collect::<Vec<_>>();
// Prefer using non-Tor nodes with the most channels as the introduction node.
match paths {
Ok(paths) if !paths.is_empty() => Ok(paths),
_ => {
- if network_graph.nodes().contains_key(&NodeId::from_pubkey(&recipient)) {
+ if is_recipient_announced {
BlindedPath::one_hop_for_message(recipient, &*self.entropy_source, secp_ctx)
.map(|path| vec![path])
} else {
},
Ok(SendSuccess::BufferedAwaitingConnection(node_id)) => {
log_trace!(
- self.logger, "Buffered onion message waiting on peer connection {}: {:?}",
+ self.logger, "Buffered onion message waiting on peer connection {}: {}",
log_suffix, node_id
);
},
Ok(PeeledOnion::Forward(next_node_id, onion_message)) => {
let mut message_recipients = self.message_recipients.lock().unwrap();
if outbound_buffer_full(&next_node_id, &message_recipients) {
- log_trace!(self.logger, "Dropping forwarded onion message to peer {:?}: outbound buffer full", next_node_id);
+ log_trace!(self.logger, "Dropping forwarded onion message to peer {}: outbound buffer full", next_node_id);
return
}
log_trace!(self.logger, "Forwarding an onion message to peer {}", next_node_id);
},
_ => {
- log_trace!(self.logger, "Dropping forwarded onion message to disconnected peer {:?}", next_node_id);
+ log_trace!(self.logger, "Dropping forwarded onion message to disconnected peer {}", next_node_id);
return
},
}