@@ -735,8 +735,8 @@ impl OutboundPayments {
735
735
736
736
fn handle_pay_route_err < R : Deref , NS : Deref , ES : Deref , IH , SP , L : Deref > (
737
737
& self , err : PaymentSendFailure , payment_id : PaymentId , payment_hash : PaymentHash , route : Route ,
738
- route_params : RouteParameters , router : & R , first_hops : Vec < ChannelDetails > , inflight_htlcs : & IH ,
739
- entropy_source : & ES , node_signer : & NS , best_block_height : u32 , logger : & L ,
738
+ mut route_params : RouteParameters , router : & R , first_hops : Vec < ChannelDetails > ,
739
+ inflight_htlcs : & IH , entropy_source : & ES , node_signer : & NS , best_block_height : u32 , logger : & L ,
740
740
pending_events : & Mutex < Vec < events:: Event > > , send_payment_along_path : & SP ,
741
741
)
742
742
where
@@ -750,11 +750,11 @@ impl OutboundPayments {
750
750
{
751
751
match err {
752
752
PaymentSendFailure :: AllFailedResendSafe ( errs) => {
753
- Self :: push_payment_path_failed_evs ( payment_id, payment_hash, route. paths , errs. into_iter ( ) . map ( |e| Err ( e) ) , pending_events) ;
753
+ 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) ;
754
754
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) ;
755
755
} ,
756
- PaymentSendFailure :: PartialFailure { failed_paths_retry : Some ( retry) , results, .. } => {
757
- Self :: push_payment_path_failed_evs ( payment_id, payment_hash, route. paths , results. into_iter ( ) , pending_events) ;
756
+ PaymentSendFailure :: PartialFailure { failed_paths_retry : Some ( mut retry) , results, .. } => {
757
+ Self :: push_path_failed_evs_and_scids ( payment_id, payment_hash, & mut retry , route. paths , results. into_iter ( ) , pending_events) ;
758
758
// Some paths were sent, even if we failed to send the full MPP value our recipient may
759
759
// misbehave and claim the funds, at which point we have to consider the payment sent, so
760
760
// return `Ok()` here, ignoring any retry errors.
@@ -766,7 +766,7 @@ impl OutboundPayments {
766
766
// initial HTLC-Add messages yet.
767
767
} ,
768
768
PaymentSendFailure :: PathParameterError ( results) => {
769
- Self :: push_payment_path_failed_evs ( payment_id, payment_hash, route. paths , results. into_iter ( ) , pending_events) ;
769
+ Self :: push_path_failed_evs_and_scids ( payment_id, payment_hash, & mut route_params , route. paths , results. into_iter ( ) , pending_events) ;
770
770
self . abandon_payment ( payment_id, pending_events) ;
771
771
} ,
772
772
PaymentSendFailure :: ParameterError ( e) => {
@@ -777,9 +777,9 @@ impl OutboundPayments {
777
777
}
778
778
}
779
779
780
- fn push_payment_path_failed_evs < I : ExactSizeIterator + Iterator < Item = Result < ( ) , APIError > > > (
781
- payment_id : PaymentId , payment_hash : PaymentHash , paths : Vec < Vec < RouteHop > > , path_results : I ,
782
- pending_events : & Mutex < Vec < events:: Event > >
780
+ fn push_path_failed_evs_and_scids < I : ExactSizeIterator + Iterator < Item = Result < ( ) , APIError > > > (
781
+ payment_id : PaymentId , payment_hash : PaymentHash , route_params : & mut RouteParameters ,
782
+ paths : Vec < Vec < RouteHop > > , path_results : I , pending_events : & Mutex < Vec < events:: Event > >
783
783
) {
784
784
let mut events = pending_events. lock ( ) . unwrap ( ) ;
785
785
debug_assert_eq ! ( paths. len( ) , path_results. len( ) ) ;
@@ -788,7 +788,9 @@ impl OutboundPayments {
788
788
let failed_scid = if let APIError :: InvalidRoute { .. } = e {
789
789
None
790
790
} else {
791
- Some ( path[ 0 ] . short_channel_id )
791
+ let scid = path[ 0 ] . short_channel_id ;
792
+ route_params. payment_params . previously_failed_channels . push ( scid) ;
793
+ Some ( scid)
792
794
} ;
793
795
events. push ( events:: Event :: PaymentPathFailed {
794
796
payment_id : Some ( payment_id) ,
0 commit comments