@@ -1107,6 +1107,8 @@ where
1107
1107
// Keep track of the first hop for which the attribution data failed to check out.
1108
1108
let mut attribution_failed_channel = None ;
1109
1109
1110
+ let trampoline_hop_count = path. blinded_tail . as_ref ( ) . map_or ( 0 , |bt| bt. trampoline_hops . len ( ) ) ;
1111
+
1110
1112
// Handle packed channel/node updates for passing back for the route handler
1111
1113
let mut iter = nontrampolines. chain ( trampolines. into_iter ( ) . flatten ( ) ) . enumerate ( ) . peekable ( ) ;
1112
1114
while let Some ( ( route_hop_idx, ( route_hop_option, shared_secret) ) ) = iter. next ( ) {
@@ -1373,17 +1375,19 @@ where
1373
1375
short_channel_id = route_hop. short_channel_id ( )
1374
1376
}
1375
1377
1376
- // If next hop is from a trampoline we are already inside the trampoline
1377
- // route. If we found a permanent failure inside the trampoline route, we
1378
- // fail the payment permanently .
1378
+ // If next hop is from a trampoline and there is only one trampoline hop
1379
+ // in the trampoline route, means that the trampoline hop is also a
1380
+ // final non-blinded node .
1379
1381
let is_next_hop_from_trampoline =
1380
1382
matches ! ( next_hop, Some ( ( _, ( Some ( ErrorHop :: TrampolineHop ( ..) ) , _) ) ) ) ;
1383
+ if is_next_hop_from_trampoline && trampoline_hop_count == 1 {
1384
+ is_from_final_non_blinded_node = true ;
1385
+ }
1381
1386
1382
1387
res = Some ( FailureLearnings {
1383
1388
network_update,
1384
1389
short_channel_id,
1385
- payment_failed_permanently : error_code. is_permanent ( )
1386
- && ( is_from_final_non_blinded_node || is_next_hop_from_trampoline) ,
1390
+ payment_failed_permanently : error_code. is_permanent ( ) && is_from_final_non_blinded_node,
1387
1391
failed_within_blinded_path : false ,
1388
1392
} ) ;
1389
1393
0 commit comments