File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed
Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -2597,9 +2597,7 @@ where
25972597 /// [`Event::PaymentSent`]: events::Event::PaymentSent
25982598 pub fn abandon_payment ( & self , payment_id : PaymentId ) {
25992599 let _persistence_guard = PersistenceNotifierGuard :: notify_on_drop ( & self . total_consistency_lock , & self . persistence_notifier ) ;
2600- if let Some ( payment_failed_ev) = self . pending_outbound_payments . abandon_payment ( payment_id) {
2601- self . pending_events . lock ( ) . unwrap ( ) . push ( payment_failed_ev) ;
2602- }
2600+ self . pending_outbound_payments . abandon_payment ( payment_id, & self . pending_events ) ;
26032601 }
26042602
26052603 /// Send a spontaneous payment, which is a payment that does not require the recipient to have
Original file line number Diff line number Diff line change @@ -1120,21 +1120,21 @@ impl OutboundPayments {
11201120 if let Some ( ev) = pending_retry_ev { pending_events. push ( ev) ; }
11211121 }
11221122
1123- pub ( super ) fn abandon_payment ( & self , payment_id : PaymentId ) -> Option < events:: Event > {
1124- let mut failed_ev = None ;
1123+ pub ( super ) fn abandon_payment (
1124+ & self , payment_id : PaymentId , pending_events : & Mutex < Vec < events:: Event > >
1125+ ) {
11251126 let mut outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
11261127 if let hash_map:: Entry :: Occupied ( mut payment) = outbounds. entry ( payment_id) {
11271128 if let Ok ( ( ) ) = payment. get_mut ( ) . mark_abandoned ( ) {
11281129 if payment. get ( ) . remaining_parts ( ) == 0 {
1129- failed_ev = Some ( events:: Event :: PaymentFailed {
1130+ pending_events . lock ( ) . unwrap ( ) . push ( events:: Event :: PaymentFailed {
11301131 payment_id,
11311132 payment_hash : payment. get ( ) . payment_hash ( ) . expect ( "PendingOutboundPayments::RetriesExceeded always has a payment hash set" ) ,
11321133 } ) ;
11331134 payment. remove ( ) ;
11341135 }
11351136 }
11361137 }
1137- failed_ev
11381138 }
11391139
11401140 #[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments