]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Update auto-generated bindings to latest upstream
authorMatt Corallo <git@bluematt.me>
Tue, 28 Sep 2021 01:07:41 +0000 (01:07 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 28 Sep 2021 01:08:33 +0000 (01:08 +0000)
lightning-c-bindings/include/lightning.h
lightning-c-bindings/src/c_types/derived.rs
lightning-c-bindings/src/lightning/ln/script.rs
lightning-c-bindings/src/lightning/routing/network_graph.rs

index 06bd643b756dddbbc5acd7a149dff15d4e02014a..dad0072d6b9fdca33e85da686e981dea81ec7e8b 100644 (file)
@@ -11994,6 +11994,12 @@ struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(
  */
 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
 
+/**
+ * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
+
 /**
  * Creates a new CResult_NetAddressu8Z in the success state.
  */
@@ -19434,16 +19440,6 @@ struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_
  */
 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
 
-/**
- * Generates a P2PKH script pubkey from the given [`PubkeyHash`].
- */
-MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2pkh(const uint8_t (*pubkey_hash)[20]);
-
-/**
- * Generates a P2SH script pubkey from the given [`ScriptHash`].
- */
-MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2sh(const uint8_t (*script_hash)[20]);
-
 /**
  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
  */
@@ -19821,6 +19817,11 @@ struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id
  */
 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
 
+/**
+ * Creates a copy of the NetworkGraph
+ */
+struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
+
 /**
  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
  */
index cdc062788f781e244ef31941429e66830679f361..2afa5c256eaf42b5432fa4bbf54cf98afbd85d92 100644 (file)
@@ -8397,6 +8397,23 @@ impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph:
                }
        }
 }
+impl Clone for CResult_NetworkGraphDecodeErrorZ {
+       fn clone(&self) -> Self {
+               if self.result_ok {
+                       Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
+                               result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
+                       } }
+               } else {
+                       Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
+                               err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
+                       } }
+               }
+       }
+}
+#[no_mangle]
+/// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
+/// but with all dynamically-allocated buffers duplicated in new buffers.
+pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
 #[repr(C)]
 /// The contents of CResult_NetAddressu8Z
 pub union CResult_NetAddressu8ZPtr {
index 73c90247ac61a5062fdebcf4b8a03381f9a15619..0151ae22602b8fe4a4c6c4e386568c6d0de8d51c 100644 (file)
@@ -176,22 +176,6 @@ pub extern "C" fn ShutdownScript_read(ser: crate::c_types::u8slice) -> crate::c_
        let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::script::ShutdownScript { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
        local_res
 }
-/// Generates a P2PKH script pubkey from the given [`PubkeyHash`].
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ShutdownScript_new_p2pkh(pubkey_hash: *const [u8; 20]) -> ShutdownScript {
-       let mut ret = lightning::ln::script::ShutdownScript::new_p2pkh(&bitcoin::hash_types::PubkeyHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *pubkey_hash }.clone())));
-       ShutdownScript { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
-/// Generates a P2SH script pubkey from the given [`ScriptHash`].
-#[must_use]
-#[no_mangle]
-pub extern "C" fn ShutdownScript_new_p2sh(script_hash: *const [u8; 20]) -> ShutdownScript {
-       let mut ret = lightning::ln::script::ShutdownScript::new_p2sh(&bitcoin::hash_types::ScriptHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *script_hash }.clone())));
-       ShutdownScript { inner: ObjOps::heap_alloc(ret), is_owned: true }
-}
-
 /// Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
 #[must_use]
 #[no_mangle]
index f1e72f1963c27ccdc5b5eaa28272ee676c626d1c..5aece81407002b6cbb8e919fb4a15901c316939f 100644 (file)
@@ -65,6 +65,25 @@ impl NetworkGraph {
                ret
        }
 }
+impl Clone for NetworkGraph {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: if <*mut nativeNetworkGraph>::is_null(self.inner) { std::ptr::null_mut() } else {
+                               ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(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 NetworkGraph_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNetworkGraph)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the NetworkGraph
+pub extern "C" fn NetworkGraph_clone(orig: &NetworkGraph) -> NetworkGraph {
+       orig.clone()
+}
 
 use lightning::routing::network_graph::ReadOnlyNetworkGraph as nativeReadOnlyNetworkGraphImport;
 type nativeReadOnlyNetworkGraph = nativeReadOnlyNetworkGraphImport<'static>;