channel_value_satoshis: u64,
/// The script which should be used in the transaction output.
output_script: crate::c_types::derived::CVec_u8Z,
channel_value_satoshis: u64,
/// The script which should be used in the transaction output.
output_script: crate::c_types::derived::CVec_u8Z,
- /// The value passed in to ChannelManager::create_channel
+ /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
+ /// an inbound channel.
+ ///
+ /// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
- /// ChannelManager::claim_funds to get it....
- /// Note that if the preimage is not known or the amount paid is incorrect, you should call
- /// ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
+ /// [`ChannelManager::claim_funds`] to get it....
+ /// Note that if the preimage is not known, you should call
+ /// [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
- /// The amount paid should be considered 'incorrect' when it is less than or more than twice
- /// the amount expected.
- /// If you fail to call either ChannelManager::claim_funds or
- /// ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
+ /// If you fail to call either [`ChannelManager::claim_funds`] or
+ /// [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
PaymentReceived {
/// The hash for which the preimage should be handed to the ChannelManager.
payment_hash: crate::c_types::ThirtyTwoBytes,
PaymentReceived {
/// The hash for which the preimage should be handed to the ChannelManager.
payment_hash: crate::c_types::ThirtyTwoBytes,
- /// The value, in thousandths of a satoshi, that this payment is for. Note that you must
- /// compare this to the expected value before accepting the payment (as otherwise you are
- /// providing proof-of-payment for less than the value you expected!).
+ /// The value, in thousandths of a satoshi, that this payment is for.
amt: u64,
/// Information for claiming this received payment, based on whether the purpose of the
/// payment is to pay an invoice or to send a spontaneous payment.
amt: u64,
/// Information for claiming this received payment, based on whether the purpose of the
/// payment is to pay an invoice or to send a spontaneous payment.
/// Note that this serves as a payment receipt, if you wish to have such a thing, you must
/// store it somehow!
payment_preimage: crate::c_types::ThirtyTwoBytes,
/// Note that this serves as a payment receipt, if you wish to have such a thing, you must
/// store it somehow!
payment_preimage: crate::c_types::ThirtyTwoBytes,
},
/// Indicates an outbound payment we made failed. Probably some intermediary node dropped
/// something. You may wish to retry with a different route.
},
/// Indicates an outbound payment we made failed. Probably some intermediary node dropped
/// something. You may wish to retry with a different route.
all_paths_failed: bool,
/// The payment path that failed.
path: crate::c_types::derived::CVec_RouteHopZ,
all_paths_failed: bool,
/// The payment path that failed.
path: crate::c_types::derived::CVec_RouteHopZ,
+ /// The channel responsible for the failed payment path.
+ ///
+ /// If this is `Some`, then the corresponding channel should be avoided when the payment is
+ /// retried. May be `None` for older [`Event`] serializations.
+ short_channel_id: crate::c_types::derived::COption_u64Z,
/// The channel_id of the channel which has been closed. Note that on-chain transactions
/// resolving the channel are likely still awaiting confirmation.
channel_id: crate::c_types::ThirtyTwoBytes,
/// The channel_id of the channel which has been closed. Note that on-chain transactions
/// resolving the channel are likely still awaiting confirmation.
channel_id: crate::c_types::ThirtyTwoBytes,
/// The reason the channel was closed.
reason: crate::lightning::util::events::ClosureReason,
},
/// The reason the channel was closed.
reason: crate::lightning::util::events::ClosureReason,
},
+ /// Used to indicate to the user that they can abandon the funding transaction and recycle the
+ /// inputs for another purpose.
+ DiscardFunding {
+ /// The channel_id of the channel which has been closed.
+ channel_id: crate::c_types::ThirtyTwoBytes,
+ /// The full transaction received from the user
+ transaction: crate::c_types::Transaction,
+ },
nativeEvent::PaymentSent {
payment_preimage: ::lightning::ln::PaymentPreimage(payment_preimage_nonref.data),
nativeEvent::PaymentSent {
payment_preimage: ::lightning::ln::PaymentPreimage(payment_preimage_nonref.data),
- Event::PaymentPathFailed {ref payment_hash, ref rejected_by_dest, ref network_update, ref all_paths_failed, ref path, } => {
+ Event::PaymentPathFailed {ref payment_hash, ref rejected_by_dest, ref network_update, ref all_paths_failed, ref path, ref short_channel_id, } => {
let mut payment_hash_nonref = (*payment_hash).clone();
let mut rejected_by_dest_nonref = (*rejected_by_dest).clone();
let mut network_update_nonref = (*network_update).clone();
let mut payment_hash_nonref = (*payment_hash).clone();
let mut rejected_by_dest_nonref = (*rejected_by_dest).clone();
let mut network_update_nonref = (*network_update).clone();
let mut all_paths_failed_nonref = (*all_paths_failed).clone();
let mut path_nonref = (*path).clone();
let mut local_path_nonref = Vec::new(); for mut item in path_nonref.into_rust().drain(..) { local_path_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
let mut all_paths_failed_nonref = (*all_paths_failed).clone();
let mut path_nonref = (*path).clone();
let mut local_path_nonref = Vec::new(); for mut item in path_nonref.into_rust().drain(..) { local_path_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
nativeEvent::PaymentPathFailed {
payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data),
rejected_by_dest: rejected_by_dest_nonref,
network_update: local_network_update_nonref,
all_paths_failed: all_paths_failed_nonref,
path: local_path_nonref,
nativeEvent::PaymentPathFailed {
payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data),
rejected_by_dest: rejected_by_dest_nonref,
network_update: local_network_update_nonref,
all_paths_failed: all_paths_failed_nonref,
path: local_path_nonref,
- Event::ChannelClosed {ref channel_id, ref reason, } => {
+ Event::ChannelClosed {ref channel_id, ref user_channel_id, ref reason, } => {
let mut reason_nonref = (*reason).clone();
nativeEvent::ChannelClosed {
channel_id: channel_id_nonref.data,
let mut reason_nonref = (*reason).clone();
nativeEvent::ChannelClosed {
channel_id: channel_id_nonref.data,
+ Event::DiscardFunding {ref channel_id, ref transaction, } => {
+ let mut channel_id_nonref = (*channel_id).clone();
+ let mut transaction_nonref = (*transaction).clone();
+ nativeEvent::DiscardFunding {
+ channel_id: channel_id_nonref.data,
+ transaction: transaction_nonref.into_bitcoin(),
+ }
+ },
nativeEvent::PaymentSent {
payment_preimage: ::lightning::ln::PaymentPreimage(payment_preimage.data),
nativeEvent::PaymentSent {
payment_preimage: ::lightning::ln::PaymentPreimage(payment_preimage.data),
- Event::PaymentPathFailed {mut payment_hash, mut rejected_by_dest, mut network_update, mut all_paths_failed, mut path, } => {
+ Event::PaymentPathFailed {mut payment_hash, mut rejected_by_dest, mut network_update, mut all_paths_failed, mut path, mut short_channel_id, } => {
let mut local_network_update = { /* network_update*/ let network_update_opt = network_update; { } if network_update_opt.is_none() { None } else { Some({ network_update_opt.take().into_native() }) } };
let mut local_path = Vec::new(); for mut item in path.into_rust().drain(..) { local_path.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
let mut local_network_update = { /* network_update*/ let network_update_opt = network_update; { } if network_update_opt.is_none() { None } else { Some({ network_update_opt.take().into_native() }) } };
let mut local_path = Vec::new(); for mut item in path.into_rust().drain(..) { local_path.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
nativeEvent::PaymentPathFailed {
payment_hash: ::lightning::ln::PaymentHash(payment_hash.data),
rejected_by_dest: rejected_by_dest,
network_update: local_network_update,
all_paths_failed: all_paths_failed,
path: local_path,
nativeEvent::PaymentPathFailed {
payment_hash: ::lightning::ln::PaymentHash(payment_hash.data),
rejected_by_dest: rejected_by_dest,
network_update: local_network_update,
all_paths_failed: all_paths_failed,
path: local_path,
- Event::ChannelClosed {mut channel_id, mut reason, } => {
+ Event::ChannelClosed {mut channel_id, mut user_channel_id, mut reason, } => {
nativeEvent::ChannelClosed {
channel_id: channel_id.data,
nativeEvent::ChannelClosed {
channel_id: channel_id.data,
+ Event::DiscardFunding {mut channel_id, mut transaction, } => {
+ nativeEvent::DiscardFunding {
+ channel_id: channel_id.data,
+ transaction: transaction.into_bitcoin(),
+ }
+ },
- nativeEvent::PaymentPathFailed {ref payment_hash, ref rejected_by_dest, ref network_update, ref all_paths_failed, ref path, } => {
+ nativeEvent::PaymentPathFailed {ref payment_hash, ref rejected_by_dest, ref network_update, ref all_paths_failed, ref path, ref short_channel_id, } => {
let mut payment_hash_nonref = (*payment_hash).clone();
let mut rejected_by_dest_nonref = (*rejected_by_dest).clone();
let mut network_update_nonref = (*network_update).clone();
let mut payment_hash_nonref = (*payment_hash).clone();
let mut rejected_by_dest_nonref = (*rejected_by_dest).clone();
let mut network_update_nonref = (*network_update).clone();
let mut all_paths_failed_nonref = (*all_paths_failed).clone();
let mut path_nonref = (*path).clone();
let mut local_path_nonref = Vec::new(); for mut item in path_nonref.drain(..) { local_path_nonref.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
let mut all_paths_failed_nonref = (*all_paths_failed).clone();
let mut path_nonref = (*path).clone();
let mut local_path_nonref = Vec::new(); for mut item in path_nonref.drain(..) { local_path_nonref.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
Event::PaymentPathFailed {
payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 },
rejected_by_dest: rejected_by_dest_nonref,
network_update: local_network_update_nonref,
all_paths_failed: all_paths_failed_nonref,
path: local_path_nonref.into(),
Event::PaymentPathFailed {
payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 },
rejected_by_dest: rejected_by_dest_nonref,
network_update: local_network_update_nonref,
all_paths_failed: all_paths_failed_nonref,
path: local_path_nonref.into(),
- nativeEvent::ChannelClosed {ref channel_id, ref reason, } => {
+ nativeEvent::ChannelClosed {ref channel_id, ref user_channel_id, ref reason, } => {
let mut reason_nonref = (*reason).clone();
Event::ChannelClosed {
channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref },
let mut reason_nonref = (*reason).clone();
Event::ChannelClosed {
channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref },
+ nativeEvent::DiscardFunding {ref channel_id, ref transaction, } => {
+ let mut channel_id_nonref = (*channel_id).clone();
+ let mut transaction_nonref = (*transaction).clone();
+ Event::DiscardFunding {
+ channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref },
+ transaction: crate::c_types::Transaction::from_bitcoin(&transaction_nonref),
+ }
+ },
- nativeEvent::PaymentPathFailed {mut payment_hash, mut rejected_by_dest, mut network_update, mut all_paths_failed, mut path, } => {
+ nativeEvent::PaymentPathFailed {mut payment_hash, mut rejected_by_dest, mut network_update, mut all_paths_failed, mut path, mut short_channel_id, } => {
let mut local_network_update = if network_update.is_none() { crate::c_types::derived::COption_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::network_graph::NetworkUpdate::native_into(network_update.unwrap()) }) };
let mut local_path = Vec::new(); for mut item in path.drain(..) { local_path.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
let mut local_network_update = if network_update.is_none() { crate::c_types::derived::COption_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::network_graph::NetworkUpdate::native_into(network_update.unwrap()) }) };
let mut local_path = Vec::new(); for mut item in path.drain(..) { local_path.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
Event::PaymentPathFailed {
payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 },
rejected_by_dest: rejected_by_dest,
network_update: local_network_update,
all_paths_failed: all_paths_failed,
path: local_path.into(),
Event::PaymentPathFailed {
payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 },
rejected_by_dest: rejected_by_dest,
network_update: local_network_update,
all_paths_failed: all_paths_failed,
path: local_path.into(),
- nativeEvent::ChannelClosed {mut channel_id, mut reason, } => {
+ nativeEvent::ChannelClosed {mut channel_id, mut user_channel_id, mut reason, } => {
+ nativeEvent::DiscardFunding {mut channel_id, mut transaction, } => {
+ Event::DiscardFunding {
+ channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id },
+ transaction: crate::c_types::Transaction::from_bitcoin(&transaction),
+ }
+ },
-pub extern "C" fn Event_payment_path_failed(payment_hash: crate::c_types::ThirtyTwoBytes, rejected_by_dest: bool, network_update: crate::c_types::derived::COption_NetworkUpdateZ, all_paths_failed: bool, path: crate::c_types::derived::CVec_RouteHopZ) -> Event {
+pub extern "C" fn Event_payment_path_failed(payment_hash: crate::c_types::ThirtyTwoBytes, rejected_by_dest: bool, network_update: crate::c_types::derived::COption_NetworkUpdateZ, all_paths_failed: bool, path: crate::c_types::derived::CVec_RouteHopZ, short_channel_id: crate::c_types::derived::COption_u64Z) -> Event {
-pub extern "C" fn Event_channel_closed(channel_id: crate::c_types::ThirtyTwoBytes, reason: crate::lightning::util::events::ClosureReason) -> Event {
+pub extern "C" fn Event_channel_closed(channel_id: crate::c_types::ThirtyTwoBytes, user_channel_id: u64, reason: crate::lightning::util::events::ClosureReason) -> Event {
/// Serialize the Event object into a byte array which can be read by Event_read
pub extern "C" fn Event_write(obj: &Event) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
/// Serialize the Event object into a byte array which can be read by Event_read
pub extern "C" fn Event_write(obj: &Event) -> crate::c_types::derived::CVec_u8Z {
crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())