@@ -313,14 +313,14 @@ where
313
313
// Some paths were sent, even if we failed to send the full MPP value our recipient may
314
314
// misbehave and claim the funds, at which point we have to consider the payment sent,
315
315
// so return `Ok()` here, ignoring any retry errors.
316
- let _ = self . retry_payment ( true , payment_id, payment_hash, & retry) ;
316
+ let _ = self . retry_payment ( payment_id, payment_hash, & retry) ;
317
317
Ok ( payment_id)
318
318
} else {
319
319
self . pay_invoice_internal ( invoice, amount_msats, retry_count + 1 )
320
320
}
321
321
}
322
322
323
- fn retry_payment ( & self , other_paths_pending : bool , payment_id : PaymentId , payment_hash : PaymentHash , params : & RouteParameters )
323
+ fn retry_payment ( & self , payment_id : PaymentId , payment_hash : PaymentHash , params : & RouteParameters )
324
324
-> Result < ( ) , ( ) > {
325
325
let route;
326
326
{
@@ -339,11 +339,9 @@ where
339
339
340
340
if * attempts >= max_payment_attempts {
341
341
log_trace ! ( self . logger, "Payment {} exceeded maximum attempts; not retrying (attempts: {})" , log_bytes!( payment_hash. 0 ) , attempts) ;
342
- if !other_paths_pending { entry. remove ( ) ; }
343
342
return Err ( ( ) ) ;
344
343
} else if has_expired ( params) {
345
344
log_trace ! ( self . logger, "Invoice expired for payment {}; not retrying (attempts: {})" , log_bytes!( payment_hash. 0 ) , attempts) ;
346
- if !other_paths_pending { entry. remove ( ) ; }
347
345
return Err ( ( ) ) ;
348
346
}
349
347
@@ -352,7 +350,6 @@ where
352
350
route = self . router . find_route ( & payer, & params, Some ( & first_hops. iter ( ) . collect :: < Vec < _ > > ( ) ) , & self . scorer . lock ( ) ) ;
353
351
if route. is_err ( ) {
354
352
log_trace ! ( self . logger, "Failed to find a route for payment {}; not retrying (attempts: {})" , log_bytes!( payment_hash. 0 ) , attempts) ;
355
- if !other_paths_pending { entry. remove ( ) ; }
356
353
return Err ( ( ) ) ;
357
354
}
358
355
} else {
@@ -366,15 +363,14 @@ where
366
363
Err ( PaymentSendFailure :: ParameterError ( _) ) |
367
364
Err ( PaymentSendFailure :: PathParameterError ( _) ) => {
368
365
log_trace ! ( self . logger, "Failed to retry for payment {} due to bogus route/payment data, not retrying." , log_bytes!( payment_hash. 0 ) ) ;
369
- if !other_paths_pending { self . payment_cache . lock ( ) . unwrap ( ) . remove ( & payment_hash) ; }
370
366
return Err ( ( ) ) ;
371
367
} ,
372
368
Err ( PaymentSendFailure :: AllFailedRetrySafe ( _) ) => {
373
- self . retry_payment ( other_paths_pending , payment_id, payment_hash, params)
369
+ self . retry_payment ( payment_id, payment_hash, params)
374
370
} ,
375
371
Err ( PaymentSendFailure :: PartialFailure { results : _, failed_paths_retry, .. } ) => {
376
372
if let Some ( retry) = failed_paths_retry {
377
- self . retry_payment ( true , payment_id, payment_hash, & retry)
373
+ self . retry_payment ( payment_id, payment_hash, & retry)
378
374
} else {
379
375
Ok ( ( ) )
380
376
}
@@ -420,19 +416,17 @@ where
420
416
421
417
if * rejected_by_dest {
422
418
log_trace ! ( self . logger, "Payment {} rejected by destination; not retrying" , log_bytes!( payment_hash. 0 ) ) ;
423
- if * all_paths_failed { self . payment_cache . lock ( ) . unwrap ( ) . remove ( payment_hash) ; }
424
419
} else if payment_id. is_none ( ) {
425
420
log_trace ! ( self . logger, "Payment {} has no id; not retrying" , log_bytes!( payment_hash. 0 ) ) ;
426
- if * all_paths_failed { self . payment_cache . lock ( ) . unwrap ( ) . remove ( payment_hash) ; }
427
421
} else if let Some ( params) = retry {
428
- if self . retry_payment ( !all_paths_failed , payment_id. unwrap ( ) , * payment_hash, params) . is_ok ( ) {
422
+ if self . retry_payment ( payment_id. unwrap ( ) , * payment_hash, params) . is_ok ( ) {
429
423
// We retried at least somewhat, don't provide the PaymentPathFailed event to the user.
430
424
return ;
431
425
}
432
426
} else {
433
427
log_trace ! ( self . logger, "Payment {} missing retry params; not retrying" , log_bytes!( payment_hash. 0 ) ) ;
434
- if * all_paths_failed { self . payment_cache . lock ( ) . unwrap ( ) . remove ( payment_hash) ; }
435
428
}
429
+ if * all_paths_failed { self . payment_cache . lock ( ) . unwrap ( ) . remove ( payment_hash) ; }
436
430
} ,
437
431
Event :: PaymentSent { payment_hash, .. } => {
438
432
let mut payment_cache = self . payment_cache . lock ( ) . unwrap ( ) ;
0 commit comments