Skip to content

Commit 1e91b4b

Browse files
committed
Drop deprecated methods in invoice_utils
These methods are super trivial to replace with the `ChannelManager` equivalent, so keeping them around for a while doesn't give us anything.
1 parent 8d44e80 commit 1e91b4b

File tree

1 file changed

+3
-158
lines changed

1 file changed

+3
-158
lines changed

lightning/src/ln/invoice_utils.rs

Lines changed: 3 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@ use lightning_invoice::{Description, Bolt11InvoiceDescription, Sha256};
66
use crate::prelude::*;
77

88
use bitcoin::hashes::Hash;
9-
use crate::chain;
10-
use crate::chain::chaininterface::{BroadcasterInterface, FeeEstimator};
11-
use crate::sign::{Recipient, NodeSigner, SignerProvider, EntropySource};
9+
use crate::sign::{Recipient, NodeSigner, EntropySource};
1210
use crate::types::payment::PaymentHash;
1311
use crate::ln::channel_state::ChannelDetails;
14-
use crate::ln::channelmanager::{Bolt11InvoiceParameters, ChannelManager, PhantomRouteHints, MIN_CLTV_EXPIRY_DELTA, MIN_FINAL_CLTV_EXPIRY_DELTA};
12+
use crate::ln::channelmanager::{PhantomRouteHints, MIN_CLTV_EXPIRY_DELTA, MIN_FINAL_CLTV_EXPIRY_DELTA};
1513
use crate::ln::inbound_payment::{create, create_from_hash};
1614
use crate::routing::gossip::RoutingFees;
17-
use crate::routing::router::{RouteHint, RouteHintHop, Router};
18-
use crate::onion_message::messenger::MessageRouter;
15+
use crate::routing::router::{RouteHint, RouteHintHop};
1916
use crate::util::logger::{Logger, Record};
2017
use bitcoin::secp256k1::PublicKey;
2118
use alloc::collections::{btree_map, BTreeMap};
@@ -312,158 +309,6 @@ fn rotate_through_iterators<T, I: Iterator<Item = T>>(mut vecs: Vec<I>) -> impl
312309
})
313310
}
314311

