Skip to content

Commit b291f4a

Browse files
authored
Merge pull request #1907 from TheBlueMatt/2022-12-abandon-crash-reset
Note that abandon_payment does not persist the state update in docs
2 parents a4df59b + 1969b48 commit b291f4a

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2790,15 +2790,21 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
27902790

27912791
/// Signals that no further retries for the given payment will occur.
27922792
///
2793-
/// After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
2794-
/// will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
2795-
/// an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
2796-
/// pending HTLCs for this payment.
2793+
/// After this method returns, no future calls to [`retry_payment`] for the given `payment_id`
2794+
/// are allowed. If no [`Event::PaymentFailed`] event had been generated before, one will be
2795+
/// generated as soon as there are no remaining pending HTLCs for this payment.
27972796
///
27982797
/// Note that calling this method does *not* prevent a payment from succeeding. You must still
27992798
/// wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
28002799
/// determine the ultimate status of a payment.
28012800
///
2801+
/// If an [`Event::PaymentFailed`] event is generated and we restart without this
2802+
/// [`ChannelManager`] having been persisted, the payment may still be in the pending state
2803+
/// upon restart. This allows further calls to [`retry_payment`] (and requiring a second call
2804+
/// to [`abandon_payment`] to mark the payment as failed again). Otherwise, future calls to
2805+
/// [`retry_payment`] will fail with [`PaymentSendFailure::ParameterError`].
2806+
///
2807+
/// [`abandon_payment`]: Self::abandon_payment
28022808
/// [`retry_payment`]: Self::retry_payment
28032809
/// [`Event::PaymentFailed`]: events::Event::PaymentFailed
28042810
/// [`Event::PaymentSent`]: events::Event::PaymentSent
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## API Updates
2+
- `ChannelManager::abandon_payment` docs have been updated to note that the
3+
payment may return to pending after a restart if no persistence occurs. This
4+
is not a change in behavior - ensure your existing code is safe.

0 commit comments

Comments
 (0)