@@ -9529,6 +9529,16 @@ where
9529
9529
self.pending_offers_messages.lock().expect("Mutex is locked by other thread.")
9530
9530
}
9531
9531
9532
+ #[cfg(feature = "dnssec")]
9533
+ fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>> {
9534
+ self.pending_dns_onion_messages.lock().expect("Mutex is locked by other thread.")
9535
+ }
9536
+
9537
+ #[cfg(feature = "dnssec")]
9538
+ fn get_hrn_resolver(&self) -> &OMNameResolver {
9539
+ &self.hrn_resolver
9540
+ }
9541
+
9532
9542
fn sign_bolt12_invoice(
9533
9543
&self, invoice: &UnsignedBolt12Invoice,
9534
9544
) -> Result<schnorr::Signature, ()> {
@@ -9683,6 +9693,14 @@ where
9683
9693
)
9684
9694
}
9685
9695
9696
+ #[cfg(feature = "dnssec")]
9697
+ fn add_new_awaiting_offer(
9698
+ &self, payment_id: PaymentId, expiration: StaleExpiration, retry_strategy: Retry,
9699
+ max_total_routing_fee_msat: Option<u64>, amount_msats: u64,
9700
+ ) -> Result<(), ()> {
9701
+ self.pending_outbound_payments.add_new_awaiting_offer(payment_id, expiration, retry_strategy, max_total_routing_fee_msat, amount_msats)
9702
+ }
9703
+
9686
9704
fn pay_for_offer_intern<CPP: FnOnce(&InvoiceRequest, Nonce) -> Result<(), Bolt12SemanticError>>(
9687
9705
&self, offer: &Offer, quantity: Option<u64>, amount_msats: Option<u64>,
9688
9706
payer_note: Option<String>, payment_id: PaymentId,
@@ -9750,73 +9768,6 @@ where
9750
9768
MR::Target: MessageRouter,
9751
9769
L::Target: Logger,
9752
9770
{
9753
- /// Pays for an [`Offer`] looked up using [BIP 353] Human Readable Names resolved by the DNS
9754
- /// resolver(s) at `dns_resolvers` which resolve names according to bLIP 32.
9755
- ///
9756
- /// If the wallet supports paying on-chain schemes, you should instead use
9757
- /// [`OMNameResolver::resolve_name`] and [`OMNameResolver::handle_dnssec_proof_for_uri`] (by
9758
- /// implementing [`DNSResolverMessageHandler`]) directly to look up a URI and then delegate to
9759
- /// your normal URI handling.
9760
- ///
9761
- /// If `max_total_routing_fee_msat` is not specified, the default from
9762
- /// [`RouteParameters::from_payment_params_and_value`] is applied.
9763
- ///
9764
- /// # Payment
9765
- ///
9766
- /// The provided `payment_id` is used to ensure that only one invoice is paid for the request
9767
- /// when received. See [Avoiding Duplicate Payments] for other requirements once the payment has
9768
- /// been sent.
9769
- ///
9770
- /// To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the
9771
- /// invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the
9772
- /// payment will fail with an [`Event::InvoiceRequestFailed`].
9773
- ///
9774
- /// # Privacy
9775
- ///
9776
- /// For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`]
9777
- /// to construct a [`BlindedPath`] for the reply path. For further privacy implications, see the
9778
- /// docs of the parameterized [`Router`], which implements [`MessageRouter`].
9779
- ///
9780
- /// # Limitations
9781
- ///
9782
- /// Requires a direct connection to the given [`Destination`] as well as an introduction node in
9783
- /// [`Offer::paths`] or to [`Offer::signing_pubkey`], if empty. A similar restriction applies to
9784
- /// the responding [`Bolt12Invoice::payment_paths`].
9785
- ///
9786
- /// # Errors
9787
- ///
9788
- /// Errors if:
9789
- /// - a duplicate `payment_id` is provided given the caveats in the aforementioned link,
9790
- ///
9791
- /// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths
9792
- /// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments
9793
- #[cfg(feature = "dnssec")]
9794
- pub fn pay_for_offer_from_human_readable_name(
9795
- &self, name: HumanReadableName, amount_msats: u64, payment_id: PaymentId,
9796
- retry_strategy: Retry, max_total_routing_fee_msat: Option<u64>,
9797
- dns_resolvers: Vec<Destination>,
9798
- ) -> Result<(), ()> {
9799
- let (onion_message, context) =
9800
- self.hrn_resolver.resolve_name(payment_id, name, &*self.entropy_source)?;
9801
- let reply_paths = self.create_blinded_paths(MessageContext::DNSResolver(context))?;
9802
- let expiration = StaleExpiration::TimerTicks(1);
9803
- self.pending_outbound_payments.add_new_awaiting_offer(payment_id, expiration, retry_strategy, max_total_routing_fee_msat, amount_msats)?;
9804
- let message_params = dns_resolvers
9805
- .iter()
9806
- .flat_map(|destination| reply_paths.iter().map(move |path| (path, destination)))
9807
- .take(OFFERS_MESSAGE_REQUEST_LIMIT);
9808
- for (reply_path, destination) in message_params {
9809
- self.pending_dns_onion_messages.lock().unwrap().push((
9810
- DNSResolverMessage::DNSSECQuery(onion_message.clone()),
9811
- MessageSendInstructions::WithSpecifiedReplyPath {
9812
- destination: destination.clone(),
9813
- reply_path: reply_path.clone(),
9814
- },
9815
- ));
9816
- }
9817
- Ok(())
9818
- }
9819
-
9820
9771
/// Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
9821
9772
/// stored external to LDK.
9822
9773
///
0 commit comments