@@ -1031,19 +1031,20 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
1031
1031
}
1032
1032
}
1033
1033
}
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
+ }
1038
1041
} 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) ;
1040
1047
}
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) ;
1047
1048
}
1048
1049
1049
1050
// Means we succesfully traversed from the payer to the payee, now
@@ -4279,7 +4280,6 @@ mod tests {
4279
4280
assert_eq ! ( route. paths[ 1 ] [ 0 ] . short_channel_id, 2 ) ;
4280
4281
assert_eq ! ( route. paths[ 1 ] [ 0 ] . fee_msat, 50_000 ) ;
4281
4282
}
4282
-
4283
4283
}
4284
4284
4285
4285
#[ test]
0 commit comments