@@ -3541,18 +3541,20 @@ where
3541
3541
let mut res = Vec::new();
3542
3542
3543
3543
for mut path in route.paths {
3544
- // If the last hop was provided by route hint we assume it's not an announced channel.
3545
- // If furthermore only a single route hint is provided we refrain from probing through
3546
- // all the way to the end and instead probe up to the second-to-last channel.
3547
- if let Payee::Clear { node_id, ref route_hints, .. } = route_params.payment_params.payee {
3548
- if route_hints.len() == 1 {
3549
- if let Some(hint) = route_hints[0].0.iter().last() {
3550
- if let Some(last_path_hop) = path.hops.last() {
3551
- if last_path_hop.pubkey == node_id && last_path_hop.short_channel_id == hint.short_channel_id {
3552
- let final_value_msat = path.final_value_msat();
3553
- path.hops.pop();
3554
- if let Some(mut new_last) = path.hops.iter_mut().last() {
3555
- new_last.fee_msat += final_value_msat;
3544
+ // If the last hop is not an announced channel, and only a single route hint was
3545
+ // provided, we refrain from probing all the way through to the end and instead probe
3546
+ // up to the second-to-last channel.
3547
+ if let Some(last_path_hop) = path.hops.last() {
3548
+ if !last_path_hop.announced {
3549
+ if let Payee::Clear { node_id, ref route_hints, .. } = route_params.payment_params.payee {
3550
+ if route_hints.len() == 1 {
3551
+ if let Some(hint) = route_hints[0].0.iter().last() {
3552
+ if last_path_hop.pubkey == node_id && last_path_hop.short_channel_id == hint.short_channel_id {
3553
+ let final_value_msat = path.final_value_msat();
3554
+ path.hops.pop();
3555
+ if let Some(new_last) = path.hops.iter_mut().last() {
3556
+ new_last.fee_msat += final_value_msat;
3557
+ }
3556
3558
}
3557
3559
}
3558
3560
}
0 commit comments