@@ -9514,6 +9514,13 @@ pub trait OffersMessageCommons {
9514
9514
/// Get pending offers messages
9515
9515
fn get_pending_offers_messages(&self) -> MutexGuard<'_, Vec<(OffersMessage, MessageSendInstructions)>>;
9516
9516
9517
+ /// Get pending DNS onion messages
9518
+ fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>>;
9519
+
9520
+ #[cfg(feature = "dnssec")]
9521
+ /// Get hrn resolver
9522
+ fn get_hrn_resolver(&self) -> &OMNameResolver;
9523
+
9517
9524
/// Gets the node_id held by this ChannelManager
9518
9525
fn get_our_node_id(&self) -> PublicKey;
9519
9526
@@ -9626,6 +9633,13 @@ pub trait OffersMessageCommons {
9626
9633
/// Add new awaiting invoice
9627
9634
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<(), ()>;
9628
9635
9636
+ #[cfg(feature = "dnssec")]
9637
+ /// Add new awaiting offer
9638
+ fn add_new_awaiting_offer(
9639
+ &self, payment_id: PaymentId, expiration: StaleExpiration, retry_strategy: Retry,
9640
+ max_total_routing_fee_msat: Option<u64>, amount_msats: u64,
9641
+ ) -> Result<(), ()>;
9642
+
9629
9643
/// Internal pay_for_offer
9630
9644
fn pay_for_offer_intern<CPP: FnOnce(&InvoiceRequest, Nonce) -> Result<(), Bolt12SemanticError>> (
9631
9645
&self, offer: &Offer, quantity: Option<u64>, amount_msats: Option<u64>,
@@ -9650,6 +9664,15 @@ where
9650
9664
self.pending_offers_messages.lock().expect("Mutex is locked by other thread.")
9651
9665
}
9652
9666
9667
+ fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>> {
9668
+ self.pending_dns_onion_messages.lock().expect("Mutex is locked by other thread.")
9669
+ }
9670
+
9671
+ #[cfg(feature = "dnssec")]
9672
+ fn get_hrn_resolver(&self) -> &OMNameResolver {
9673
+ &self.hrn_resolver
9674
+ }
9675
+
9653
9676
fn get_our_node_id(&self) -> PublicKey {
9654
9677
self.our_network_pubkey
9655
9678
}
@@ -9820,6 +9843,14 @@ where
9820
9843
)
9821
9844
}
9822
9845
9846
+ #[cfg(feature = "dnssec")]
9847
+ fn add_new_awaiting_offer(
9848
+ &self, payment_id: PaymentId, expiration: StaleExpiration, retry_strategy: Retry,
9849
+ max_total_routing_fee_msat: Option<u64>, amount_msats: u64,
9850
+ ) -> Result<(), ()> {
9851
+ self.pending_outbound_payments.add_new_awaiting_offer(payment_id, expiration, retry_strategy, max_total_routing_fee_msat, amount_msats)
9852
+ }
9853
+
9823
9854
fn pay_for_offer_intern<CPP: FnOnce(&InvoiceRequest, Nonce) -> Result<(), Bolt12SemanticError>>(
9824
9855
&self, offer: &Offer, quantity: Option<u64>, amount_msats: Option<u64>,
9825
9856
payer_note: Option<String>, payment_id: PaymentId,
@@ -9887,73 +9918,6 @@ where
9887
9918
MR::Target: MessageRouter,
9888
9919
L::Target: Logger,
9889
9920
{
9890
- /// Pays for an [`Offer`] looked up using [BIP 353] Human Readable Names resolved by the DNS
9891
- /// resolver(s) at `dns_resolvers` which resolve names according to bLIP 32.
9892
- ///
9893
- /// If the wallet supports paying on-chain schemes, you should instead use
9894
- /// [`OMNameResolver::resolve_name`] and [`OMNameResolver::handle_dnssec_proof_for_uri`] (by
9895
- /// implementing [`DNSResolverMessageHandler`]) directly to look up a URI and then delegate to
9896
- /// your normal URI handling.
9897
- ///
9898
- /// If `max_total_routing_fee_msat` is not specified, the default from
9899
- /// [`RouteParameters::from_payment_params_and_value`] is applied.
9900
- ///
9901
- /// # Payment
9902
- ///
9903
- /// The provided `payment_id` is used to ensure that only one invoice is paid for the request
9904
- /// when received. See [Avoiding Duplicate Payments] for other requirements once the payment has
9905
- /// been sent.
9906
- ///
9907
- /// To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the
9908
- /// invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the
9909
- /// payment will fail with an [`Event::InvoiceRequestFailed`].
9910
- ///
9911
- /// # Privacy
9912
- ///
9913
- /// For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`]
9914
- /// to construct a [`BlindedPath`] for the reply path. For further privacy implications, see the
9915
- /// docs of the parameterized [`Router`], which implements [`MessageRouter`].
9916
- ///
9917
- /// # Limitations
9918
- ///
9919
- /// Requires a direct connection to the given [`Destination`] as well as an introduction node in
9920
- /// [`Offer::paths`] or to [`Offer::signing_pubkey`], if empty. A similar restriction applies to
9921
- /// the responding [`Bolt12Invoice::payment_paths`].
9922
- ///
9923
- /// # Errors
9924
- ///
9925
- /// Errors if:
9926
- /// - a duplicate `payment_id` is provided given the caveats in the aforementioned link,
9927
- ///
9928
- /// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths
9929
- /// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments
9930
- #[cfg(feature = "dnssec")]
9931
- pub fn pay_for_offer_from_human_readable_name(
9932
- &self, name: HumanReadableName, amount_msats: u64, payment_id: PaymentId,
9933
- retry_strategy: Retry, max_total_routing_fee_msat: Option<u64>,
9934
- dns_resolvers: Vec<Destination>,
9935
- ) -> Result<(), ()> {
9936
- let (onion_message, context) =
9937
- self.hrn_resolver.resolve_name(payment_id, name, &*self.entropy_source)?;
9938
- let reply_paths = self.create_blinded_paths(MessageContext::DNSResolver(context))?;
9939
- let expiration = StaleExpiration::TimerTicks(1);
9940
- self.pending_outbound_payments.add_new_awaiting_offer(payment_id, expiration, retry_strategy, max_total_routing_fee_msat, amount_msats)?;
9941
- let message_params = dns_resolvers
9942
- .iter()
9943
- .flat_map(|destination| reply_paths.iter().map(move |path| (path, destination)))
9944
- .take(OFFERS_MESSAGE_REQUEST_LIMIT);
9945
- for (reply_path, destination) in message_params {
9946
- self.pending_dns_onion_messages.lock().unwrap().push((
9947
- DNSResolverMessage::DNSSECQuery(onion_message.clone()),
9948
- MessageSendInstructions::WithSpecifiedReplyPath {
9949
- destination: destination.clone(),
9950
- reply_path: reply_path.clone(),
9951
- },
9952
- ));
9953
- }
9954
- Ok(())
9955
- }
9956
-
9957
9921
/// Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
9958
9922
/// stored external to LDK.
9959
9923
///
0 commit comments