315-
#[deprecated(note = "Use ChannelManager::create_bolt11_invoice instead.")]
316-
/// Utility to construct an invoice. Generally, unless you want to do something like a custom
317-
/// cltv_expiry, this is what you should be using to create an invoice. The reason being, this
318-
/// method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
319-
/// doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
320-
/// that the payment secret is valid when the invoice is paid.
321-
///
322-
/// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
323-
/// in excess of the current time.
324-
///
325-
/// You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
326-
/// [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
327-
/// Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
328-
/// confirmations during routing.
329-
///
330-
/// [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
331-
pub fn create_invoice_from_channelmanager<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref>(
332-
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, MR, L>, amt_msat: Option<u64>,
333-
description: String, invoice_expiry_delta_secs: u32, min_final_cltv_expiry_delta: Option<u16>,
334-
) -> Result<Bolt11Invoice, SignOrCreationError<()>>
335-
where
336-
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
337-
T::Target: BroadcasterInterface,
338-
ES::Target: EntropySource,
339-
NS::Target: NodeSigner,
340-
SP::Target: SignerProvider,
341-
F::Target: FeeEstimator,
342-
R::Target: Router,
343-
MR::Target: MessageRouter,
344-
L::Target: Logger,
345-
{
346-
let description = Description::new(description).map_err(SignOrCreationError::CreationError)?;
347-
let params = Bolt11InvoiceParameters {
348-
amount_msats: amt_msat,
349-
description: Bolt11InvoiceDescription::Direct(description),
350-
invoice_expiry_delta_secs: Some(invoice_expiry_delta_secs),
351-
min_final_cltv_expiry_delta,
352-
payment_hash: None,
353-
};
354-
channelmanager.create_bolt11_invoice(params)
355-
}
356-
357-
#[deprecated(note = "Use ChannelManager::create_bolt11_invoice instead.")]
358-
/// Utility to construct an invoice. Generally, unless you want to do something like a custom
359-
/// cltv_expiry, this is what you should be using to create an invoice. The reason being, this
360-
/// method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
361-
/// doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
362-
/// that the payment secret is valid when the invoice is paid.
363-
/// Use this variant if you want to pass the `description_hash` to the invoice.
364-
///
365-
/// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
366-
/// in excess of the current time.
367-
///
368-
/// You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
369-
/// [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
370-
/// Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
371-
/// confirmations during routing.
372-
///
373-
/// [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
374-
pub fn create_invoice_from_channelmanager_with_description_hash<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref>(
375-
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, MR, L>, amt_msat: Option<u64>,
376-
description_hash: Sha256, invoice_expiry_delta_secs: u32,
377-
min_final_cltv_expiry_delta: Option<u16>,
378-
) -> Result<Bolt11Invoice, SignOrCreationError<()>>
379-
where
380-
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
381-
T::Target: BroadcasterInterface,
382-
ES::Target: EntropySource,
383-
NS::Target: NodeSigner,
384-
SP::Target: SignerProvider,
385-
F::Target: FeeEstimator,
386-
R::Target: Router,
387-
MR::Target: MessageRouter,
388-
L::Target: Logger,
389-
{
390-
let params = Bolt11InvoiceParameters {
391-
amount_msats: amt_msat,
392-
description: Bolt11InvoiceDescription::Hash(description_hash),
393-
invoice_expiry_delta_secs: Some(invoice_expiry_delta_secs),
394-
min_final_cltv_expiry_delta,
395-
payment_hash: None,
396-
};
397-
channelmanager.create_bolt11_invoice(params)
398-
}
399-
400-
#[deprecated(note = "Use ChannelManager::create_bolt11_invoice instead.")]
401-
/// See [`create_invoice_from_channelmanager`].
402-
///
403-
/// This version allows for providing custom [`PaymentHash`] and description hash for the invoice.
404-
///
405-
/// This may be useful if you're building an on-chain swap or involving another protocol where
406-
/// the payment hash is also involved outside the scope of lightning and want to set the
407-
/// description hash.
408-
pub fn create_invoice_from_channelmanager_with_description_hash_and_payment_hash<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref>(
409-
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, MR, L>, amt_msat: Option<u64>,
410-
description_hash: Sha256, invoice_expiry_delta_secs: u32, payment_hash: PaymentHash,
411-
min_final_cltv_expiry_delta: Option<u16>,
412-
) -> Result<Bolt11Invoice, SignOrCreationError<()>>
413-
where
414-
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
415-
T::Target: BroadcasterInterface,
416-
ES::Target: EntropySource,
417-
NS::Target: NodeSigner,
418-
SP::Target: SignerProvider,
419-
F::Target: FeeEstimator,
420-
R::Target: Router,
421-
MR::Target: MessageRouter,
422-
L::Target: Logger,
423-
{
424-
let params = Bolt11InvoiceParameters {
425-
amount_msats: amt_msat,
426-
description: Bolt11InvoiceDescription::Hash(description_hash),
427-
invoice_expiry_delta_secs: Some(invoice_expiry_delta_secs),
428-
min_final_cltv_expiry_delta,
429-
payment_hash: Some(payment_hash),
430-
};
431-
channelmanager.create_bolt11_invoice(params)
432-
}
433-
434-
#[deprecated(note = "Use ChannelManager::create_bolt11_invoice instead.")]
435-
/// See [`create_invoice_from_channelmanager`].
436-
///
437-
/// This version allows for providing a custom [`PaymentHash`] for the invoice.
438-
/// This may be useful if you're building an on-chain swap or involving another protocol where
439-
/// the payment hash is also involved outside the scope of lightning.
440-
pub fn create_invoice_from_channelmanager_with_payment_hash<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref>(
441-
channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, MR, L>, amt_msat: Option<u64>,
442-
description: String, invoice_expiry_delta_secs: u32, payment_hash: PaymentHash,
443-
min_final_cltv_expiry_delta: Option<u16>,
444-
) -> Result<Bolt11Invoice, SignOrCreationError<()>>
445-
where
446-
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,
447-
T::Target: BroadcasterInterface,
448-
ES::Target: EntropySource,
449-
NS::Target: NodeSigner,
450-
SP::Target: SignerProvider,
451-
F::Target: FeeEstimator,
452-
R::Target: Router,
453-
MR::Target: MessageRouter,
454-
L::Target: Logger,
455-
{
456-
let description = Description::new(description).map_err(SignOrCreationError::CreationError)?;
457-
let params = Bolt11InvoiceParameters {
458-
amount_msats: amt_msat,
459-
description: Bolt11InvoiceDescription::Direct(description),
460-
invoice_expiry_delta_secs: Some(invoice_expiry_delta_secs),
461-
min_final_cltv_expiry_delta,
462-
payment_hash: Some(payment_hash),
463-
};
464-
channelmanager.create_bolt11_invoice(params)
465-
}
466-
467312
/// Sorts and filters the `channels` for an invoice, and returns the corresponding `RouteHint`s to include
468313
/// in the invoice.
469314
///

0 commit comments

Comments
 (0)