Fix sender is the introduction node onion messages
[rust-lightning] / lightning / src / onion_message / messenger.rs
index 37de550453283e4a383051ace821cabb44f95ff1..15dc12f6bea7f6f89fd101dfaeeafb7a36126c0d 100644 (file)
@@ -318,10 +318,10 @@ where
        ES::Target: EntropySource,
 {
        fn find_path(
-               &self, _sender: PublicKey, peers: Vec<PublicKey>, destination: Destination
+               &self, sender: PublicKey, peers: Vec<PublicKey>, destination: Destination
        ) -> Result<OnionMessagePath, ()> {
                let first_node = destination.first_node();
-               if peers.contains(&first_node) {
+               if peers.contains(&first_node) || sender == first_node {
                        Ok(OnionMessagePath {
                                intermediate_nodes: vec![], destination, first_node_addresses: None
                        })