Skip to content

Commit f409fd1

Browse files
committed
f - Fix docs
1 parent 7a0286c commit f409fd1

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

lightning-invoice/src/payment.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,18 @@
1616
//!
1717
//! [`InvoicePayer`] caches each [`Invoice`] by its `payment_hash` so that it can retry the payment
1818
//! if it fails. It accomplishes this by implementing [`EventHandler`] which decorates a
19-
//! user-provided handler. It will intercepts any [`Event::PaymentPathFailed`] events and retry the
20-
//! payment a fixed number of times before failing or succeeding as needed.
19+
//! user-provided handler. It will intercept any [`Event::PaymentPathFailed`] events and retry the
20+
//! payment a fixed number of times before failing or succeeding as appropriate.
2121
//!
2222
//! # Example
2323
//!
2424
//! TODO: Fill this in once the API is finalized.
2525
//!
2626
//! # Note
2727
//!
28-
//! The [`Route`] is compute before each payment attempt. Any updates affecting path finding such as
29-
//! updates to the network graph or changes to channels scores should be applied prior to retries.
30-
//! This typically means any [`EventHandler`] decorators responsible for this should decorate
31-
//! [`InvoicePayer`] so that such changes take effect before retrying.
28+
//! The [`Route`] is computed before each payment attempt. Any updates affecting path finding such
29+
//! as updates to the network graph or changes to channel scores should be applied prior to
30+
//! retries, typically by way of composing [`EventHandler`]s accordingly.
3231
3332
use crate::Invoice;
3433

@@ -112,7 +111,11 @@ where
112111
L::Target: Logger,
113112
E: EventHandler,
114113
{
115-
/// Creates an invoice payer.
114+
/// Creates an invoice payer that does not retry.
115+
///
116+
/// To enable retries, chain `new` with a call to [`with_retry_attempts`].
117+
///
118+
/// [`with_retry_attempts`]: Self::with_retry_attempts
116119
pub fn new(payer: P, router: R, logger: L, event_handler: E) -> Self {
117120
Self {
118121
payer,
@@ -130,7 +133,7 @@ where
130133
Self { retry_attempts, ..self }
131134
}
132135

133-
/// Pays the given [`Invoice`], caching it for later use if a retry is needed.
136+
/// Pays the given [`Invoice`], caching it for later use in case a retry is needed.
134137
pub fn pay_invoice(&self, invoice: &Invoice) -> Result<(), PaymentError> {
135138
let payment_hash = PaymentHash(invoice.payment_hash().clone().into_inner());
136139
let mut invoice_cache = self.invoice_cache.lock().unwrap();

0 commit comments

Comments
 (0)