@@ -1502,6 +1502,9 @@ impl OutboundPayments {
1502
1502
& self , pending_events : & Mutex < VecDeque < ( events:: Event , Option < EventCompletionAction > ) > > )
1503
1503
{
1504
1504
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) ]
1505
1508
let mut pending_events = pending_events. lock ( ) . unwrap ( ) ;
1506
1509
pending_outbound_payments. retain ( |payment_id, payment| {
1507
1510
// If an outbound payment was completed, and no pending HTLCs remain, we should remove it
@@ -1540,6 +1543,7 @@ impl OutboundPayments {
1540
1543
if * timer_ticks_without_response <= INVOICE_REQUEST_TIMEOUT_TICKS {
1541
1544
true
1542
1545
} else {
1546
+ #[ cfg( invreqfailed) ]
1543
1547
pending_events. push_back (
1544
1548
( events:: Event :: InvoiceRequestFailed { payment_id : * payment_id } , None )
1545
1549
) ;
@@ -1692,6 +1696,7 @@ impl OutboundPayments {
1692
1696
payment. remove ( ) ;
1693
1697
}
1694
1698
} else if let PendingOutboundPayment :: AwaitingInvoice { .. } = payment. get ( ) {
1699
+ #[ cfg( invreqfailed) ]
1695
1700
pending_events. lock ( ) . unwrap ( ) . push_back ( ( events:: Event :: InvoiceRequestFailed {
1696
1701
payment_id,
1697
1702
} , None ) ) ;
@@ -1782,7 +1787,9 @@ mod tests {
1782
1787
use crate :: ln:: channelmanager:: { PaymentId , RecipientOnionFields } ;
1783
1788
use crate :: ln:: features:: { ChannelFeatures , NodeFeatures } ;
1784
1789
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 ;
1786
1793
use crate :: offers:: invoice:: DEFAULT_RELATIVE_EXPIRY ;
1787
1794
use crate :: offers:: offer:: OfferBuilder ;
1788
1795
use crate :: offers:: test_utils:: * ;
@@ -1985,6 +1992,7 @@ mod tests {
1985
1992
}
1986
1993
1987
1994
#[ test]
1995
+ #[ cfg( invreqfailed) ]
1988
1996
fn removes_stale_awaiting_invoice ( ) {
1989
1997
let pending_events = Mutex :: new ( VecDeque :: new ( ) ) ;
1990
1998
let outbound_payments = OutboundPayments :: new ( ) ;
@@ -2023,6 +2031,7 @@ mod tests {
2023
2031
}
2024
2032
2025
2033
#[ test]
2034
+ #[ cfg( invreqfailed) ]
2026
2035
fn removes_abandoned_awaiting_invoice ( ) {
2027
2036
let pending_events = Mutex :: new ( VecDeque :: new ( ) ) ;
2028
2037
let outbound_payments = OutboundPayments :: new ( ) ;
0 commit comments