99//!
1010//! [BOLT 12]: https://github.com/lightning/bolts/blob/master/12-offer-encoding.md
1111
12- use crate :: config:: LDK_PAYMENT_RETRY_TIMEOUT ;
12+ use crate :: config:: { Config , LDK_PAYMENT_RETRY_TIMEOUT } ;
1313use crate :: error:: Error ;
1414use crate :: ffi:: { maybe_deref, maybe_wrap} ;
1515use crate :: logger:: { log_error, log_info, LdkLogger , Logger } ;
@@ -57,16 +57,16 @@ pub struct Bolt12Payment {
5757 channel_manager : Arc < ChannelManager > ,
5858 payment_store : Arc < PaymentStore > ,
5959 is_running : Arc < RwLock < bool > > ,
60- async_payment_services_enabled : bool ,
60+ config : Arc < Config > ,
6161 logger : Arc < Logger > ,
6262}
6363
6464impl Bolt12Payment {
6565 pub ( crate ) fn new (
6666 channel_manager : Arc < ChannelManager > , payment_store : Arc < PaymentStore > ,
67- async_payment_services_enabled : bool , is_running : Arc < RwLock < bool > > , logger : Arc < Logger > ,
67+ config : Arc < Config > , is_running : Arc < RwLock < bool > > , logger : Arc < Logger > ,
6868 ) -> Self {
69- Self { channel_manager, payment_store, async_payment_services_enabled , is_running, logger }
69+ Self { channel_manager, payment_store, config , is_running, logger }
7070 }
7171
7272 /// Send a payment given an offer.
@@ -462,6 +462,8 @@ impl Bolt12Payment {
462462 ///
463463 /// Useful for posting offers to receive payments later, such as posting an offer on a website.
464464 ///
465+ /// **Caution**: Async payments support is considered experimental.
466+ ///
465467 /// [`StaticInvoice`]: lightning::offers::static_invoice::StaticInvoice
466468 /// [`Offer`]: lightning::offers::offer::Offer
467469 pub fn receive_async ( & self ) -> Result < Offer , Error > {
@@ -474,6 +476,8 @@ impl Bolt12Payment {
474476 /// Sets the [`BlindedMessagePath`]s that we will use as an async recipient to interactively build [`Offer`]s with a
475477 /// static invoice server, so the server can serve [`StaticInvoice`]s to payers on our behalf when we're offline.
476478 ///
479+ /// **Caution**: Async payments support is considered experimental.
480+ ///
477481 /// [`Offer`]: lightning::offers::offer::Offer
478482 /// [`StaticInvoice`]: lightning::offers::static_invoice::StaticInvoice
479483 #[ cfg( not( feature = "uniffi" ) ) ]
@@ -488,6 +492,8 @@ impl Bolt12Payment {
488492 /// Sets the [`BlindedMessagePath`]s that we will use as an async recipient to interactively build [`Offer`]s with a
489493 /// static invoice server, so the server can serve [`StaticInvoice`]s to payers on our behalf when we're offline.
490494 ///
495+ /// **Caution**: Async payments support is considered experimental.
496+ ///
491497 /// [`Offer`]: lightning::offers::offer::Offer
492498 /// [`StaticInvoice`]: lightning::offers::static_invoice::StaticInvoice
493499 #[ cfg( feature = "uniffi" ) ]
@@ -503,6 +509,8 @@ impl Bolt12Payment {
503509 /// [`BlindedMessagePath`]s for an async recipient to communicate with this node and interactively
504510 /// build [`Offer`]s and [`StaticInvoice`]s for receiving async payments.
505511 ///
512+ /// **Caution**: Async payments support is considered experimental.
513+ ///
506514 /// [`Offer`]: lightning::offers::offer::Offer
507515 /// [`StaticInvoice`]: lightning::offers::static_invoice::StaticInvoice
508516 #[ cfg( not( feature = "uniffi" ) ) ]
@@ -515,6 +523,8 @@ impl Bolt12Payment {
515523 /// [`BlindedMessagePath`]s for an async recipient to communicate with this node and interactively
516524 /// build [`Offer`]s and [`StaticInvoice`]s for receiving async payments.
517525 ///
526+ /// **Caution**: Async payments support is considered experimental.
527+ ///
518528 /// [`Offer`]: lightning::offers::offer::Offer
519529 /// [`StaticInvoice`]: lightning::offers::static_invoice::StaticInvoice
520530 #[ cfg( feature = "uniffi" ) ]
@@ -531,7 +541,7 @@ impl Bolt12Payment {
531541 fn blinded_paths_for_async_recipient_internal (
532542 & self , recipient_id : Vec < u8 > ,
533543 ) -> Result < Vec < BlindedMessagePath > , Error > {
534- if !self . async_payment_services_enabled {
544+ if !self . config . async_payment_services_enabled {
535545 return Err ( Error :: AsyncPaymentServicesDisabled ) ;
536546 }
537547
0 commit comments