Skip to content

Commit 1969b48

Browse files
committed
Note that abandon_payment does not persist the state update in docs
If a user calls `abandon_payment`, then restarts without freshly persisting the `ChannelManager`, the payment will still be pending on restart. This was unclear from the docs (and the docs seemed to imply otherwise). Because this doesn't materially impact the usability of `abandon_payment` (users shouldn't be called `retry_payment` on an abandoned one anyway), we simply document it. Fixes #1804.
1 parent d9d4611 commit 1969b48

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
@@ -2761,15 +2761,21 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
27612761

27622762
/// Signals that no further retries for the given payment will occur.
27632763
///
2764-
/// After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
2765-
/// will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
2766-
/// an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
2767-
/// pending HTLCs for this payment.
2764+
/// After this method returns, no future calls to [`retry_payment`] for the given `payment_id`
2765+
/// are allowed. If no [`Event::PaymentFailed`] event had been generated before, one will be
2766+
/// generated as soon as there are no remaining pending HTLCs for this payment.
27682767
///
27692768
/// Note that calling this method does *not* prevent a payment from succeeding. You must still
27702769
/// wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
27712770
/// determine the ultimate status of a payment.
27722771
///
2772+
/// If an [`Event::PaymentFailed`] event is generated and we restart without this
2773+
/// [`ChannelManager`] having been persisted, the payment may still be in the pending state
2774+
/// upon restart. This allows further calls to [`retry_payment`] (and requiring a second call
2775+
/// to [`abandon_payment`] to mark the payment as failed again). Otherwise, future calls to
2776+
/// [`retry_payment`] will fail with [`PaymentSendFailure::ParameterError`].
2777+
///
2778+
/// [`abandon_payment`]: Self::abandon_payment
27732779
/// [`retry_payment`]: Self::retry_payment
27742780
/// [`Event::PaymentFailed`]: events::Event::PaymentFailed
27752781
/// [`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)