Skip to content

Commit cc70446

Browse files
committed
f readability improvements from val
1 parent 56c75f0 commit cc70446

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lightning/src/routing/router.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,19 +1031,20 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
10311031
}
10321032
}
10331033
}
1034-
if features_set {
1035-
} else if let Some(node) = network_nodes.get(&ordered_hops.last().unwrap().0.pubkey) {
1036-
if let Some(node_info) = node.announcement_info.as_ref() {
1037-
ordered_hops.last_mut().unwrap().1 = node_info.features.clone();
1034+
if !features_set {
1035+
if let Some(node) = network_nodes.get(&ordered_hops.last().unwrap().0.pubkey) {
1036+
if let Some(node_info) = node.announcement_info.as_ref() {
1037+
ordered_hops.last_mut().unwrap().1 = node_info.features.clone();
1038+
} else {
1039+
ordered_hops.last_mut().unwrap().1 = NodeFeatures::empty();
1040+
}
10381041
} else {
1039-
ordered_hops.last_mut().unwrap().1 = NodeFeatures::empty();
1042+
// We should be able to fill in features for everything except the last
1043+
// hop, if the last hop was provided via a BOLT 11 invoice (though we
1044+
// should be able to extend it further as BOLT 11 does have feature
1045+
// flags for the last hop node itself).
1046+
assert!(ordered_hops.last().unwrap().0.pubkey == *payee);
10401047
}
1041-
} else {
1042-
// We should be able to fill in features for everything except the last
1043-
// hop, if the last hop was provided via a BOLT 11 invoice (though we
1044-
// should be able to extend it further as BOLT 11 does have feature
1045-
// flags for the last hop node itself).
1046-
assert!(ordered_hops.last().unwrap().0.pubkey == *payee);
10471048
}
10481049

10491050
// Means we succesfully traversed from the payer to the payee, now
@@ -4279,7 +4280,6 @@ mod tests {
42794280
assert_eq!(route.paths[1][0].short_channel_id, 2);
42804281
assert_eq!(route.paths[1][0].fee_msat, 50_000);
42814282
}
4282-
42834283
}
42844284

42854285
#[test]

0 commit comments

Comments
 (0)