Skip to content

Commit f314f02

Browse files
tnullTheBlueMatt
authored andcommitted
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 b7ea4e8 commit f314f02

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lightning/src/routing/router.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,12 +2143,14 @@ where L::Target: Logger {
21432143
.filter(|route| !route.0.is_empty())
21442144
{
21452145
let first_hop_in_route = &(route.0)[0];
2146+
let first_hop_src_id = NodeId::from_pubkey(&first_hop_in_route.src_node_id);
21462147
let have_hop_src_in_graph =
2147-
// Only add the hops in this route to our candidate set if either
2148-
// we have a direct channel to the first hop or the first hop is
2149-
// in the regular network graph.
2150-
first_hop_targets.get(&NodeId::from_pubkey(&first_hop_in_route.src_node_id)).is_some() ||
2151-
network_nodes.get(&NodeId::from_pubkey(&first_hop_in_route.src_node_id)).is_some();
2148+
// Only add the hops in this route to our candidate set if either we are part of
2149+
// the first hop, we have a direct channel to the first hop, or the first hop is in
2150+
// the regular network graph.
2151+
our_node_id == first_hop_src_id ||
2152+
first_hop_targets.get(&first_hop_src_id).is_some() ||
2153+
network_nodes.get(&first_hop_src_id).is_some();
21522154
if have_hop_src_in_graph {
21532155
// We start building the path from reverse, i.e., from payee
21542156
// to the first RouteHintHop in the path.

0 commit comments

Comments
 (0)