@@ -732,8 +732,8 @@ impl OutboundPayments {
732
732
733
733
fn handle_pay_route_err < R : Deref , NS : Deref , ES : Deref , IH , SP , L : Deref > (
734
734
& self , err : PaymentSendFailure , payment_id : PaymentId , payment_hash : PaymentHash , route : Route ,
735
- route_params : RouteParameters , router : & R , first_hops : Vec < ChannelDetails > , inflight_htlcs : & IH ,
736
- entropy_source : & ES , node_signer : & NS , best_block_height : u32 , logger : & L ,
735
+ mut route_params : RouteParameters , router : & R , first_hops : Vec < ChannelDetails > ,
736
+ inflight_htlcs : & IH , entropy_source : & ES , node_signer : & NS , best_block_height : u32 , logger : & L ,
737
737
pending_events : & Mutex < Vec < events:: Event > > , send_payment_along_path : & SP ,
738
738
)
739
739
where
@@ -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, 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, 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, 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,9 +774,9 @@ 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 , paths : Vec < Vec < RouteHop > > , path_results : I ,
779
- 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 > >
780
780
) {
781
781
let mut events = pending_events. lock ( ) . unwrap ( ) ;
782
782
debug_assert_eq ! ( paths. len( ) , path_results. len( ) ) ;
@@ -785,7 +785,9 @@ impl OutboundPayments {
785
785
let failed_scid = if let APIError :: InvalidRoute { .. } = e {
786
786
None
787
787
} else {
788
- Some ( path[ 0 ] . short_channel_id )
788
+ let scid = path[ 0 ] . short_channel_id ;
789
+ route_params. payment_params . previously_failed_channels . push ( scid) ;
790
+ Some ( scid)
789
791
} ;
790
792
events. push ( events:: Event :: PaymentPathFailed {
791
793
payment_id : Some ( payment_id) ,
0 commit comments