X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Fln%2Fchan_utils.rs;h=69cf18ce9e88c775d035a1c745c398f9d3d8f115;hb=05fd5718232e2aa9581a51cdace2c0642ea533a5;hp=f2a2a5abf5a8228ba36967d73b1e8c5ed0fd01da;hpb=a132c4d7f8648278537854ae08a83d704853ed42;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/ln/chan_utils.rs b/lightning-c-bindings/src/ln/chan_utils.rs index f2a2a5a..69cf18c 100644 --- a/lightning-c-bindings/src/ln/chan_utils.rs +++ b/lightning-c-bindings/src/ln/chan_utils.rs @@ -1,3 +1,11 @@ +// This file is Copyright its original authors, visible in version control +// history and in the source files from which this was generated. +// +// This file is licensed under the license available in the LICENSE or LICENSE.md +// file in the root of this repository or, if no such file exists, the same +// license as that which applies to the original source files from which this +// source was automatically generated. + //! Various utilities for building scripts and deriving keys related to channels. These are //! largely of interest for those implementing chain::keysinterface::Sign message signing by hand. @@ -527,6 +535,36 @@ pub extern "C" fn HTLCOutputInCommitment_get_payment_hash(this_ptr: &HTLCOutputI pub extern "C" fn HTLCOutputInCommitment_set_payment_hash(this_ptr: &mut HTLCOutputInCommitment, mut val: crate::c_types::ThirtyTwoBytes) { unsafe { &mut *this_ptr.inner }.payment_hash = ::lightning::ln::channelmanager::PaymentHash(val.data); } +/// The position within the commitment transactions' outputs. This may be None if the value is +/// below the dust limit (in which case no output appears in the commitment transaction and the +/// value is spent to additional transaction fees). +#[no_mangle] +pub extern "C" fn HTLCOutputInCommitment_get_transaction_output_index(this_ptr: &HTLCOutputInCommitment) -> crate::c_types::derived::COption_u32Z { + let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.transaction_output_index; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { { crate::c_types::derived::COption_u32Z::Some(inner_val.unwrap()) } }; + local_inner_val +} +/// The position within the commitment transactions' outputs. This may be None if the value is +/// below the dust limit (in which case no output appears in the commitment transaction and the +/// value is spent to additional transaction fees). +#[no_mangle] +pub extern "C" fn HTLCOutputInCommitment_set_transaction_output_index(this_ptr: &mut HTLCOutputInCommitment, mut val: crate::c_types::derived::COption_u32Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *this_ptr.inner }.transaction_output_index = local_val; +} +/// Constructs a new HTLCOutputInCommitment given each field +#[must_use] +#[no_mangle] +pub extern "C" fn HTLCOutputInCommitment_new(mut offered_arg: bool, mut amount_msat_arg: u64, mut cltv_expiry_arg: u32, mut payment_hash_arg: crate::c_types::ThirtyTwoBytes, mut transaction_output_index_arg: crate::c_types::derived::COption_u32Z) -> HTLCOutputInCommitment { + let mut local_transaction_output_index_arg = if transaction_output_index_arg.is_some() { Some( { transaction_output_index_arg.take() }) } else { None }; + HTLCOutputInCommitment { inner: Box::into_raw(Box::new(nativeHTLCOutputInCommitment { + offered: offered_arg, + amount_msat: amount_msat_arg, + cltv_expiry: cltv_expiry_arg, + payment_hash: ::lightning::ln::channelmanager::PaymentHash(payment_hash_arg.data), + transaction_output_index: local_transaction_output_index_arg, + })), is_owned: true } +} impl Clone for HTLCOutputInCommitment { fn clone(&self) -> Self { Self {