@@ -967,7 +967,7 @@ where
967
967
let mut htlc_msat = * first_hop_htlc_msat;
968
968
let mut _error_code_ret = None ;
969
969
let mut _error_packet_ret = None ;
970
- let mut is_from_final_node = false ;
970
+ let mut is_from_final_non_blinded_node = false ;
971
971
972
972
const BADONION : u16 = 0x8000 ;
973
973
const PERM : u16 = 0x4000 ;
@@ -1011,6 +1011,8 @@ where
1011
1011
)
1012
1012
. expect ( "Route we used spontaneously grew invalid keys in the middle of it?" ) ;
1013
1013
1014
+ let num_blinded_hops = path. blinded_tail . as_ref ( ) . map_or ( 0 , |bt| bt. hops . len ( ) ) ;
1015
+
1014
1016
// Handle packed channel/node updates for passing back for the route handler
1015
1017
let mut iterator = onion_keys. into_iter ( ) . peekable ( ) ;
1016
1018
while let Some ( ( route_hop_option, shared_secret) ) = iterator. next ( ) {
@@ -1032,10 +1034,9 @@ where
1032
1034
1033
1035
// The failing hop includes either the inbound channel to the recipient or the outbound channel
1034
1036
// from the current hop (i.e., the next hop's inbound channel).
1035
- let num_blinded_hops = path. blinded_tail . as_ref ( ) . map_or ( 0 , |bt| bt. hops . len ( ) ) ;
1036
1037
// For 1-hop blinded paths, the final `path.hops` entry is the recipient.
1037
- is_from_final_node = iterator. peek ( ) . is_none ( ) && num_blinded_hops <= 1 ;
1038
- let failing_route_hop = if is_from_final_node {
1038
+ is_from_final_non_blinded_node = iterator. peek ( ) . is_none ( ) && num_blinded_hops <= 1 ;
1039
+ let failing_route_hop = if is_from_final_non_blinded_node {
1039
1040
route_hop
1040
1041
} else {
1041
1042
match iterator. peek ( ) {
@@ -1100,7 +1101,7 @@ where
1100
1101
res = Some ( FailureLearnings {
1101
1102
network_update,
1102
1103
short_channel_id,
1103
- payment_failed_permanently : is_from_final_node ,
1104
+ payment_failed_permanently : is_from_final_non_blinded_node ,
1104
1105
failed_within_blinded_path : false ,
1105
1106
} ) ;
1106
1107
break ;
@@ -1122,7 +1123,7 @@ where
1122
1123
res = Some ( FailureLearnings {
1123
1124
network_update,
1124
1125
short_channel_id,
1125
- payment_failed_permanently : is_from_final_node ,
1126
+ payment_failed_permanently : is_from_final_non_blinded_node ,
1126
1127
failed_within_blinded_path : false ,
1127
1128
} ) ;
1128
1129
break ;
@@ -1139,7 +1140,7 @@ where
1139
1140
let payment_failed = match error_code & 0xff {
1140
1141
15 | 16 | 17 | 18 | 19 | 23 => true ,
1141
1142
_ => false ,
1142
- } && is_from_final_node ; // PERM bit observed below even if this error is from the intermediate nodes
1143
+ } && is_from_final_non_blinded_node ; // PERM bit observed below even if this error is from the intermediate nodes
1143
1144
1144
1145
let mut network_update = None ;
1145
1146
let mut short_channel_id = None ;
@@ -1226,7 +1227,7 @@ where
1226
1227
res = Some ( FailureLearnings {
1227
1228
network_update,
1228
1229
short_channel_id,
1229
- payment_failed_permanently : error_code & PERM == PERM && is_from_final_node ,
1230
+ payment_failed_permanently : error_code & PERM == PERM && is_from_final_non_blinded_node ,
1230
1231
failed_within_blinded_path : false ,
1231
1232
} ) ;
1232
1233
@@ -1285,7 +1286,7 @@ where
1285
1286
DecodedOnionFailure {
1286
1287
network_update : None ,
1287
1288
short_channel_id : None ,
1288
- payment_failed_permanently : is_from_final_node ,
1289
+ payment_failed_permanently : is_from_final_non_blinded_node ,
1289
1290
failed_within_blinded_path : false ,
1290
1291
#[ cfg( any( test, feature = "_test_utils" ) ) ]
1291
1292
onion_error_code : None ,
0 commit comments