Skip to content

Commit ed96df7

Browse files
Document PendingOutboundPayment::{Static}InvoiceReceived semantics.
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.
1 parent b2809e1 commit ed96df7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lightning/src/ln/outbound_payment.rs

+7
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,20 @@ pub(crate) enum PendingOutboundPayment {
6464
max_total_routing_fee_msat: Option<u64>,
6565
retryable_invoice_request: Option<RetryableInvoiceRequest>
6666
},
67+
// This state will never be persisted to disk because we transition from `AwaitingInvoice` to
68+
// `Retryable` atomically within the `ChannelManager::total_consistency_lock`. Useful to avoid
69+
// holding the `OutboundPayments::pending_outbound_payments` lock during pathfinding.
6770
InvoiceReceived {
6871
payment_hash: PaymentHash,
6972
retry_strategy: Retry,
7073
// Note this field is currently just replicated from AwaitingInvoice but not actually
7174
// used anywhere.
7275
max_total_routing_fee_msat: Option<u64>,
7376
},
77+
// This state applies when we are paying an often-offline recipient and another node on the
78+
// network served us a static invoice on the recipient's behalf in response to our invoice
79+
// request. As a result, once a payment gets in this state it will remain here until the recipient
80+
// comes back online, which may take hours or even days.
7481
StaticInvoiceReceived {
7582
payment_hash: PaymentHash,
7683
keysend_preimage: PaymentPreimage,

0 commit comments

Comments
 (0)