Update auto-generated bindings to LDK 0.0.118
[ldk-c-bindings] / lightning-c-bindings / src / lightning / routing / utxo.rs
index c9ed69527e2a71757e57088abf8fe02e3a9ed665..6ebae6c13c2b7c2eeafe7cc50c2809d4b50ecf53 100644 (file)
@@ -13,6 +13,7 @@
 //! order to announce a channel. This module handles that checking.
 
 use alloc::str::FromStr;
+use alloc::string::String;
 use core::ffi::c_void;
 use core::convert::Infallible;
 use bitcoin::hashes::Hash;
@@ -68,6 +69,16 @@ impl UtxoLookupError {
 pub extern "C" fn UtxoLookupError_clone(orig: &UtxoLookupError) -> UtxoLookupError {
        orig.clone()
 }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn UtxoLookupError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *const UtxoLookupError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn UtxoLookupError_free_void(this_ptr: *mut c_void) {
+       let _ = unsafe { Box::from_raw(this_ptr as *mut UtxoLookupError) };
+}
 #[no_mangle]
 /// Utility method to constructs a new UnknownChain-variant UtxoLookupError
 pub extern "C" fn UtxoLookupError_unknown_chain() -> UtxoLookupError {
@@ -140,7 +151,7 @@ impl UtxoResult {
                match native {
                        nativeUtxoResult::Sync (ref a, ) => {
                                let mut a_nonref = Clone::clone(a);
-                               let mut local_a_nonref = match a_nonref { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::TxOut::from_rust(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::routing::utxo::UtxoLookupError::native_into(e) }).into() };
+                               let mut local_a_nonref = match a_nonref { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::TxOut::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::routing::utxo::UtxoLookupError::native_into(e) }).into() };
                                UtxoResult::Sync (
                                        local_a_nonref,
                                )
@@ -157,7 +168,7 @@ impl UtxoResult {
        pub(crate) fn native_into(native: nativeUtxoResult) -> Self {
                match native {
                        nativeUtxoResult::Sync (mut a, ) => {
-                               let mut local_a = match a { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::TxOut::from_rust(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::routing::utxo::UtxoLookupError::native_into(e) }).into() };
+                               let mut local_a = match a { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::TxOut::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::routing::utxo::UtxoLookupError::native_into(e) }).into() };
                                UtxoResult::Sync (
                                        local_a,
                                )
@@ -178,6 +189,16 @@ pub extern "C" fn UtxoResult_free(this_ptr: UtxoResult) { }
 pub extern "C" fn UtxoResult_clone(orig: &UtxoResult) -> UtxoResult {
        orig.clone()
 }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn UtxoResult_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *const UtxoResult)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn UtxoResult_free_void(this_ptr: *mut c_void) {
+       let _ = unsafe { Box::from_raw(this_ptr as *mut UtxoResult) };
+}
 #[no_mangle]
 /// Utility method to constructs a new Sync-variant UtxoResult
 pub extern "C" fn UtxoResult_sync(a: crate::c_types::derived::CResult_TxOutUtxoLookupErrorZ) -> UtxoResult {
@@ -195,20 +216,19 @@ pub struct UtxoLookup {
        /// This has no meaning in the LDK, and can be NULL or any other value.
        pub this_arg: *mut c_void,
        /// Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
-       /// Returns an error if `genesis_hash` is for a different chain or if such a transaction output
-       /// is unknown.
+       /// Returns an error if `chain_hash` is for a different chain or if such a transaction output is
+       /// unknown.
        ///
        /// [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
-       #[must_use]
-       pub get_utxo: extern "C" fn (this_arg: *const c_void, genesis_hash: *const [u8; 32], short_channel_id: u64) -> crate::lightning::routing::utxo::UtxoResult,
+       pub get_utxo: extern "C" fn (this_arg: *const c_void, chain_hash: *const [u8; 32], short_channel_id: u64) -> crate::lightning::routing::utxo::UtxoResult,
        /// Frees any resources associated with this object given its this_arg pointer.
        /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
        pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
 }
 unsafe impl Send for UtxoLookup {}
 unsafe impl Sync for UtxoLookup {}
-#[no_mangle]
-pub(crate) extern "C" fn UtxoLookup_clone_fields(orig: &UtxoLookup) -> UtxoLookup {
+#[allow(unused)]
+pub(crate) fn UtxoLookup_clone_fields(orig: &UtxoLookup) -> UtxoLookup {
        UtxoLookup {
                this_arg: orig.this_arg,
                get_utxo: Clone::clone(&orig.get_utxo),
@@ -218,8 +238,8 @@ pub(crate) extern "C" fn UtxoLookup_clone_fields(orig: &UtxoLookup) -> UtxoLooku
 
 use lightning::routing::utxo::UtxoLookup as rustUtxoLookup;
 impl rustUtxoLookup for UtxoLookup {
-       fn get_utxo(&self, mut genesis_hash: &bitcoin::BlockHash, mut short_channel_id: u64) -> lightning::routing::utxo::UtxoResult {
-               let mut ret = (self.get_utxo)(self.this_arg, genesis_hash.as_inner(), short_channel_id);
+       fn get_utxo(&self, mut chain_hash: &bitcoin::blockdata::constants::ChainHash, mut short_channel_id: u64) -> lightning::routing::utxo::UtxoResult {
+               let mut ret = (self.get_utxo)(self.this_arg, chain_hash.as_bytes(), short_channel_id);
                ret.into_native()
        }
 }
@@ -232,6 +252,11 @@ impl core::ops::Deref for UtxoLookup {
                self
        }
 }
+impl core::ops::DerefMut for UtxoLookup {
+       fn deref_mut(&mut self) -> &mut Self {
+               self
+       }
+}
 /// Calls the free function if one is set
 #[no_mangle]
 pub extern "C" fn UtxoLookup_free(this_ptr: UtxoLookup) { }
@@ -307,7 +332,7 @@ impl Clone for UtxoFuture {
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
 pub(crate) extern "C" fn UtxoFuture_clone_void(this_ptr: *const c_void) -> *mut c_void {
-       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeUtxoFuture)).clone() })) as *mut c_void
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUtxoFuture)).clone() })) as *mut c_void
 }
 #[no_mangle]
 /// Creates a copy of the UtxoFuture