Merge pull request #748 from TheBlueMatt/2020-11-router-fuzzer
[rust-lightning] / lightning-c-bindings / src / chain / transaction.rs
index 40033b15c8f28ba390cbdd1913e5c0bb6e37a56b..3a35c4727f937183018e304786e6cf4029c2fda4 100644 (file)
@@ -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] {