@@ -9203,6 +9203,13 @@ pub trait OffersMessageCommons {
9203
9203
/// Get pending offers messages
9204
9204
fn get_pending_offers_messages(&self) -> MutexGuard<'_, Vec<(OffersMessage, MessageSendInstructions)>>;
9205
9205
9206
+ /// Get pending DNS onion messages
9207
+ fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>>;
9208
+
9209
+ #[cfg(feature = "dnssec")]
9210
+ /// Get hrn resolver
9211
+ fn get_hrn_resolver(&self) -> &OMNameResolver;
9212
+
9206
9213
/// Gets the node_id held by this ChannelManager
9207
9214
fn get_our_node_id(&self) -> PublicKey;
9208
9215
@@ -9315,6 +9322,13 @@ pub trait OffersMessageCommons {
9315
9322
/// Add new awaiting invoice
9316
9323
fn add_new_awaiting_invoice(&self, payment_id: PaymentId, expiration: StaleExpiration, retry_strategy: Retry, max_total_routing_fee_msat: Option<u64>, retryable_invoice_request: Option<RetryableInvoiceRequest>) -> Result<(), ()>;
9317
9324
9325
+ #[cfg(feature = "dnssec")]
9326
+ /// Add new awaiting offer
9327
+ fn add_new_awaiting_offer(
9328
+ &self, payment_id: PaymentId, expiration: StaleExpiration, retry_strategy: Retry,
9329
+ max_total_routing_fee_msat: Option<u64>, amount_msats: u64,
9330
+ ) -> Result<(), ()>;
9331
+
9318
9332
/// Internal pay_for_offer
9319
9333
fn pay_for_offer_intern<CPP: FnOnce(&InvoiceRequest, Nonce) -> Result<(), Bolt12SemanticError>> (
9320
9334
&self, offer: &Offer, quantity: Option<u64>, amount_msats: Option<u64>,
@@ -9339,6 +9353,15 @@ where
9339
9353
self.pending_offers_messages.lock().expect("Mutex is locked by other thread.")
9340
9354
}
9341
9355
9356
+ fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>> {
9357
+ self.pending_dns_onion_messages.lock().expect("Mutex is locked by other thread.")
9358
+ }
9359
+
9360
+ #[cfg(feature = "dnssec")]
9361
+ fn get_hrn_resolver(&self) -> &OMNameResolver {
9362
+ &self.hrn_resolver
9363
+ }
9364
+
9342
9365
fn get_our_node_id(&self) -> PublicKey {
9343
9366
self.our_network_pubkey.clone()
9344
9367
}
@@ -9509,6 +9532,14 @@ where
9509
9532
)
9510
9533
}
9511
9534
9535
+ #[cfg(feature = "dnssec")]
9536
+ fn add_new_awaiting_offer(
9537
+ &self, payment_id: PaymentId, expiration: StaleExpiration, retry_strategy: Retry,
9538
+ max_total_routing_fee_msat: Option<u64>, amount_msats: u64,
9539
+ ) -> Result<(), ()> {
9540
+ self.pending_outbound_payments.add_new_awaiting_offer(payment_id, expiration, retry_strategy, max_total_routing_fee_msat, amount_msats)
9541
+ }
9542
+
9512
9543
fn pay_for_offer_intern<CPP: FnOnce(&InvoiceRequest, Nonce) -> Result<(), Bolt12SemanticError>>(
9513
9544
&self, offer: &Offer, quantity: Option<u64>, amount_msats: Option<u64>,
9514
9545
payer_note: Option<String>, payment_id: PaymentId,
@@ -9576,73 +9607,6 @@ where
9576
9607
MR::Target: MessageRouter,
9577
9608
L::Target: Logger,
9578
9609
{
9579
- /// Pays for an [`Offer`] looked up using [BIP 353] Human Readable Names resolved by the DNS
9580
- /// resolver(s) at `dns_resolvers` which resolve names according to bLIP 32.
9581
- ///
9582
- /// If the wallet supports paying on-chain schemes, you should instead use
9583
- /// [`OMNameResolver::resolve_name`] and [`OMNameResolver::handle_dnssec_proof_for_uri`] (by
9584
- /// implementing [`DNSResolverMessageHandler`]) directly to look up a URI and then delegate to
9585
- /// your normal URI handling.
9586
- ///
9587
- /// If `max_total_routing_fee_msat` is not specified, the default from
9588
- /// [`RouteParameters::from_payment_params_and_value`] is applied.
9589
- ///
9590
- /// # Payment
9591
- ///
9592
- /// The provided `payment_id` is used to ensure that only one invoice is paid for the request
9593
- /// when received. See [Avoiding Duplicate Payments] for other requirements once the payment has
9594
- /// been sent.
9595
- ///
9596
- /// To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the
9597
- /// invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the
9598
- /// payment will fail with an [`Event::InvoiceRequestFailed`].
9599
- ///
9600
- /// # Privacy
9601
- ///
9602
- /// For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`]
9603
- /// to construct a [`BlindedPath`] for the reply path. For further privacy implications, see the
9604
- /// docs of the parameterized [`Router`], which implements [`MessageRouter`].
9605
- ///
9606
- /// # Limitations
9607
- ///
9608
- /// Requires a direct connection to the given [`Destination`] as well as an introduction node in
9609
- /// [`Offer::paths`] or to [`Offer::signing_pubkey`], if empty. A similar restriction applies to
9610
- /// the responding [`Bolt12Invoice::payment_paths`].
9611
- ///
9612
- /// # Errors
9613
- ///
9614
- /// Errors if:
9615
- /// - a duplicate `payment_id` is provided given the caveats in the aforementioned link,
9616
- ///
9617
- /// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths
9618
- /// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments
9619
- #[cfg(feature = "dnssec")]
9620
- pub fn pay_for_offer_from_human_readable_name(
9621
- &self, name: HumanReadableName, amount_msats: u64, payment_id: PaymentId,
9622
- retry_strategy: Retry, max_total_routing_fee_msat: Option<u64>,
9623
- dns_resolvers: Vec<Destination>,
9624
- ) -> Result<(), ()> {
9625
- let (onion_message, context) =
9626
- self.hrn_resolver.resolve_name(payment_id, name, &*self.entropy_source)?;
9627
- let reply_paths = self.create_blinded_paths(MessageContext::DNSResolver(context))?;
9628
- let expiration = StaleExpiration::TimerTicks(1);
9629
- self.pending_outbound_payments.add_new_awaiting_offer(payment_id, expiration, retry_strategy, max_total_routing_fee_msat, amount_msats)?;
9630
- let message_params = dns_resolvers
9631
- .iter()
9632
- .flat_map(|destination| reply_paths.iter().map(move |path| (path, destination)))
9633
- .take(OFFERS_MESSAGE_REQUEST_LIMIT);
9634
- for (reply_path, destination) in message_params {
9635
- self.pending_dns_onion_messages.lock().unwrap().push((
9636
- DNSResolverMessage::DNSSECQuery(onion_message.clone()),
9637
- MessageSendInstructions::WithSpecifiedReplyPath {
9638
- destination: destination.clone(),
9639
- reply_path: reply_path.clone(),
9640
- },
9641
- ));
9642
- }
9643
- Ok(())
9644
- }
9645
-
9646
9610
/// Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
9647
9611
/// stored external to LDK.
9648
9612
///
0 commit comments