Skip to content

Commit 90ce06b

Browse files
committed
Improve docs
1 parent 624b423 commit 90ce06b

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,8 +1140,8 @@ pub enum RecentPaymentDetails {
11401140
/// Hash of the payment that is currently being sent but has yet to be fulfilled or
11411141
/// abandoned.
11421142
payment_hash: PaymentHash,
1143-
/// Total amount (in msat) across all paths for this payment, not just the amount currently
1144-
/// inflight.
1143+
/// Total amount (in msat, excluding fees) across all paths for this payment,
1144+
/// not just the amount currently inflight.
11451145
total_msat: u64,
11461146
},
11471147
/// When a pending payment is fulfilled, we continue tracking it until all pending HTLCs have
@@ -2452,6 +2452,8 @@ where
24522452
/// Value parameters are provided via the last hop in route, see documentation for RouteHop
24532453
/// fields for more info.
24542454
///
2455+
/// # Avoiding Duplicate Payments
2456+
///
24552457
/// If a pending payment is currently in-flight with the same [`PaymentId`] provided, this
24562458
/// method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment
24572459
/// is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an
@@ -2464,12 +2466,19 @@ where
24642466
/// consider using the [`PaymentHash`] as the key for tracking payments. In that case, the
24652467
/// [`PaymentId`] should be a copy of the [`PaymentHash`] bytes.
24662468
///
2469+
/// Additionally, in the scenario where we begin the process of sending a payment, but crash
2470+
/// before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're
2471+
/// using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See
2472+
/// [`ChannelManager::list_recent_payments`] for more information.
2473+
///
24672474
/// May generate SendHTLCs message(s) event on success, which should be relayed (e.g. via
24682475
/// [`PeerManager::process_events`]).
24692476
///
2477+
/// # Possible Error States on PaymentSendFailure
2478+
///
24702479
/// Each path may have a different return value, and PaymentSendValue may return a Vec with
24712480
/// each entry matching the corresponding-index entry in the route paths, see
2472-
/// PaymentSendFailure for more info.
2481+
/// [`PaymentSendFailure`] for more info.
24732482
///
24742483
/// In general, a path may raise:
24752484
/// * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee,
@@ -2484,20 +2493,17 @@ where
24842493
/// irrevocably committed to on our end. In such a case, do NOT retry the payment with a
24852494
/// different route unless you intend to pay twice!
24862495
///
2487-
/// Thus, in order to ensure duplicate payments are not sent, if we begin the process of sending
2488-
/// a payment, but crash before `send_payment` returns (or prior to [`ChannelMonitorUpdate`]
2489-
/// persistence if you're using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be
2490-
/// lost on restart. See [`ChannelManager::list_recent_payments`] for more information.
2496+
/// # A caution on `payment_secret`
24912497
///
2492-
/// payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
2493-
/// the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
2494-
/// newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
2495-
/// must not contain multiple paths as multi-path payments require a recipient-provided
2496-
/// payment_secret.
2498+
/// `payment_secret` is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to
2499+
/// authenticate the sender to the recipient and prevent payment-probing (deanonymization)
2500+
/// attacks. For newer nodes, it will be provided to you in the invoice. If you do not have one,
2501+
/// the Route must not contain multiple paths as multi-path payments require a
2502+
/// recipient-provided `payment_secret`.
24972503
///
2498-
/// If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
2499-
/// bit set (either as required or as available). If multiple paths are present in the Route,
2500-
/// we assume the invoice had the basic_mpp feature set.
2504+
/// If a `payment_secret` *is* provided, we assume that the invoice had the payment_secret
2505+
/// feature bit set (either as required or as available). If multiple paths are present in the
2506+
/// Route, we assume the invoice had the basic_mpp feature set.
25012507
///
25022508
/// [`Event::PaymentSent`]: events::Event::PaymentSent
25032509
/// [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events

0 commit comments

Comments
 (0)