Skip to content

Commit

Permalink
Document PendingOutboundPayment::{Static}InvoiceReceived semantics.
Browse files Browse the repository at this point in the history
While these variants may sound similar, they are very different. One is so
temporary it's never even persisted to disk, the other is a state we will stay
in for hours or days. See added docs for more info.
  • Loading branch information
valentinewallace committed Sep 10, 2024
1 parent f764757 commit 65362fe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lightning/src/ln/outbound_payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,20 @@ pub(crate) enum PendingOutboundPayment {
max_total_routing_fee_msat: Option<u64>,
invoice_request: Option<InvoiceRequest>,
},
// This state will never be persisted to disk because we transition from `AwaitingInvoice` to
// `Retryable` atomically within the `ChannelManager::total_consistency_lock`. Useful to avoid
// holding the `OutboundPayments::pending_outbound_payments` lock during pathfinding.
InvoiceReceived {
payment_hash: PaymentHash,
retry_strategy: Retry,
// Note this field is currently just replicated from AwaitingInvoice but not actually
// used anywhere.
max_total_routing_fee_msat: Option<u64>,
},
// This state applies when we are paying an often-offline recipient and another node on the
// network served us a static invoice on the recipient's behalf in response to our invoice
// request. As a result, once a payment gets in this state it will remain here until the recipient
// comes back online, which may take hours or even days.
StaticInvoiceReceived {
payment_hash: PaymentHash,
keysend_preimage: PaymentPreimage,
Expand Down

0 comments on commit 65362fe

Please sign in to comment.