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
2597
2597
/// [`Event::PaymentSent`]: events::Event::PaymentSent
2598
2598
pub fn abandon_payment ( & self , payment_id : PaymentId ) {
2599
2599
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 ) ;
2603
2601
}
2604
2602
2605
2603
/// 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 {
1120
1120
if let Some ( ev) = pending_retry_ev { pending_events. push ( ev) ; }
1121
1121
}
1122
1122
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
+ ) {
1125
1126
let mut outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
1126
1127
if let hash_map:: Entry :: Occupied ( mut payment) = outbounds. entry ( payment_id) {
1127
1128
if let Ok ( ( ) ) = payment. get_mut ( ) . mark_abandoned ( ) {
1128
1129
if payment. get ( ) . remaining_parts ( ) == 0 {
1129
- failed_ev = Some ( events:: Event :: PaymentFailed {
1130
+ pending_events . lock ( ) . unwrap ( ) . push ( events:: Event :: PaymentFailed {
1130
1131
payment_id,
1131
1132
payment_hash : payment. get ( ) . payment_hash ( ) . expect ( "PendingOutboundPayments::RetriesExceeded always has a payment hash set" ) ,
1132
1133
} ) ;
1133
1134
payment. remove ( ) ;
1134
1135
}
1135
1136
}
1136
1137
}
1137
- failed_ev
1138
1138
}
1139
1139
1140
1140
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments