+/// Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
+///
+/// The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
+/// and the `counterparty_node_id` parameter is the id of the peer which has requested to open
+/// the channel.
+///
+/// The `user_channel_id` parameter will be provided back in
+/// [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
+/// with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
+///
+/// Note that this method will return an error and reject the channel, if it requires support
+/// for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
+/// used to accept such channels.
+///
+/// [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
+/// [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, mut user_channel_id: u64) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel(unsafe { &*temporary_channel_id}, &counterparty_node_id.into_rust(), user_channel_id);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
+ local_ret
+}
+
+/// Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
+/// it as confirmed immediately.
+///
+/// The `user_channel_id` parameter will be provided back in
+/// [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
+/// with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
+///
+/// Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
+/// and (if the counterparty agrees), enables forwarding of payments immediately.
+///
+/// This fully trusts that the counterparty has honestly and correctly constructed the funding
+/// transaction and blindly assumes that it will eventually confirm.
+///
+/// If it does not confirm before we decide to close the channel, or if the funding transaction
+/// does not pay to the correct script the correct amount, *you will lose funds*.
+///
+/// [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
+/// [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, mut user_channel_id: u64) -> crate::c_types::derived::CResult_NoneAPIErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel_from_trusted_peer_0conf(unsafe { &*temporary_channel_id}, &counterparty_node_id.into_rust(), user_channel_id);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
+ local_ret
+}
+
+/// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
+/// to pay us.
+///
+/// This differs from [`create_inbound_payment_for_hash`] only in that it generates the
+/// [`PaymentHash`] and [`PaymentPreimage`] for you.
+///
+/// The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
+/// will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
+/// passed directly to [`claim_funds`].
+///
+/// See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
+///
+/// Note that a malicious eavesdropper can intuit whether an inbound payment was created by
+/// `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
+///
+/// # Note
+///
+/// If you register an inbound payment with this method, then serialize the `ChannelManager`, then
+/// deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
+///
+/// Errors if `min_value_msat` is greater than total bitcoin supply.
+///
+/// [`claim_funds`]: Self::claim_funds
+/// [`PaymentReceived`]: events::Event::PaymentReceived
+/// [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
+/// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_create_inbound_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None };
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment(local_min_value_msat, invoice_expiry_delta_secs);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.0 }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+ local_ret
+}
+
+/// Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
+/// serialized state with LDK node(s) running 0.0.103 and earlier.
+///
+/// May panic if `invoice_expiry_delta_secs` is greater than one year.
+///
+/// # Note
+/// This method is deprecated and will be removed soon.
+///
+/// [`create_inbound_payment`]: Self::create_inbound_payment
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_create_inbound_payment_legacy(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None };
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment_legacy(local_min_value_msat, invoice_expiry_delta_secs);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.0 }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
+ local_ret
+}
+
+/// Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
+/// stored external to LDK.
+///
+/// A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
+/// payment secret fetched via this method or [`create_inbound_payment`], and which is at least
+/// the `min_value_msat` provided here, if one is provided.
+///
+/// The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
+/// note that LDK will not stop you from registering duplicate payment hashes for inbound
+/// payments.
+///
+/// `min_value_msat` should be set if the invoice being generated contains a value. Any payment
+/// received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
+/// before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
+/// sender \"proof-of-payment\" unless they have paid the required amount.
+///
+/// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
+/// in excess of the current time. This should roughly match the expiry time set in the invoice.
+/// After this many seconds, we will remove the inbound payment, resulting in any attempts to
+/// pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
+/// invoices when no timeout is set.
+///
+/// Note that we use block header time to time-out pending inbound payments (with some margin
+/// to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
+/// accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
+/// If you need exact expiry semantics, you should enforce them upon receipt of
+/// [`PaymentReceived`].
+///
+/// Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
+/// set to at least [`MIN_FINAL_CLTV_EXPIRY`].
+///
+/// Note that a malicious eavesdropper can intuit whether an inbound payment was created by
+/// `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
+///
+/// # Note
+///
+/// If you register an inbound payment with this method, then serialize the `ChannelManager`, then
+/// deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
+///
+/// Errors if `min_value_msat` is greater than total bitcoin supply.
+///
+/// [`create_inbound_payment`]: Self::create_inbound_payment
+/// [`PaymentReceived`]: events::Event::PaymentReceived
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_create_inbound_payment_for_hash(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_PaymentSecretNoneZ {
+ let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None };
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment_for_hash(::lightning::ln::PaymentHash(payment_hash.data), local_min_value_msat, invoice_expiry_delta_secs);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+ local_ret
+}
+
+/// Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
+/// serialized state with LDK node(s) running 0.0.103 and earlier.
+///
+/// May panic if `invoice_expiry_delta_secs` is greater than one year.
+///
+/// # Note
+/// This method is deprecated and will be removed soon.
+///
+/// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_create_inbound_payment_for_hash_legacy(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_PaymentSecretAPIErrorZ {
+ let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None };
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment_for_hash_legacy(::lightning::ln::PaymentHash(payment_hash.data), local_min_value_msat, invoice_expiry_delta_secs);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() };
+ local_ret
+}
+
+/// Gets an LDK-generated payment preimage from a payment hash and payment secret that were
+/// previously returned from [`create_inbound_payment`].