@@ -725,8 +725,8 @@ impl OutboundPayments {
725
725
726
726
fn handle_pay_route_err < R : Deref , NS : Deref , ES : Deref , IH , SP , L : Deref > (
727
727
& self , err : PaymentSendFailure , payment_id : PaymentId , payment_hash : PaymentHash , route : Route ,
728
- route_params : RouteParameters , router : & R , first_hops : Vec < ChannelDetails > , inflight_htlcs : & IH ,
729
- entropy_source : & ES , node_signer : & NS , best_block_height : u32 , logger : & L ,
728
+ mut route_params : RouteParameters , router : & R , first_hops : Vec < ChannelDetails > ,
729
+ inflight_htlcs : & IH , entropy_source : & ES , node_signer : & NS , best_block_height : u32 , logger : & L ,
730
730
pending_events : & Mutex < Vec < events:: Event > > , send_payment_along_path : & SP ,
731
731
)
732
732
where
@@ -740,11 +740,11 @@ impl OutboundPayments {
740
740
{
741
741
match err {
742
742
PaymentSendFailure :: AllFailedResendSafe ( errs) => {
743
- push_payment_path_failed_evs ( payment_id, payment_hash, route. paths , errs. into_iter ( ) . map ( |e| Err ( e) ) , pending_events) ;
743
+ push_path_failed_evs_and_scids ( payment_id, payment_hash, Some ( & mut route_params ) , route. paths , errs. into_iter ( ) . map ( |e| Err ( e) ) , pending_events) ;
744
744
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) ;
745
745
} ,
746
746
PaymentSendFailure :: PartialFailure { failed_paths_retry : Some ( retry) , results, .. } => {
747
- push_payment_path_failed_evs ( payment_id, payment_hash, route. paths , results. into_iter ( ) , pending_events) ;
747
+ push_path_failed_evs_and_scids ( payment_id, payment_hash, None , route. paths , results. into_iter ( ) , pending_events) ;
748
748
// Some paths were sent, even if we failed to send the full MPP value our recipient may
749
749
// misbehave and claim the funds, at which point we have to consider the payment sent, so
750
750
// return `Ok()` here, ignoring any retry errors.
@@ -756,7 +756,7 @@ impl OutboundPayments {
756
756
// initial HTLC-Add messages yet.
757
757
} ,
758
758
PaymentSendFailure :: PathParameterError ( results) => {
759
- push_payment_path_failed_evs ( payment_id, payment_hash, route. paths , results. into_iter ( ) , pending_events) ;
759
+ push_path_failed_evs_and_scids ( payment_id, payment_hash, None , route. paths , results. into_iter ( ) , pending_events) ;
760
760
self . abandon_payment ( payment_id, pending_events) ;
761
761
} ,
762
762
PaymentSendFailure :: ParameterError ( e) => {
@@ -1261,14 +1261,17 @@ impl OutboundPayments {
1261
1261
}
1262
1262
}
1263
1263
1264
- fn push_payment_path_failed_evs < I : Iterator < Item = Result < ( ) , APIError > > > (
1265
- payment_id : PaymentId , payment_hash : PaymentHash , paths : Vec < Vec < RouteHop > > , path_results : I ,
1266
- pending_events : & Mutex < Vec < events:: Event > >
1264
+ fn push_path_failed_evs_and_scids < I : Iterator < Item = Result < ( ) , APIError > > > (
1265
+ payment_id : PaymentId , payment_hash : PaymentHash , mut route_params : Option < & mut RouteParameters > ,
1266
+ paths : Vec < Vec < RouteHop > > , path_results : I , pending_events : & Mutex < Vec < events:: Event > >
1267
1267
) {
1268
1268
let mut events = pending_events. lock ( ) . unwrap ( ) ;
1269
1269
for ( path, path_res) in paths. into_iter ( ) . zip ( path_results) {
1270
1270
if let Err ( e) = path_res {
1271
1271
let scid = path[ 0 ] . short_channel_id ;
1272
+ if let Some ( ref mut params) = route_params {
1273
+ params. payment_params . previously_failed_channels . push ( scid) ;
1274
+ }
1272
1275
events. push ( events:: Event :: PaymentPathFailed {
1273
1276
payment_id : Some ( payment_id) ,
1274
1277
payment_hash,
0 commit comments