Skip to content

Commit 19ea6ba

Browse files
committed
Documentation improvements
1 parent 50eb269 commit 19ea6ba

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,9 +1701,11 @@ where
17011701
/// Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a
17021702
/// successful path, or have unresolved HTLCs.
17031703
///
1704-
/// This can be useful for figuring out whether or not a payment needs to be retried.
1705-
/// In general, if it is not listed here, you should consider retrying it if not
1706-
/// [`RecentPaymentDetails::Fulfilled`].
1704+
/// This can be useful for payments that may have been prepared, but ultimately not sent, as a
1705+
/// result of a crash. If such a payment exists, is not listed here, and an
1706+
/// [`Event::PaymentSent`] event has yet to be received, you may consider retrying the payment.
1707+
///
1708+
/// [`Event::PaymentSent`]: events::Event::PaymentSent
17071709
pub fn list_recent_payments(&self) -> Vec<RecentPaymentDetails> {
17081710
self.pending_outbound_payments.pending_outbound_payments.lock().unwrap().iter()
17091711
.filter_map(|(_, pending_outbound_payment)| match pending_outbound_payment {
@@ -2482,6 +2484,11 @@ where
24822484
/// irrevocably committed to on our end. In such a case, do NOT retry the payment with a
24832485
/// different route unless you intend to pay twice!
24842486
///
2487+
/// Additionally, if the process of sending a payment begins, but we crash before send_payment
2488+
/// returns (or prior to MonitorUpdate completion if you're using
2489+
/// [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See
2490+
/// [`ChannelManager::list_recent_payments`] for more information.
2491+
///
24852492
/// payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
24862493
/// the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
24872494
/// newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
@@ -2494,6 +2501,7 @@ where
24942501
///
24952502
/// [`Event::PaymentSent`]: events::Event::PaymentSent
24962503
/// [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
2504+
/// [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
24972505
pub fn send_payment(&self, route: &Route, payment_hash: PaymentHash, payment_secret: &Option<PaymentSecret>, payment_id: PaymentId) -> Result<(), PaymentSendFailure> {
24982506
let best_block_height = self.best_block.read().unwrap().height();
24992507
self.pending_outbound_payments

0 commit comments

Comments
 (0)