mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 07:17:40 +01:00
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.
This commit is contained in:
parent
dc627b371f
commit
f2b84e05e8
1 changed files with 2 additions and 2 deletions
|
@ -318,10 +318,10 @@ where
|
||||||
ES::Target: EntropySource,
|
ES::Target: EntropySource,
|
||||||
{
|
{
|
||||||
fn find_path(
|
fn find_path(
|
||||||
&self, _sender: PublicKey, peers: Vec<PublicKey>, destination: Destination
|
&self, sender: PublicKey, peers: Vec<PublicKey>, destination: Destination
|
||||||
) -> Result<OnionMessagePath, ()> {
|
) -> Result<OnionMessagePath, ()> {
|
||||||
let first_node = destination.first_node();
|
let first_node = destination.first_node();
|
||||||
if peers.contains(&first_node) {
|
if peers.contains(&first_node) || sender == first_node {
|
||||||
Ok(OnionMessagePath {
|
Ok(OnionMessagePath {
|
||||||
intermediate_nodes: vec![], destination, first_node_addresses: None
|
intermediate_nodes: vec![], destination, first_node_addresses: None
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue