@@ -1502,6 +1502,9 @@ impl OutboundPayments {
15021502 & self , pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > )
15031503 {
15041504 let mut pending_outbound_payments = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
1505+ #[ cfg( not( invreqfailed) ) ]
1506+ let pending_events = pending_events. lock ( ) . unwrap ( ) ;
1507+ #[ cfg( invreqfailed) ]
15051508 let mut pending_events = pending_events. lock ( ) . unwrap ( ) ;
15061509 pending_outbound_payments. retain ( |payment_id, payment| {
15071510 // If an outbound payment was completed, and no pending HTLCs remain, we should remove it
@@ -1540,6 +1543,7 @@ impl OutboundPayments {
15401543 if * timer_ticks_without_response <= INVOICE_REQUEST_TIMEOUT_TICKS {
15411544 true
15421545 } else {
1546+ #[ cfg( invreqfailed) ]
15431547 pending_events. push_back (
15441548 ( events:: Event :: InvoiceRequestFailed { payment_id : * payment_id } , None )
15451549 ) ;
@@ -1692,6 +1696,7 @@ impl OutboundPayments {
16921696 payment. remove ( ) ;
16931697 }
16941698 } else if let PendingOutboundPayment :: AwaitingInvoice { .. } = payment. get ( ) {
1699+ #[ cfg( invreqfailed) ]
16951700 pending_events. lock ( ) . unwrap ( ) . push_back ( ( events:: Event :: InvoiceRequestFailed {
16961701 payment_id,
16971702 } , None ) ) ;
@@ -1782,7 +1787,9 @@ mod tests {
17821787 use crate :: ln:: channelmanager:: { PaymentId , RecipientOnionFields } ;
17831788 use crate :: ln:: features:: { ChannelFeatures , NodeFeatures } ;
17841789 use crate :: ln:: msgs:: { ErrorAction , LightningError } ;
1785- use crate :: ln:: outbound_payment:: { Bolt12PaymentError , INVOICE_REQUEST_TIMEOUT_TICKS , OutboundPayments , Retry , RetryableSendFailure } ;
1790+ use crate :: ln:: outbound_payment:: { Bolt12PaymentError , OutboundPayments , Retry , RetryableSendFailure } ;
1791+ #[ cfg( invreqfailed) ]
1792+ use crate :: ln:: outbound_payment:: INVOICE_REQUEST_TIMEOUT_TICKS ;
17861793 use crate :: offers:: invoice:: DEFAULT_RELATIVE_EXPIRY ;
17871794 use crate :: offers:: offer:: OfferBuilder ;
17881795 use crate :: offers:: test_utils:: * ;
@@ -1985,6 +1992,7 @@ mod tests {
19851992 }
19861993
19871994 #[ test]
1995+ #[ cfg( invreqfailed) ]
19881996 fn removes_stale_awaiting_invoice ( ) {
19891997 let pending_events = Mutex :: new ( VecDeque :: new ( ) ) ;
19901998 let outbound_payments = OutboundPayments :: new ( ) ;
@@ -2023,6 +2031,7 @@ mod tests {
20232031 }
20242032
20252033 #[ test]
2034+ #[ cfg( invreqfailed) ]
20262035 fn removes_abandoned_awaiting_invoice ( ) {
20272036 let pending_events = Mutex :: new ( VecDeque :: new ( ) ) ;
20282037 let outbound_payments = OutboundPayments :: new ( ) ;
0 commit comments