@@ -9542,6 +9542,16 @@ where
9542
9542
self.pending_offers_messages.lock().expect("Mutex is locked by other thread.")
9543
9543
}
9544
9544
9545
+ #[cfg(feature = "dnssec")]
9546
+ fn get_pending_dns_onion_messages(&self) -> MutexGuard<'_, Vec<(DNSResolverMessage, MessageSendInstructions)>> {
9547
+ self.pending_dns_onion_messages.lock().expect("Mutex is locked by other thread.")
9548
+ }
9549
+
9550
+ #[cfg(feature = "dnssec")]
9551
+ fn get_hrn_resolver(&self) -> &OMNameResolver {
9552
+ &self.hrn_resolver
9553
+ }
9554
+
9545
9555
fn sign_bolt12_invoice(
9546
9556
&self, invoice: &UnsignedBolt12Invoice,
9547
9557
) -> Result<schnorr::Signature, ()> {
@@ -9756,6 +9766,14 @@ where
9756
9766
)
9757
9767
}
9758
9768
9769
+ #[cfg(feature = "dnssec")]
9770
+ fn add_new_awaiting_offer(
9771
+ &self, payment_id: PaymentId, expiration: StaleExpiration, retry_strategy: Retry,
9772
+ max_total_routing_fee_msat: Option<u64>, amount_msats: u64,
9773
+ ) -> Result<(), ()> {
9774
+ self.pending_outbound_payments.add_new_awaiting_offer(payment_id, expiration, retry_strategy, max_total_routing_fee_msat, amount_msats)
9775
+ }
9776
+
9759
9777
fn pay_for_offer_intern<CPP: FnOnce(&InvoiceRequest, Nonce) -> Result<(), Bolt12SemanticError>>(
9760
9778
&self, offer: &Offer, quantity: Option<u64>, amount_msats: Option<u64>,
9761
9779
payer_note: Option<String>, payment_id: PaymentId,
@@ -9823,73 +9841,6 @@ where
9823
9841
MR::Target: MessageRouter,
9824
9842
L::Target: Logger,
9825
9843
{
9826
- /// Pays for an [`Offer`] looked up using [BIP 353] Human Readable Names resolved by the DNS
9827
- /// resolver(s) at `dns_resolvers` which resolve names according to bLIP 32.
9828
- ///
9829
- /// If the wallet supports paying on-chain schemes, you should instead use
9830
- /// [`OMNameResolver::resolve_name`] and [`OMNameResolver::handle_dnssec_proof_for_uri`] (by
9831
- /// implementing [`DNSResolverMessageHandler`]) directly to look up a URI and then delegate to
9832
- /// your normal URI handling.
9833
- ///
9834
- /// If `max_total_routing_fee_msat` is not specified, the default from
9835
- /// [`RouteParameters::from_payment_params_and_value`] is applied.
9836
- ///
9837
- /// # Payment
9838
- ///
9839
- /// The provided `payment_id` is used to ensure that only one invoice is paid for the request
9840
- /// when received. See [Avoiding Duplicate Payments] for other requirements once the payment has
9841
- /// been sent.
9842
- ///
9843
- /// To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the
9844
- /// invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the
9845
- /// payment will fail with an [`Event::InvoiceRequestFailed`].
9846
- ///
9847
- /// # Privacy
9848
- ///
9849
- /// For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`]
9850
- /// to construct a [`BlindedPath`] for the reply path. For further privacy implications, see the
9851
- /// docs of the parameterized [`Router`], which implements [`MessageRouter`].
9852
- ///
9853
- /// # Limitations
9854
- ///
9855
- /// Requires a direct connection to the given [`Destination`] as well as an introduction node in
9856
- /// [`Offer::paths`] or to [`Offer::signing_pubkey`], if empty. A similar restriction applies to
9857
- /// the responding [`Bolt12Invoice::payment_paths`].
9858
- ///
9859
- /// # Errors
9860
- ///
9861
- /// Errors if:
9862
- /// - a duplicate `payment_id` is provided given the caveats in the aforementioned link,
9863
- ///
9864
- /// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths
9865
- /// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments
9866
- #[cfg(feature = "dnssec")]
9867
- pub fn pay_for_offer_from_human_readable_name(
9868
- &self, name: HumanReadableName, amount_msats: u64, payment_id: PaymentId,
9869
- retry_strategy: Retry, max_total_routing_fee_msat: Option<u64>,
9870
- dns_resolvers: Vec<Destination>,
9871
- ) -> Result<(), ()> {
9872
- let (onion_message, context) =
9873
- self.hrn_resolver.resolve_name(payment_id, name, &*self.entropy_source)?;
9874
- let reply_paths = self.create_blinded_paths(MessageContext::DNSResolver(context))?;
9875
- let expiration = StaleExpiration::TimerTicks(1);
9876
- self.pending_outbound_payments.add_new_awaiting_offer(payment_id, expiration, retry_strategy, max_total_routing_fee_msat, amount_msats)?;
9877
- let message_params = dns_resolvers
9878
- .iter()
9879
- .flat_map(|destination| reply_paths.iter().map(move |path| (path, destination)))
9880
- .take(OFFERS_MESSAGE_REQUEST_LIMIT);
9881
- for (reply_path, destination) in message_params {
9882
- self.pending_dns_onion_messages.lock().unwrap().push((
9883
- DNSResolverMessage::DNSSECQuery(onion_message.clone()),
9884
- MessageSendInstructions::WithSpecifiedReplyPath {
9885
- destination: destination.clone(),
9886
- reply_path: reply_path.clone(),
9887
- },
9888
- ));
9889
- }
9890
- Ok(())
9891
- }
9892
-
9893
9844
/// Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
9894
9845
/// stored external to LDK.
9895
9846
///
0 commit comments