@@ -1107,6 +1107,8 @@ where
11071107 // Keep track of the first hop for which the attribution data failed to check out.
11081108 let mut attribution_failed_channel = None ;
11091109
1110+ let trampoline_hop_count = path. blinded_tail . as_ref ( ) . map_or ( 0 , |bt| bt. trampoline_hops . len ( ) ) ;
1111+
11101112 // Handle packed channel/node updates for passing back for the route handler
11111113 let mut iter = nontrampolines. chain ( trampolines. into_iter ( ) . flatten ( ) ) . enumerate ( ) . peekable ( ) ;
11121114 while let Some ( ( route_hop_idx, ( route_hop_option, shared_secret) ) ) = iter. next ( ) {
@@ -1373,17 +1375,19 @@ where
13731375 short_channel_id = route_hop. short_channel_id ( )
13741376 }
13751377
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 .
13791381 let is_next_hop_from_trampoline =
13801382 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+ }
13811386
13821387 res = Some ( FailureLearnings {
13831388 network_update,
13841389 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,
13871391 failed_within_blinded_path : false ,
13881392 } ) ;
13891393
0 commit comments