X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Fchain%2Ftransaction.rs;h=3a35c4727f937183018e304786e6cf4029c2fda4;hb=fc7df54f8dc3baf710371e2ad2beb862946d5b1c;hp=39236768def15fbc7de7dcbd2339f194764f793c;hpb=343aacc50c73e18ddb1ec52570c5050bdccd09ca;p=rust-lightning diff --git a/lightning-c-bindings/src/chain/transaction.rs b/lightning-c-bindings/src/chain/transaction.rs index 39236768..3a35c472 100644 --- a/lightning-c-bindings/src/chain/transaction.rs +++ b/lightning-c-bindings/src/chain/transaction.rs @@ -1,4 +1,4 @@ -//! Contains simple structs describing parts of transactions on the chain. +//! Types describing on-chain transactions. use std::ffi::c_void; use bitcoin::hashes::Hash; @@ -15,7 +15,7 @@ type nativeOutPoint = nativeOutPointImport; #[must_use] #[repr(C)] pub struct OutPoint { - /// Nearly everyhwere, inner must be non-null, however in places where + /// Nearly everywhere, inner must be non-null, however in places where /// the Rust equivalent takes an Option, it may be set to null to indicate None. pub inner: *mut nativeOutPoint, pub is_owned: bool, @@ -58,6 +58,10 @@ impl Clone for OutPoint { pub(crate) extern "C" fn OutPoint_clone_void(this_ptr: *const c_void) -> *mut c_void { Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOutPoint)).clone() })) as *mut c_void } +#[no_mangle] +pub extern "C" fn OutPoint_clone(orig: &OutPoint) -> OutPoint { + OutPoint { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true } +} /// The referenced transaction's txid. #[no_mangle] pub extern "C" fn OutPoint_get_txid(this_ptr: &OutPoint) -> *const [u8; 32] {