Merge pull request #2951 from jkczyz/2024-03-fix-sender-is-intro-node
[rust-lightning] / lightning / src / onion_message / messenger.rs
index 9f6c5cb435276ffbc4a76793f1f9fea624986de4..e213bcbb0e1dc50d9fda8983f164e82611db26d9 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
                        })