-pub(super) fn create<Signer: Sign, K: Deref>(keys: &ExpandedKey, min_value_msat: Option<u64>, invoice_expiry_delta_secs: u32, keys_manager: &K, highest_seen_timestamp: u64) -> Result<(PaymentHash, PaymentSecret), ()>
- where K::Target: KeysInterface<Signer = Signer>
+fn min_final_cltv_expiry_delta_from_metadata(bytes: [u8; METADATA_LEN]) -> u16 {
+ let expiry_bytes = &bytes[AMT_MSAT_LEN..];
+ u16::from_be_bytes([expiry_bytes[0], expiry_bytes[1]])
+}
+
+/// Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
+/// `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
+/// a `ChannelManager`.
+///
+/// `keys` is generated by calling [`NodeSigner::get_inbound_payment_key_material`] and then
+/// calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
+/// regenerate it for each new inbound payment.
+///
+/// `current_time` is a Unix timestamp representing the current time.
+///
+/// Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
+/// on versions of LDK prior to 0.0.114.
+///
+/// [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
+/// [`NodeSigner::get_inbound_payment_key_material`]: crate::chain::keysinterface::NodeSigner::get_inbound_payment_key_material
+pub fn create<ES: Deref>(keys: &ExpandedKey, min_value_msat: Option<u64>,
+ invoice_expiry_delta_secs: u32, entropy_source: &ES, current_time: u64,
+ min_final_cltv_expiry_delta: Option<u16>) -> Result<(PaymentHash, PaymentSecret), ()>
+ where ES::Target: EntropySource