@@ -747,11 +747,11 @@ impl OutboundPayments {
747
747
{
748
748
match err {
749
749
PaymentSendFailure :: AllFailedResendSafe ( errs) => {
750
- Self :: push_payment_path_failed_evs ( payment_id, payment_hash, Some ( & mut route_params) , route. paths , errs. into_iter ( ) . map ( |e| Err ( e) ) , pending_events) ;
750
+ Self :: push_path_failed_evs_and_scids ( payment_id, payment_hash, & mut route_params, route. paths , errs. into_iter ( ) . map ( |e| Err ( e) ) , pending_events) ;
751
751
self . retry_payment_internal ( payment_id, route_params, router, first_hops, inflight_htlcs, entropy_source, node_signer, best_block_height, logger, pending_events, send_payment_along_path) ;
752
752
} ,
753
- PaymentSendFailure :: PartialFailure { failed_paths_retry : Some ( retry) , results, .. } => {
754
- Self :: push_payment_path_failed_evs ( payment_id, payment_hash, None , route. paths , results. into_iter ( ) , pending_events) ;
753
+ PaymentSendFailure :: PartialFailure { failed_paths_retry : Some ( mut retry) , results, .. } => {
754
+ Self :: push_path_failed_evs_and_scids ( payment_id, payment_hash, & mut retry , route. paths , results. into_iter ( ) , pending_events) ;
755
755
// Some paths were sent, even if we failed to send the full MPP value our recipient may
756
756
// misbehave and claim the funds, at which point we have to consider the payment sent, so
757
757
// return `Ok()` here, ignoring any retry errors.
@@ -763,7 +763,7 @@ impl OutboundPayments {
763
763
// initial HTLC-Add messages yet.
764
764
} ,
765
765
PaymentSendFailure :: PathParameterError ( results) => {
766
- Self :: push_payment_path_failed_evs ( payment_id, payment_hash, None , route. paths , results. into_iter ( ) , pending_events) ;
766
+ Self :: push_path_failed_evs_and_scids ( payment_id, payment_hash, & mut route_params , route. paths , results. into_iter ( ) , pending_events) ;
767
767
self . abandon_payment ( payment_id, pending_events) ;
768
768
} ,
769
769
PaymentSendFailure :: ParameterError ( e) => {
@@ -774,19 +774,16 @@ impl OutboundPayments {
774
774
}
775
775
}
776
776
777
- fn push_payment_path_failed_evs < I : ExactSizeIterator + Iterator < Item = Result < ( ) , APIError > > > (
778
- payment_id : PaymentId , payment_hash : PaymentHash ,
779
- mut route_params : Option < & mut RouteParameters > , paths : Vec < Vec < RouteHop > > , path_results : I ,
780
- pending_events : & Mutex < Vec < events:: Event > >
777
+ fn push_path_failed_evs_and_scids < I : ExactSizeIterator + Iterator < Item = Result < ( ) , APIError > > > (
778
+ payment_id : PaymentId , payment_hash : PaymentHash , route_params : & mut RouteParameters ,
779
+ paths : Vec < Vec < RouteHop > > , path_results : I , pending_events : & Mutex < Vec < events:: Event > >
781
780
) {
782
781
let mut events = pending_events. lock ( ) . unwrap ( ) ;
783
782
debug_assert_eq ! ( paths. len( ) , path_results. len( ) ) ;
784
783
for ( path, path_res) in paths. into_iter ( ) . zip ( path_results) {
785
784
if path_res. is_err ( ) {
786
785
let scid = path[ 0 ] . short_channel_id ;
787
- if let Some ( ref mut params) = route_params {
788
- params. payment_params . previously_failed_channels . push ( scid) ;
789
- }
786
+ route_params. payment_params . previously_failed_channels . push ( scid) ;
790
787
events. push ( events:: Event :: PaymentPathFailed {
791
788
payment_id : Some ( payment_id) ,
792
789
payment_hash,
0 commit comments