Skip to content

Commit

Permalink
Update PaymentPurpose's payment_preimage docs
Browse files Browse the repository at this point in the history
Clarify that payment_preimage should only be used to claim a payment
when handling Event::PaymentClaimable, not Event::PaymentClaimed.
  • Loading branch information
jkczyz committed Apr 17, 2024
1 parent e556428 commit c4524a0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lightning/src/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ pub enum PaymentPurpose {
/// A payment for a BOLT 11 invoice.
Bolt11InvoicePayment {
/// The preimage to the payment_hash, if the payment hash (and secret) were fetched via
/// [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
/// [`ChannelManager::claim_funds`].
/// [`ChannelManager::create_inbound_payment`]. When handling [`Event::PaymentClaimable`],
/// this can be passed directly to [`ChannelManager::claim_funds`] to claim the payment. No
/// action is needed when seen in [`Event::PaymentClaimed`].
///
/// [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
/// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
Expand All @@ -75,8 +76,9 @@ pub enum PaymentPurpose {
///
/// [`Offer`]: crate::offers::offer::Offer
Bolt12OfferPayment {
/// The preimage to the payment hash. If provided, this can be handed directly to
/// [`ChannelManager::claim_funds`].
/// The preimage to the payment hash. When handling [`Event::PaymentClaimable`], this can be
/// passed directly to [`ChannelManager::claim_funds`], if provided. No action is needed
/// when seen in [`Event::PaymentClaimed`].
///
/// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
payment_preimage: Option<PaymentPreimage>,
Expand All @@ -96,8 +98,9 @@ pub enum PaymentPurpose {
///
/// [`Refund`]: crate::offers::refund::Refund
Bolt12RefundPayment {
/// The preimage to the payment hash. If provided, this can be handed directly to
/// [`ChannelManager::claim_funds`].
/// The preimage to the payment hash. When handling [`Event::PaymentClaimable`], this can be
/// passed directly to [`ChannelManager::claim_funds`], if provided. No action is needed
/// when seen in [`Event::PaymentClaimed`].
///
/// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
payment_preimage: Option<PaymentPreimage>,
Expand Down

0 comments on commit c4524a0

Please sign in to comment.