16
16
//!
17
17
//! [`InvoicePayer`] caches each [`Invoice`] by its `payment_hash` so that it can retry the payment
18
18
//! 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 .
21
21
//!
22
22
//! # Example
23
23
//!
24
24
//! TODO: Fill this in once the API is finalized.
25
25
//!
26
26
//! # Note
27
27
//!
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.
32
31
33
32
use crate :: Invoice ;
34
33
@@ -112,7 +111,11 @@ where
112
111
L :: Target : Logger ,
113
112
E : EventHandler ,
114
113
{
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
116
119
pub fn new ( payer : P , router : R , logger : L , event_handler : E ) -> Self {
117
120
Self {
118
121
payer,
@@ -130,7 +133,7 @@ where
130
133
Self { retry_attempts, ..self }
131
134
}
132
135
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.
134
137
pub fn pay_invoice ( & self , invoice : & Invoice ) -> Result < ( ) , PaymentError > {
135
138
let payment_hash = PaymentHash ( invoice. payment_hash ( ) . clone ( ) . into_inner ( ) ) ;
136
139
let mut invoice_cache = self . invoice_cache . lock ( ) . unwrap ( ) ;
0 commit comments