From f2b84e05e8e0d5a2d6542dd6555a6252a800eb26 Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Tue, 19 Mar 2024 16:04:43 -0500 Subject: [PATCH] Fix sender is the introduction node onion messages DefaultMessageRouter will form an OnionMessagePath from a BlindedPath where the sender is the introduction node but only if the sender is announced. If the sender is unannounced, then DefaultMessageRouter will fail. While DefaultMessageRouter will only create a blinded path with an announced introduction node, it may receive one where the introduction node is unannounced. Don't return an error in this case, as the OnionMessenger can advance the blinded path by one hop. This may occur when two nodes have an unannounced channel and one (the offer creator) wants to use it for payments without an intermediary node and without putting its node id in the offer. --- lightning/src/onion_message/messenger.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightning/src/onion_message/messenger.rs b/lightning/src/onion_message/messenger.rs index 37de55045..15dc12f6b 100644 --- a/lightning/src/onion_message/messenger.rs +++ b/lightning/src/onion_message/messenger.rs @@ -318,10 +318,10 @@ where ES::Target: EntropySource, { fn find_path( - &self, _sender: PublicKey, peers: Vec, destination: Destination + &self, sender: PublicKey, peers: Vec, destination: Destination ) -> Result { 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 }) -- 2.39.5