Skip to content

Commit cface29

Browse files
committed
Deprecate pay_for_offer_from_human_readable_name
While its cool to have a super trivial API to initiate payment to a `HumanReadableName`, most wallets ultimately support multiple payment instruction formats (eg on-chain) or multiple HRN resolution schemes (eg LN-Address). Thus, we generally don't expect this API to get a lot of use. Meanwhile, we've now ended up with both a `ChannelManager::pay_for_offer_from_hrn` and `ChannelManager::pay_for_ofer_from_human_readable_name`, which is incredibly confusing. Here, we deprecate `pay_for_offer_from_human_readable_name`, pushing folks to the `bitcoin-payment-instructions` crate instead. Because it has outbound payment states associated with it it may be some time before we can fully remove all the pieces of it, sadly.
1 parent 07bf08b commit cface29

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

lightning-dns-resolver/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ mod test {
388388
let amt = 42_000;
389389
let mut opts = OptionalOfferPaymentParams::default();
390390
opts.payer_note = payer_note.clone();
391+
#[allow(deprecated)]
391392
nodes[0]
392393
.node
393394
.pay_for_offer_from_human_readable_name(name, amt, payment_id, opts, resolvers)

lightning/src/ln/channelmanager.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12600,13 +12600,10 @@ where
1260012600
/// Pays for an [`Offer`] looked up using [BIP 353] Human Readable Names resolved by the DNS
1260112601
/// resolver(s) at `dns_resolvers` which resolve names according to [bLIP 32].
1260212602
///
12603-
/// If the wallet supports paying on-chain schemes, you should instead use
12604-
/// [`OMNameResolver::resolve_name`] and [`OMNameResolver::handle_dnssec_proof_for_uri`] (by
12605-
/// implementing [`DNSResolverMessageHandler`]) directly to look up a URI and then delegate to
12606-
/// your normal URI handling.
12607-
///
12608-
/// Alternatively, the [`bitcoin-payment-instructions`] crate provides an implementation of
12609-
/// much of this logic, and may be useful to decode and resolve payment instructions generally.
12603+
/// Because most wallets support on-chain or other payment schemes beyond only offers, this is
12604+
/// deprecated in favor of the [`bitcoin-payment-instructions`] crate, which can be used to
12605+
/// build an [`OfferFromHrn`] and call [`Self::pay_for_offer_from_hrn`]. Thus, this method is
12606+
/// deprecated.
1261012607
///
1261112608
/// # Payment
1261212609
///
@@ -12638,6 +12635,7 @@ where
1263812635
/// [`PaymentFailureReason::UserAbandoned`]: crate::events::PaymentFailureReason::UserAbandoned
1263912636
/// [`PaymentFailureReason::InvoiceRequestRejected`]: crate::events::PaymentFailureReason::InvoiceRequestRejected
1264012637
#[cfg(feature = "dnssec")]
12638+
#[deprecated(note = "Use bitcoin-payment-instructions and pay_for_offer_from_hrn instead")]
1264112639
pub fn pay_for_offer_from_human_readable_name(
1264212640
&self, name: HumanReadableName, amount_msats: u64, payment_id: PaymentId,
1264312641
optional_params: OptionalOfferPaymentParams, dns_resolvers: Vec<Destination>,

0 commit comments

Comments
 (0)