Skip to content

Commit 6d5dba1

Browse files
committed
f Unify unnecessary NodeId::from_pubkey
1 parent ee0d8ba commit 6d5dba1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lightning/src/routing/router.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -2102,13 +2102,14 @@ where L::Target: Logger {
21022102
.filter(|route| !route.0.is_empty())
21032103
{
21042104
let first_hop_in_route = &(route.0)[0];
2105+
let first_hop_src_id = NodeId::from_pubkey(&first_hop_in_route.src_node_id);
21052106
let have_hop_src_in_graph =
21062107
// Only add the hops in this route to our candidate set if either we are part of
21072108
// the first hop, we have a direct channel to the first hop, or the first hop is in
21082109
// the regular network graph.
2109-
our_node_id == NodeId::from_pubkey(&first_hop_in_route.src_node_id) ||
2110-
first_hop_targets.get(&NodeId::from_pubkey(&first_hop_in_route.src_node_id)).is_some() ||
2111-
network_nodes.get(&NodeId::from_pubkey(&first_hop_in_route.src_node_id)).is_some();
2110+
our_node_id == first_hop_src_id ||
2111+
first_hop_targets.get(&first_hop_src_id).is_some() ||
2112+
network_nodes.get(&first_hop_src_id).is_some();
21122113
if have_hop_src_in_graph {
21132114
// We start building the path from reverse, i.e., from payee
21142115
// to the first RouteHintHop in the path.

0 commit comments

Comments
 (0)