9
9
//!
10
10
//! [BOLT 12]: https://github.com/lightning/bolts/blob/master/12-offer-encoding.md
11
11
12
- use crate :: config:: LDK_PAYMENT_RETRY_TIMEOUT ;
12
+ use crate :: config:: { Config , LDK_PAYMENT_RETRY_TIMEOUT } ;
13
13
use crate :: error:: Error ;
14
14
use crate :: ffi:: { maybe_deref, maybe_wrap} ;
15
15
use crate :: logger:: { log_error, log_info, LdkLogger , Logger } ;
@@ -57,16 +57,16 @@ pub struct Bolt12Payment {
57
57
channel_manager : Arc < ChannelManager > ,
58
58
payment_store : Arc < PaymentStore > ,
59
59
is_running : Arc < RwLock < bool > > ,
60
- async_payment_services_enabled : bool ,
60
+ config : Arc < Config > ,
61
61
logger : Arc < Logger > ,
62
62
}
63
63
64
64
impl Bolt12Payment {
65
65
pub ( crate ) fn new (
66
66
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 > ,
68
68
) -> Self {
69
- Self { channel_manager, payment_store, async_payment_services_enabled , is_running, logger }
69
+ Self { channel_manager, payment_store, config , is_running, logger }
70
70
}
71
71
72
72
/// Send a payment given an offer.
@@ -462,6 +462,8 @@ impl Bolt12Payment {
462
462
///
463
463
/// Useful for posting offers to receive payments later, such as posting an offer on a website.
464
464
///
465
+ /// **Caution**: Async payments support is considered experimental.
466
+ ///
465
467
/// [`StaticInvoice`]: lightning::offers::static_invoice::StaticInvoice
466
468
/// [`Offer`]: lightning::offers::offer::Offer
467
469
pub fn receive_async ( & self ) -> Result < Offer , Error > {
@@ -474,6 +476,8 @@ impl Bolt12Payment {
474
476
/// Sets the [`BlindedMessagePath`]s that we will use as an async recipient to interactively build [`Offer`]s with a
475
477
/// static invoice server, so the server can serve [`StaticInvoice`]s to payers on our behalf when we're offline.
476
478
///
479
+ /// **Caution**: Async payments support is considered experimental.
480
+ ///
477
481
/// [`Offer`]: lightning::offers::offer::Offer
478
482
/// [`StaticInvoice`]: lightning::offers::static_invoice::StaticInvoice
479
483
#[ cfg( not( feature = "uniffi" ) ) ]
@@ -488,6 +492,8 @@ impl Bolt12Payment {
488
492
/// Sets the [`BlindedMessagePath`]s that we will use as an async recipient to interactively build [`Offer`]s with a
489
493
/// static invoice server, so the server can serve [`StaticInvoice`]s to payers on our behalf when we're offline.
490
494
///
495
+ /// **Caution**: Async payments support is considered experimental.
496
+ ///
491
497
/// [`Offer`]: lightning::offers::offer::Offer
492
498
/// [`StaticInvoice`]: lightning::offers::static_invoice::StaticInvoice
493
499
#[ cfg( feature = "uniffi" ) ]
@@ -503,6 +509,8 @@ impl Bolt12Payment {
503
509
/// [`BlindedMessagePath`]s for an async recipient to communicate with this node and interactively
504
510
/// build [`Offer`]s and [`StaticInvoice`]s for receiving async payments.
505
511
///
512
+ /// **Caution**: Async payments support is considered experimental.
513
+ ///
506
514
/// [`Offer`]: lightning::offers::offer::Offer
507
515
/// [`StaticInvoice`]: lightning::offers::static_invoice::StaticInvoice
508
516
#[ cfg( not( feature = "uniffi" ) ) ]
@@ -515,6 +523,8 @@ impl Bolt12Payment {
515
523
/// [`BlindedMessagePath`]s for an async recipient to communicate with this node and interactively
516
524
/// build [`Offer`]s and [`StaticInvoice`]s for receiving async payments.
517
525
///
526
+ /// **Caution**: Async payments support is considered experimental.
527
+ ///
518
528
/// [`Offer`]: lightning::offers::offer::Offer
519
529
/// [`StaticInvoice`]: lightning::offers::static_invoice::StaticInvoice
520
530
#[ cfg( feature = "uniffi" ) ]
@@ -531,7 +541,7 @@ impl Bolt12Payment {
531
541
fn blinded_paths_for_async_recipient_internal (
532
542
& self , recipient_id : Vec < u8 > ,
533
543
) -> Result < Vec < BlindedMessagePath > , Error > {
534
- if !self . async_payment_services_enabled {
544
+ if !self . config . async_payment_services_enabled {
535
545
return Err ( Error :: AsyncPaymentServicesDisabled ) ;
536
546
}
537
547
0 commit comments