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