Skip to content

Commit f2b84e0

Browse files
committed
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.
1 parent dc627b3 commit f2b84e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lightning/src/onion_message/messenger.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,10 @@ where
318318
ES::Target: EntropySource,
319319
{
320320
fn find_path(
321-
&self, _sender: PublicKey, peers: Vec<PublicKey>, destination: Destination
321+
&self, sender: PublicKey, peers: Vec<PublicKey>, destination: Destination
322322
) -> Result<OnionMessagePath, ()> {
323323
let first_node = destination.first_node();
324-
if peers.contains(&first_node) {
324+
if peers.contains(&first_node) || sender == first_node {
325325
Ok(OnionMessagePath {
326326
intermediate_nodes: vec![], destination, first_node_addresses: None
327327
})

0 commit comments

Comments
 (0)