@@ -3350,7 +3350,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
3350
3350
} else { None } ;
3351
3351
log_trace ! ( self . logger, "Failing outbound payment HTLC with payment_hash {}" , log_bytes!( payment_hash. 0 ) ) ;
3352
3352
3353
- match & onion_error {
3353
+ let path_failure = match & onion_error {
3354
3354
& HTLCFailReason :: LightningError { ref err } => {
3355
3355
#[ cfg( test) ]
3356
3356
let ( network_update, short_channel_id, payment_retryable, onion_error_code, onion_error_data) = onion_utils:: process_onion_failure ( & self . secp_ctx , & self . logger , & source, err. data . clone ( ) ) ;
@@ -3359,8 +3359,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
3359
3359
// TODO: If we decided to blame ourselves (or one of our channels) in
3360
3360
// process_onion_failure we should close that channel as it implies our
3361
3361
// next-hop is needlessly blaming us!
3362
- let mut pending_events = self . pending_events . lock ( ) . unwrap ( ) ;
3363
- pending_events. push ( events:: Event :: PaymentPathFailed {
3362
+ events:: Event :: PaymentPathFailed {
3364
3363
payment_id : Some ( payment_id) ,
3365
3364
payment_hash : payment_hash. clone ( ) ,
3366
3365
rejected_by_dest : !payment_retryable,
@@ -3373,8 +3372,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
3373
3372
error_code : onion_error_code,
3374
3373
#[ cfg( test) ]
3375
3374
error_data : onion_error_data
3376
- } ) ;
3377
- if let Some ( ev) = full_failure_ev { pending_events. push ( ev) ; }
3375
+ }
3378
3376
} ,
3379
3377
& HTLCFailReason :: Reason {
3380
3378
#[ cfg( test) ]
@@ -3389,8 +3387,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
3389
3387
// ChannelDetails.
3390
3388
// TODO: For non-temporary failures, we really should be closing the
3391
3389
// channel here as we apparently can't relay through them anyway.
3392
- let mut pending_events = self . pending_events . lock ( ) . unwrap ( ) ;
3393
- pending_events. push ( events:: Event :: PaymentPathFailed {
3390
+ events:: Event :: PaymentPathFailed {
3394
3391
payment_id : Some ( payment_id) ,
3395
3392
payment_hash : payment_hash. clone ( ) ,
3396
3393
rejected_by_dest : path. len ( ) == 1 ,
@@ -3403,10 +3400,12 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
3403
3400
error_code : Some ( * failure_code) ,
3404
3401
#[ cfg( test) ]
3405
3402
error_data : Some ( data. clone ( ) ) ,
3406
- } ) ;
3407
- if let Some ( ev) = full_failure_ev { pending_events. push ( ev) ; }
3403
+ }
3408
3404
}
3409
- }
3405
+ } ;
3406
+ let mut pending_events = self . pending_events . lock ( ) . unwrap ( ) ;
3407
+ pending_events. push ( path_failure) ;
3408
+ if let Some ( ev) = full_failure_ev { pending_events. push ( ev) ; }
3410
3409
} ,
3411
3410
HTLCSource :: PreviousHopData ( HTLCPreviousHopData { short_channel_id, htlc_id, incoming_packet_shared_secret, .. } ) => {
3412
3411
let err_packet = match onion_error {
0 commit comments