]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Add ChannelMonitor_clone patch to bindings
authorMatt Corallo <git@bluematt.me>
Fri, 12 Mar 2021 16:40:08 +0000 (11:40 -0500)
committerMatt Corallo <git@bluematt.me>
Wed, 31 Mar 2021 19:46:33 +0000 (15:46 -0400)
lightning-c-bindings/Cargo.toml
lightning-c-bindings/include/lightning.h
lightning-c-bindings/src/chain/channelmonitor.rs

index e8e556b58afa352488e10954613ea721f6db8272..55dcb14bf7b038c63f5017c8194bfeb72c355aa6 100644 (file)
@@ -18,7 +18,7 @@ crate-type = ["staticlib"
 bitcoin = "0.26"
 secp256k1 = { version = "0.20.1", features = ["global-context-less-secure"] }
 # Note that the following line is matched by genbindings to update the path
-lightning = { git = "https://git.bitcoin.ninja/rust-lightning", rev = "6fcac8bc65ed6d372e0b8c367e9934c754f99ff3", features = ["allow_wallclock_use"] }
+lightning = { git = "https://git.bitcoin.ninja/rust-lightning", rev = "28dc5a1b22c38e0c37e92c9b8797e52130e9c812", features = ["allow_wallclock_use"] }
 
 [patch.crates-io]
 # Rust-Secp256k1 PR 279. Should be dropped once merged.
index bdeb29858d5c9e60954c4eaebab3f4e1e0909a5f..49de1f69d65dee7c0a29d37175b4f9747da044fc 100644 (file)
@@ -10222,6 +10222,11 @@ struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
  */
 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
 
+/**
+ * Creates a copy of the ChannelMonitor
+ */
+struct LDKChannelMonitor ChannelMonitor_clone(const struct LDKChannelMonitor *NONNULL_PTR orig);
+
 /**
  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
  */
index 5e10158b9fb7f23587c03f6e218952cc5ed9a2ba..5a50b01301e2dfdeaaa56b854c8a5e0fcf00babd 100644 (file)
@@ -538,6 +538,25 @@ impl ChannelMonitor {
                ret
        }
 }
+impl Clone for ChannelMonitor {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: if <*mut nativeChannelMonitor>::is_null(self.inner) { std::ptr::null_mut() } else {
+                               Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
+                       is_owned: true,
+               }
+       }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelMonitor_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelMonitor)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the ChannelMonitor
+pub extern "C" fn ChannelMonitor_clone(orig: &ChannelMonitor) -> ChannelMonitor {
+       orig.clone()
+}
 #[no_mangle]
 /// Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
 pub extern "C" fn ChannelMonitor_write(obj: &ChannelMonitor) -> crate::c_types::derived::CVec_u8Z {