@@ -486,34 +486,38 @@ impl OutboundPayments {
486
486
487
487
let res = self . retry_payment_with_route ( & route, payment_id, entropy_source, node_signer, best_block_height, send_payment_along_path) ;
488
488
match res {
489
- Err ( PaymentSendFailure :: AllFailedResendSafe ( _) ) | Err ( PaymentSendFailure :: PartialFailure { .. } ) => {
489
+ Err ( PaymentSendFailure :: AllFailedResendSafe ( _) ) => {
490
490
let mut outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
491
491
if let Some ( payment) = outbounds. get_mut ( & payment_id) {
492
492
let retryable = payment. is_retryable_now ( ) ;
493
493
if retryable {
494
494
payment. increment_attempts ( ) ;
495
495
} else { return res }
496
496
} else { return res }
497
- }
498
- res => return res
499
- }
500
- match res {
501
- Err ( PaymentSendFailure :: AllFailedResendSafe ( _) ) => {
497
+ core:: mem:: drop ( outbounds) ;
502
498
self . pay_internal ( payment_id, route_params, router, first_hops, inflight_htlcs, entropy_source, node_signer, best_block_height, send_payment_along_path)
503
499
} ,
504
- Err ( PaymentSendFailure :: PartialFailure { failed_paths_retry, .. } ) => {
505
- if let Some ( retry) = failed_paths_retry {
506
- // Some paths were sent, even if we failed to send the full MPP value our recipient may
507
- // misbehave and claim the funds, at which point we have to consider the payment sent, so
508
- // return `Ok()` here, ignoring any retry errors.
509
- let _ = self . pay_internal ( payment_id, retry, router, first_hops, inflight_htlcs, entropy_source, node_signer, best_block_height, send_payment_along_path) ;
510
- Ok ( ( ) )
511
- } else {
512
- // This may happen if we send a payment and some paths fail, but only due to a temporary
513
- // monitor failure or the like, implying they're really in-flight, but we haven't sent the
514
- // initial HTLC-Add messages yet.
515
- Ok ( ( ) )
516
- }
500
+ Err ( PaymentSendFailure :: PartialFailure { failed_paths_retry : Some ( retry) , results, .. } ) => {
501
+ let mut outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
502
+ if let Some ( payment) = outbounds. get_mut ( & payment_id) {
503
+ let retryable = payment. is_retryable_now ( ) ;
504
+ if retryable {
505
+ payment. increment_attempts ( ) ;
506
+ } else { return Err ( PaymentSendFailure :: PartialFailure { failed_paths_retry : Some ( retry) , results, payment_id } ) }
507
+ } else { return Err ( PaymentSendFailure :: PartialFailure { failed_paths_retry : Some ( retry) , results, payment_id } ) }
508
+ core:: mem:: drop ( outbounds) ;
509
+
510
+ // Some paths were sent, even if we failed to send the full MPP value our recipient may
511
+ // misbehave and claim the funds, at which point we have to consider the payment sent, so
512
+ // return `Ok()` here, ignoring any retry errors.
513
+ let _ = self . pay_internal ( payment_id, retry, router, first_hops, inflight_htlcs, entropy_source, node_signer, best_block_height, send_payment_along_path) ;
514
+ Ok ( ( ) )
515
+ } ,
516
+ Err ( PaymentSendFailure :: PartialFailure { failed_paths_retry : None , .. } ) => {
517
+ // This may happen if we send a payment and some paths fail, but only due to a temporary
518
+ // monitor failure or the like, implying they're really in-flight, but we haven't sent the
519
+ // initial HTLC-Add messages yet.
520
+ Ok ( ( ) )
517
521
} ,
518
522
res => res,
519
523
}
0 commit comments