Skip to content

Commit 2840252

Browse files
committed
Revert "Config-guard Event::InvoiceRequestFailed"
This reverts commit c7219e4.
1 parent 0e41d80 commit 2840252

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

lightning/src/events/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,6 @@ pub enum Event {
517517
/// or was explicitly abandoned by [`ChannelManager::abandon_payment`].
518518
///
519519
/// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
520-
#[cfg(invreqfailed)]
521520
InvoiceRequestFailed {
522521
/// The `payment_id` to have been associated with payment for the requested invoice.
523522
payment_id: PaymentId,
@@ -1164,7 +1163,6 @@ impl Writeable for Event {
11641163
(8, funding_txo, required),
11651164
});
11661165
},
1167-
#[cfg(invreqfailed)]
11681166
&Event::InvoiceRequestFailed { ref payment_id } => {
11691167
33u8.write(writer)?;
11701168
write_tlv_fields!(writer, {
@@ -1558,7 +1556,6 @@ impl MaybeReadable for Event {
15581556
};
15591557
f()
15601558
},
1561-
#[cfg(invreqfailed)]
15621559
33u8 => {
15631560
let f = || {
15641561
_init_and_read_len_prefixed_tlv_fields!(reader, {

lightning/src/ln/channelmanager.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3606,10 +3606,19 @@ where
36063606
/// wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
36073607
/// determine the ultimate status of a payment.
36083608
///
3609+
/// # Requested Invoices
3610+
///
3611+
/// In the case of paying a [`Bolt12Invoice`], abandoning the payment prior to receiving the
3612+
/// invoice will result in an [`Event::InvoiceRequestFailed`] and prevent any attempts at paying
3613+
/// it once received. The other events may only be generated once the invoice has been received.
3614+
///
36093615
/// # Restart Behavior
36103616
///
36113617
/// If an [`Event::PaymentFailed`] is generated and we restart without first persisting the
3612-
/// [`ChannelManager`], another [`Event::PaymentFailed`] may be generated.
3618+
/// [`ChannelManager`], another [`Event::PaymentFailed`] may be generated; likewise for
3619+
/// [`Event::InvoiceRequestFailed`].
3620+
///
3621+
/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
36133622
pub fn abandon_payment(&self, payment_id: PaymentId) {
36143623
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
36153624
self.pending_outbound_payments.abandon_payment(payment_id, PaymentFailureReason::UserAbandoned, &self.pending_events);

lightning/src/ln/outbound_payment.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,9 +1526,6 @@ impl OutboundPayments {
15261526
pending_events: &Mutex<VecDeque<(events::Event, Option<EventCompletionAction>)>>)
15271527
{
15281528
let mut pending_outbound_payments = self.pending_outbound_payments.lock().unwrap();
1529-
#[cfg(not(invreqfailed))]
1530-
let pending_events = pending_events.lock().unwrap();
1531-
#[cfg(invreqfailed)]
15321529
let mut pending_events = pending_events.lock().unwrap();
15331530
pending_outbound_payments.retain(|payment_id, payment| match payment {
15341531
// If an outbound payment was completed, and no pending HTLCs remain, we should remove it
@@ -1578,7 +1575,6 @@ impl OutboundPayments {
15781575
},
15791576
};
15801577
if is_stale {
1581-
#[cfg(invreqfailed)]
15821578
pending_events.push_back(
15831579
(events::Event::InvoiceRequestFailed { payment_id: *payment_id }, None)
15841580
);
@@ -1734,7 +1730,6 @@ impl OutboundPayments {
17341730
payment.remove();
17351731
}
17361732
} else if let PendingOutboundPayment::AwaitingInvoice { .. } = payment.get() {
1737-
#[cfg(invreqfailed)]
17381733
pending_events.lock().unwrap().push_back((events::Event::InvoiceRequestFailed {
17391734
payment_id,
17401735
}, None));
@@ -2032,7 +2027,6 @@ mod tests {
20322027
}
20332028

20342029
#[test]
2035-
#[cfg(invreqfailed)]
20362030
fn removes_stale_awaiting_invoice_using_absolute_timeout() {
20372031
let pending_events = Mutex::new(VecDeque::new());
20382032
let outbound_payments = OutboundPayments::new();
@@ -2083,7 +2077,6 @@ mod tests {
20832077
}
20842078

20852079
#[test]
2086-
#[cfg(invreqfailed)]
20872080
fn removes_stale_awaiting_invoice_using_timer_ticks() {
20882081
let pending_events = Mutex::new(VecDeque::new());
20892082
let outbound_payments = OutboundPayments::new();
@@ -2133,7 +2126,6 @@ mod tests {
21332126
}
21342127

21352128
#[test]
2136-
#[cfg(invreqfailed)]
21372129
fn removes_abandoned_awaiting_invoice() {
21382130
let pending_events = Mutex::new(VecDeque::new());
21392131
let outbound_payments = OutboundPayments::new();

0 commit comments

Comments
 (0)