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