@@ -1383,22 +1383,20 @@ where
1383
1383
if debug_field_size > 0 && err_packet. failuremsg . len ( ) >= 4 + debug_field_size {
1384
1384
log_info ! (
1385
1385
logger,
1386
- "Onion Error[from {}: {:?}({:#x}) {}({})] {} " ,
1386
+ "Onion Error[from {}: {:?}({:#x}) {}({})]" ,
1387
1387
route_hop. pubkey( ) ,
1388
1388
error_code,
1389
1389
error_code. failure_code( ) ,
1390
1390
debug_field,
1391
1391
log_bytes!( & err_packet. failuremsg[ 4 ..4 + debug_field_size] ) ,
1392
- error_code
1393
1392
) ;
1394
1393
} else {
1395
1394
log_info ! (
1396
1395
logger,
1397
- "Onion Error[from {}: {:?}({:#x})] {} " ,
1396
+ "Onion Error[from {}: {:?}({:#x})]" ,
1398
1397
route_hop. pubkey( ) ,
1399
1398
error_code,
1400
1399
error_code. failure_code( ) ,
1401
- error_code
1402
1400
) ;
1403
1401
}
1404
1402
@@ -1652,6 +1650,7 @@ impl LocalHTLCFailureReason {
1652
1650
}
1653
1651
}
1654
1652
1653
+ /// Returns the name of an error's data field and its expected length.
1655
1654
fn get_onion_debug_field ( & self ) -> ( & ' static str , usize ) {
1656
1655
match self {
1657
1656
Self :: InvalidOnionVersion | Self :: InvalidOnionHMAC | Self :: InvalidOnionKey => {
@@ -1681,7 +1680,9 @@ impl LocalHTLCFailureReason {
1681
1680
self . failure_code ( ) & NODE == NODE
1682
1681
}
1683
1682
1684
- /// Returns true if the failure is only sent by the final recipient.
1683
+ /// Returns true if the failure is only sent by the final recipient. Note that this function
1684
+ /// only checks [`LocalHTLCFailureReason`] variants that represent bolt 04 errors directly,
1685
+ /// as it's intended to analyze errors we've received as a sender.
1685
1686
fn is_recipient_failure ( & self ) -> bool {
1686
1687
self . failure_code ( ) == LocalHTLCFailureReason :: IncorrectPaymentDetails . failure_code ( )
1687
1688
|| * self == LocalHTLCFailureReason :: FinalIncorrectCLTVExpiry
0 commit comments