Skip to content

Commit ee0d8ba

Browse files
committed
Also add route hints if we are the source
Previously, we would only consider route hints if we had a direct channel to the first node in the hint or if the first node in the hint was part of the public network graph. However, this left out the possiblity of us being part of the first hop, especially if our own node is not announced and part of the graph.
1 parent 7379cc1 commit ee0d8ba

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lightning/src/routing/router.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -2066,9 +2066,10 @@ where L::Target: Logger {
20662066
for (hint_idx, hint) in payment_params.payee.blinded_route_hints().iter().enumerate() {
20672067
let intro_node_id = NodeId::from_pubkey(&hint.1.introduction_node_id);
20682068
let have_intro_node_in_graph =
2069-
// Only add the hops in this route to our candidate set if either
2070-
// we have a direct channel to the first hop or the first hop is
2071-
// in the regular network graph.
2069+
// Only add the hops in this route to our candidate set if either we are part of
2070+
// the first hop, we have a direct channel to the first hop, or the first hop is in
2071+
// the regular network graph.
2072+
our_node_id == intro_node_id ||
20722073
first_hop_targets.get(&intro_node_id).is_some() ||
20732074
network_nodes.get(&intro_node_id).is_some();
20742075
if !have_intro_node_in_graph { continue }
@@ -2102,9 +2103,10 @@ where L::Target: Logger {
21022103
{
21032104
let first_hop_in_route = &(route.0)[0];
21042105
let have_hop_src_in_graph =
2105-
// Only add the hops in this route to our candidate set if either
2106-
// we have a direct channel to the first hop or the first hop is
2107-
// in the regular network graph.
2106+
// Only add the hops in this route to our candidate set if either we are part of
2107+
// the first hop, we have a direct channel to the first hop, or the first hop is in
2108+
// the regular network graph.
2109+
our_node_id == NodeId::from_pubkey(&first_hop_in_route.src_node_id) ||
21082110
first_hop_targets.get(&NodeId::from_pubkey(&first_hop_in_route.src_node_id)).is_some() ||
21092111
network_nodes.get(&NodeId::from_pubkey(&first_hop_in_route.src_node_id)).is_some();
21102112
if have_hop_src_in_graph {

0 commit comments

Comments
 (0)