Relax channel count check for unannounced nodes
[rust-lightning] / lightning / src / onion_message / messenger.rs
index d333eb2103c5ca516217518ab144dab2f84b9807..859c3f2b5b9c88fd6e7c42c23698d1402dcbee61 100644 (file)
@@ -511,7 +511,9 @@ where
                        .filter_map(|peer|
                                network_graph
                                        .node(&NodeId::from_pubkey(&peer.node_id))
-                                       .filter(|info| info.channels.len() >= MIN_PEER_CHANNELS)
+                                       .filter(|info|
+                                               !is_recipient_announced || info.channels.len() >= MIN_PEER_CHANNELS
+                                       )
                                        .map(|info| (peer, info.is_tor_only(), info.channels.len()))
                                        // Allow messages directly with the only peer when unannounced.
                                        .or_else(|| (!is_recipient_announced && has_one_peer)