@@ -868,9 +868,11 @@ impl OutboundPayments {
868868 // is already updated at the time the invoice is received. This ensures that `InvoiceReceived`
869869 // event generation remains idempotent, even if the same invoice is received again before the
870870 // current one is handled by the user.
871- if !with_manual_handling { self . mark_invoice_received ( payment_id, payment_hash) ? }
872-
873- let ( retry_strategy, params_config) = self . received_invoice_details ( payment_id) ?;
871+ let ( retry_strategy, params_config) = if with_manual_handling {
872+ self . received_invoice_details ( payment_id) ?
873+ } else {
874+ self . mark_invoice_received_and_get_details ( payment_id, payment_hash) ?
875+ } ;
874876
875877 if invoice. invoice_features ( ) . requires_unknown_bits_from ( & features) {
876878 self . abandon_payment (
@@ -1778,21 +1780,23 @@ impl OutboundPayments {
17781780 }
17791781 }
17801782
1781- pub ( super ) fn mark_invoice_received (
1783+ pub ( super ) fn mark_invoice_received_and_get_details (
17821784 & self , payment_id : PaymentId , payment_hash : PaymentHash
1783- ) -> Result < ( ) , Bolt12PaymentError > {
1785+ ) -> Result < ( Retry , RouteParametersConfig ) , Bolt12PaymentError > {
17841786 match self . pending_outbound_payments . lock ( ) . unwrap ( ) . entry ( payment_id) {
17851787 hash_map:: Entry :: Occupied ( entry) => match entry. get ( ) {
17861788 PendingOutboundPayment :: AwaitingInvoice {
17871789 retry_strategy : retry, route_params_config, ..
17881790 } => {
1791+ let retry = * retry;
1792+ let config = * route_params_config;
17891793 * entry. into_mut ( ) = PendingOutboundPayment :: InvoiceReceived {
17901794 payment_hash,
1791- retry_strategy : * retry,
1792- route_params_config : * route_params_config ,
1795+ retry_strategy : retry,
1796+ route_params_config : config ,
17931797 } ;
17941798
1795- Ok ( ( ) )
1799+ Ok ( ( retry , config ) )
17961800 } ,
17971801 _ => Err ( Bolt12PaymentError :: DuplicateInvoice ) ,
17981802 } ,
0 commit comments