@@ -9585,6 +9585,16 @@ where
9585
9585
self.pending_offers_messages.lock().expect("Mutex is locked by other thread.")
9586
9586
}
9587
9587
9588
+ #[cfg(feature = "dnssec")]
9589
+ fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>> {
9590
+ self.pending_dns_onion_messages.lock().expect("Mutex is locked by other thread.")
9591
+ }
9592
+
9593
+ #[cfg(feature = "dnssec")]
9594
+ fn get_hrn_resolver(&self) -> &OMNameResolver {
9595
+ &self.hrn_resolver
9596
+ }
9597
+
9588
9598
fn sign_bolt12_invoice(
9589
9599
&self, invoice: &UnsignedBolt12Invoice,
9590
9600
) -> Result<schnorr::Signature, ()> {
@@ -9807,6 +9817,14 @@ where
9807
9817
)
9808
9818
}
9809
9819
9820
+ #[cfg(feature = "dnssec")]
9821
+ fn add_new_awaiting_offer(
9822
+ &self, payment_id: PaymentId, expiration: StaleExpiration, retry_strategy: Retry,
9823
+ max_total_routing_fee_msat: Option<u64>, amount_msats: u64,
9824
+ ) -> Result<(), ()> {
9825
+ self.pending_outbound_payments.add_new_awaiting_offer(payment_id, expiration, retry_strategy, max_total_routing_fee_msat, amount_msats)
9826
+ }
9827
+
9810
9828
fn pay_for_offer_intern<CPP: FnOnce(&InvoiceRequest, Nonce) -> Result<(), Bolt12SemanticError>>(
9811
9829
&self, offer: &Offer, quantity: Option<u64>, amount_msats: Option<u64>,
9812
9830
payer_note: Option<String>, payment_id: PaymentId,
@@ -9874,73 +9892,6 @@ where
9874
9892
MR::Target: MessageRouter,
9875
9893
L::Target: Logger,
9876
9894
{
9877
- /// Pays for an [`Offer`] looked up using [BIP 353] Human Readable Names resolved by the DNS
9878
- /// resolver(s) at `dns_resolvers` which resolve names according to bLIP 32.
9879
- ///
9880
- /// If the wallet supports paying on-chain schemes, you should instead use
9881
- /// [`OMNameResolver::resolve_name`] and [`OMNameResolver::handle_dnssec_proof_for_uri`] (by
9882
- /// implementing [`DNSResolverMessageHandler`]) directly to look up a URI and then delegate to
9883
- /// your normal URI handling.
9884
- ///
9885
- /// If `max_total_routing_fee_msat` is not specified, the default from
9886
- /// [`RouteParameters::from_payment_params_and_value`] is applied.
9887
- ///
9888
- /// # Payment
9889
- ///
9890
- /// The provided `payment_id` is used to ensure that only one invoice is paid for the request
9891
- /// when received. See [Avoiding Duplicate Payments] for other requirements once the payment has
9892
- /// been sent.
9893
- ///
9894
- /// To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the
9895
- /// invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the
9896
- /// payment will fail with an [`Event::InvoiceRequestFailed`].
9897
- ///
9898
- /// # Privacy
9899
- ///
9900
- /// For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`]
9901
- /// to construct a [`BlindedPath`] for the reply path. For further privacy implications, see the
9902
- /// docs of the parameterized [`Router`], which implements [`MessageRouter`].
9903
- ///
9904
- /// # Limitations
9905
- ///
9906
- /// Requires a direct connection to the given [`Destination`] as well as an introduction node in
9907
- /// [`Offer::paths`] or to [`Offer::signing_pubkey`], if empty. A similar restriction applies to
9908
- /// the responding [`Bolt12Invoice::payment_paths`].
9909
- ///
9910
- /// # Errors
9911
- ///
9912
- /// Errors if:
9913
- /// - a duplicate `payment_id` is provided given the caveats in the aforementioned link,
9914
- ///
9915
- /// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths
9916
- /// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments
9917
- #[cfg(feature = "dnssec")]
9918
- pub fn pay_for_offer_from_human_readable_name(
9919
- &self, name: HumanReadableName, amount_msats: u64, payment_id: PaymentId,
9920
- retry_strategy: Retry, max_total_routing_fee_msat: Option<u64>,
9921
- dns_resolvers: Vec<Destination>,
9922
- ) -> Result<(), ()> {
9923
- let (onion_message, context) =
9924
- self.hrn_resolver.resolve_name(payment_id, name, &*self.entropy_source)?;
9925
- let reply_paths = self.create_blinded_paths(MessageContext::DNSResolver(context))?;
9926
- let expiration = StaleExpiration::TimerTicks(1);
9927
- self.pending_outbound_payments.add_new_awaiting_offer(payment_id, expiration, retry_strategy, max_total_routing_fee_msat, amount_msats)?;
9928
- let message_params = dns_resolvers
9929
- .iter()
9930
- .flat_map(|destination| reply_paths.iter().map(move |path| (path, destination)))
9931
- .take(OFFERS_MESSAGE_REQUEST_LIMIT);
9932
- for (reply_path, destination) in message_params {
9933
- self.pending_dns_onion_messages.lock().unwrap().push((
9934
- DNSResolverMessage::DNSSECQuery(onion_message.clone()),
9935
- MessageSendInstructions::WithSpecifiedReplyPath {
9936
- destination: destination.clone(),
9937
- reply_path: reply_path.clone(),
9938
- },
9939
- ));
9940
- }
9941
- Ok(())
9942
- }
9943
-
9944
9895
/// Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
9945
9896
/// stored external to LDK.
9946
9897
///
0 commit comments