Skip to content

Commit 831d102

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 831d102

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2761,15 +2761,20 @@ 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, and most should fail with [`PaymentSendFailure::ParameterError`]. If no such
2766+
/// event has been generated, an [`Event::PaymentFailed`] event will be generated as soon as
2767+
/// there are no remaining pending HTLCs for this payment.
27682768
///
27692769
/// Note that calling this method does *not* prevent a payment from succeeding. You must still
27702770
/// wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
27712771
/// determine the ultimate status of a payment.
27722772
///
2773+
/// If an [`Event::PaymentFailed`] event is generated, and then you restart without this
2774+
/// [`ChannelManager`] having been persisted, the payment may still be in the pending state
2775+
/// upon restart, allowing further calls to [`retry_payment`] (and requiring a second call to
2776+
/// [`abandon_payment`] to mark the payment as failed again).
2777+
///
27732778
/// [`retry_payment`]: Self::retry_payment
27742779
/// [`Event::PaymentFailed`]: events::Event::PaymentFailed
27752780
/// [`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)