From 0a6c9e85ff86f4b3e814a8286c3c311ade4e0c4a Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 30 Dec 2020 15:25:02 -0500 Subject: [PATCH 01/13] [bindings] Pipe errors back from write_template_constructor We can fail to resolve a part of a tuple, resulting in a panic in write_template_constructor even if we're calling `understood_c_type` with the intent of figuring out whether we can print a type at all. Instead, we should pipe errors back and let `understood_c_type` return false as a result. --- c-bindings-gen/src/types.rs | 93 +++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 44 deletions(-) diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index e3ae3bdef4f..b5c17f3eb8b 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -1720,7 +1720,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { // *** C Container Type Equivalent and alias Printing *** // ****************************************************** - fn write_template_constructor(&mut self, w: &mut W, container_type: &str, mangled_container: &str, args: &Vec<&syn::Type>, generics: Option<&GenericTypes>, is_ref: bool) { + fn write_template_constructor(&mut self, w: &mut W, container_type: &str, mangled_container: &str, args: &Vec<&syn::Type>, generics: Option<&GenericTypes>, is_ref: bool) -> bool { if container_type == "Result" { assert_eq!(args.len(), 2); macro_rules! write_fn { @@ -1761,7 +1761,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { write!(w, "#[no_mangle]\npub extern \"C\" fn {}_new(", mangled_container).unwrap(); for (idx, gen) in args.iter().enumerate() { write!(w, "{}{}: ", if idx != 0 { ", " } else { "" }, ('a' as u8 + idx as u8) as char).unwrap(); - assert!(self.write_c_type_intern(w, gen, None, false, false, false)); + if !self.write_c_type_intern(w, gen, None, false, false, false) { return false; } } writeln!(w, ") -> {} {{", mangled_container).unwrap(); write!(w, "\t{} {{ ", mangled_container).unwrap(); @@ -1772,6 +1772,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { } else { writeln!(w, "").unwrap(); } + true } fn write_template_generics<'b, W: std::io::Write>(&self, w: &mut W, args: &mut dyn Iterator, generics: Option<&GenericTypes>, is_ref: bool, in_crate: bool) { @@ -1850,9 +1851,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { } } } - fn check_create_container(&mut self, mangled_container: String, container_type: &str, args: Vec<&syn::Type>, generics: Option<&GenericTypes>, is_ref: bool) { + fn check_create_container(&mut self, mangled_container: String, container_type: &str, args: Vec<&syn::Type>, generics: Option<&GenericTypes>, is_ref: bool) -> bool { if !self.crate_types.templates_defined.get(&mangled_container).is_some() { - self.crate_types.templates_defined.insert(mangled_container.clone(), true); let mut created_container: Vec = Vec::new(); write!(&mut created_container, "pub type {} = ", mangled_container).unwrap(); @@ -1865,10 +1865,14 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { self.write_template_generics(&mut created_container, &mut args.iter().map(|t| *t), generics, is_ref, true); writeln!(&mut created_container, ">;").unwrap(); - self.write_template_constructor(&mut created_container, container_type, &mangled_container, &args, generics, is_ref); + if !self.write_template_constructor(&mut created_container, container_type, &mangled_container, &args, generics, is_ref) { + return false; + } + self.crate_types.templates_defined.insert(mangled_container.clone(), true); self.crate_types.template_file.write(&created_container).unwrap(); } + true } fn path_to_generic_args(path: &syn::Path) -> Vec<&syn::Type> { if let syn::PathArguments::AngleBracketed(args) = &path.segments.iter().next().unwrap().arguments { @@ -1885,45 +1889,46 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { for arg in args.iter() { macro_rules! write_path { ($p_arg: expr, $extra_write: expr) => { - let subtype = self.resolve_path(&$p_arg.path, generics); - if self.is_transparent_container(ident, is_ref) { - // We dont (yet) support primitives or containers inside transparent - // containers, so check for that first: - if self.is_primitive(&subtype) { return false; } - if self.is_known_container(&subtype, is_ref) { return false; } - if !in_type { - if self.c_type_has_inner_from_path(&subtype) { - if !self.write_c_path_intern(w, &$p_arg.path, generics, is_ref, is_mut, ptr_for_ref) { return false; } + if let Some(subtype) = self.maybe_resolve_path(&$p_arg.path, generics) { + if self.is_transparent_container(ident, is_ref) { + // We dont (yet) support primitives or containers inside transparent + // containers, so check for that first: + if self.is_primitive(&subtype) { return false; } + if self.is_known_container(&subtype, is_ref) { return false; } + if !in_type { + if self.c_type_has_inner_from_path(&subtype) { + if !self.write_c_path_intern(w, &$p_arg.path, generics, is_ref, is_mut, ptr_for_ref) { return false; } + } else { + // Option needs to be converted to a *mut T, ie mut ptr-for-ref + if !self.write_c_path_intern(w, &$p_arg.path, generics, true, true, true) { return false; } + } } else { - // Option needs to be converted to a *mut T, ie mut ptr-for-ref - if !self.write_c_path_intern(w, &$p_arg.path, generics, true, true, true) { return false; } + if $p_arg.path.segments.len() == 1 { + write!(w, "{}", $p_arg.path.segments.iter().next().unwrap().ident).unwrap(); + } else { + return false; + } } - } else { - if $p_arg.path.segments.len() == 1 { - write!(w, "{}", $p_arg.path.segments.iter().next().unwrap().ident).unwrap(); - } else { + } else if self.is_known_container(&subtype, is_ref) || self.is_transparent_container(&subtype, is_ref) { + if !self.write_c_mangled_container_path_intern(w, Self::path_to_generic_args(&$p_arg.path), generics, + &subtype, is_ref, is_mut, ptr_for_ref, true) { return false; } - } - } else if self.is_known_container(&subtype, is_ref) || self.is_transparent_container(&subtype, is_ref) { - if !self.write_c_mangled_container_path_intern(w, Self::path_to_generic_args(&$p_arg.path), generics, - &subtype, is_ref, is_mut, ptr_for_ref, true) { - return false; - } - self.write_c_mangled_container_path_intern(&mut mangled_type, Self::path_to_generic_args(&$p_arg.path), - generics, &subtype, is_ref, is_mut, ptr_for_ref, true); - if let Some(w2) = $extra_write as Option<&mut Vec> { - self.write_c_mangled_container_path_intern(w2, Self::path_to_generic_args(&$p_arg.path), + self.write_c_mangled_container_path_intern(&mut mangled_type, Self::path_to_generic_args(&$p_arg.path), generics, &subtype, is_ref, is_mut, ptr_for_ref, true); + if let Some(w2) = $extra_write as Option<&mut Vec> { + self.write_c_mangled_container_path_intern(w2, Self::path_to_generic_args(&$p_arg.path), + generics, &subtype, is_ref, is_mut, ptr_for_ref, true); + } + } else { + let id = &&$p_arg.path.segments.iter().rev().next().unwrap().ident; + write!(w, "{}", id).unwrap(); + write!(mangled_type, "{}", id).unwrap(); + if let Some(w2) = $extra_write as Option<&mut Vec> { + write!(w2, "{}", id).unwrap(); + } } - } else { - let id = &&$p_arg.path.segments.iter().rev().next().unwrap().ident; - write!(w, "{}", id).unwrap(); - write!(mangled_type, "{}", id).unwrap(); - if let Some(w2) = $extra_write as Option<&mut Vec> { - write!(w2, "{}", id).unwrap(); - } - } + } else { return false; } } } if let syn::Type::Tuple(tuple) = arg { @@ -1952,8 +1957,10 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { write!(w, "Z").unwrap(); write!(mangled_type, "Z").unwrap(); write!(mangled_tuple_type, "Z").unwrap(); - self.check_create_container(String::from_utf8(mangled_tuple_type).unwrap(), - &format!("{}Tuple", tuple.elems.len()), tuple.elems.iter().collect(), generics, is_ref); + if !self.check_create_container(String::from_utf8(mangled_tuple_type).unwrap(), + &format!("{}Tuple", tuple.elems.len()), tuple.elems.iter().collect(), generics, is_ref) { + return false; + } } } else if let syn::Type::Path(p_arg) = arg { write_path!(p_arg, None); @@ -1987,8 +1994,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { write!(mangled_type, "Z").unwrap(); // Make sure the type is actually defined: - self.check_create_container(String::from_utf8(mangled_type).unwrap(), ident, args, generics, is_ref); - true + self.check_create_container(String::from_utf8(mangled_type).unwrap(), ident, args, generics, is_ref) } fn write_c_mangled_container_path(&mut self, w: &mut W, args: Vec<&syn::Type>, generics: Option<&GenericTypes>, ident: &str, is_ref: bool, is_mut: bool, ptr_for_ref: bool) -> bool { if !self.is_transparent_container(ident, is_ref) { @@ -2098,8 +2104,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { format!("CVec_{}Z", id) } else { return false; }; write!(w, "{}::{}", Self::generated_container_path(), mangled_container).unwrap(); - self.check_create_container(mangled_container, "Vec", vec![&*r.elem], generics, false); - true + self.check_create_container(mangled_container, "Vec", vec![&*r.elem], generics, false) } else { false } } else if let syn::Type::Tuple(_) = &*s.elem { let mut args = syn::punctuated::Punctuated::new(); From e36b51400fad4173cde525e0378e32e2bbcaa377 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 30 Dec 2020 17:30:59 -0500 Subject: [PATCH 02/13] [bindings] Convert manual `_read` implementations to return Results Previously, manual `*_read` implementations were only defined for types with inner fields, which were set to NULL to indicate read errors. This prevents exposing `*_read` for several other types, including tuples (which are needed for `ChannelManager`/ `ChannelMonitors`) and enums (which includes `Event`s, though users likely never need to call that directly). Further, this means we don't expose the actual error enum (which is likely no big deal, but is still nice). Here, we instead create the `Result` type and then pass it through the normal type conversion functions, giving us access to any types which we can convert normally. --- c-bindings-gen/src/main.rs | 66 ++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 13 deletions(-) diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index f427b5063c5..5905f62f8cf 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -58,15 +58,27 @@ fn convert_macro(w: &mut W, macro_path: &syn::Path, stream: & } } -/// Convert "impl trait_path for for_obj { .. }" for manually-mapped types (ie (de)serialization) -fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path, for_obj: &syn::Ident, types: &TypeResolver) { +/// Convert "impl trait_path for for_ty { .. }" for manually-mapped types (ie (de)serialization) +fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path, for_ty: &syn::Type, types: &mut TypeResolver) { if let Some(t) = types.maybe_resolve_path(&trait_path, None) { - let s = types.maybe_resolve_ident(for_obj).unwrap(); - if !types.crate_types.opaques.get(&s).is_some() { return; } + let for_obj; + let full_obj_path; + if let syn::Type::Path(ref p) = for_ty { + if let Some(ident) = p.path.get_ident() { + let s = types.maybe_resolve_ident(ident).unwrap(); + if !types.crate_types.opaques.get(&s).is_some() { return; } + + for_obj = format!("{}", ident); + full_obj_path = for_obj.clone(); + } else { return; } + } else { + return; + } + match &t as &str { "util::ser::Writeable" => { writeln!(w, "#[no_mangle]").unwrap(); - writeln!(w, "pub extern \"C\" fn {}_write(obj: *const {}) -> crate::c_types::derived::CVec_u8Z {{", for_obj, for_obj).unwrap(); + writeln!(w, "pub extern \"C\" fn {}_write(obj: *const {}) -> crate::c_types::derived::CVec_u8Z {{", for_obj, full_obj_path).unwrap(); writeln!(w, "\tcrate::c_types::serialize_obj(unsafe {{ &(*(*obj).inner) }})").unwrap(); writeln!(w, "}}").unwrap(); writeln!(w, "#[no_mangle]").unwrap(); @@ -75,13 +87,41 @@ fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path writeln!(w, "}}").unwrap(); }, "util::ser::Readable" => { + // Create the Result syn::Type + let mut err_segs = syn::punctuated::Punctuated::new(); + err_segs.push(syn::PathSegment { ident: syn::Ident::new("ln", Span::call_site()), arguments: syn::PathArguments::None }); + err_segs.push(syn::PathSegment { ident: syn::Ident::new("msgs", Span::call_site()), arguments: syn::PathArguments::None }); + err_segs.push(syn::PathSegment { ident: syn::Ident::new("DecodeError", Span::call_site()), arguments: syn::PathArguments::None }); + let mut args = syn::punctuated::Punctuated::new(); + args.push(syn::GenericArgument::Type(for_ty.clone())); + args.push(syn::GenericArgument::Type(syn::Type::Path(syn::TypePath { + qself: None, path: syn::Path { + leading_colon: Some(syn::Token![::](Span::call_site())), segments: err_segs, + } + }))); + let mut res_segs = syn::punctuated::Punctuated::new(); + res_segs.push(syn::PathSegment { + ident: syn::Ident::new("Result", Span::call_site()), + arguments: syn::PathArguments::AngleBracketed(syn::AngleBracketedGenericArguments { + colon2_token: None, lt_token: syn::Token![<](Span::call_site()), args, gt_token: syn::Token![>](Span::call_site()), + }) + }); + let res_ty = syn::Type::Path(syn::TypePath { qself: None, path: syn::Path { + leading_colon: None, segments: res_segs } }); + writeln!(w, "#[no_mangle]").unwrap(); - writeln!(w, "pub extern \"C\" fn {}_read(ser: crate::c_types::u8slice) -> {} {{", for_obj, for_obj).unwrap(); - writeln!(w, "\tif let Ok(res) = crate::c_types::deserialize_obj(ser) {{").unwrap(); - writeln!(w, "\t\t{} {{ inner: Box::into_raw(Box::new(res)), is_owned: true }}", for_obj).unwrap(); - writeln!(w, "\t}} else {{").unwrap(); - writeln!(w, "\t\t{} {{ inner: std::ptr::null_mut(), is_owned: true }}", for_obj).unwrap(); - writeln!(w, "\t}}\n}}").unwrap(); + write!(w, "pub extern \"C\" fn {}_read(ser: crate::c_types::u8slice) -> ", for_obj).unwrap(); + types.write_c_type(w, &res_ty, None, false); + writeln!(w, " {{").unwrap(); + writeln!(w, "\tlet res = crate::c_types::deserialize_obj(ser);").unwrap(); + write!(w, "\t").unwrap(); + if types.write_to_c_conversion_new_var(w, &syn::Ident::new("res", Span::call_site()), &res_ty, None, false) { + write!(w, "\n\t").unwrap(); + } + types.write_to_c_conversion_inline_prefix(w, &res_ty, None, false); + write!(w, "res").unwrap(); + types.write_to_c_conversion_inline_suffix(w, &res_ty, None, false); + writeln!(w, "\n}}").unwrap(); }, _ => {}, } @@ -838,12 +878,12 @@ fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut Typ }, "PartialEq" => {}, // If we have no generics, try a manual implementation: - _ if p.path.get_ident().is_some() => maybe_convert_trait_impl(w, &trait_path.1, &ident, types), + _ if p.path.get_ident().is_some() => maybe_convert_trait_impl(w, &trait_path.1, &*i.self_ty, types), _ => {}, } } else if p.path.get_ident().is_some() { // If we have no generics, try a manual implementation: - maybe_convert_trait_impl(w, &trait_path.1, &ident, types); + maybe_convert_trait_impl(w, &trait_path.1, &*i.self_ty, types); } } else { let declared_type = (*types.get_declared_type(&ident).unwrap()).clone(); From dfef21c66628dae5e38d3273572ff0ba668b9ffc Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 30 Dec 2020 17:50:43 -0500 Subject: [PATCH 03/13] [bindings] Use common conv in `_write` impls, drop type restrictions This expands the manual implementation logic for `*_write` and `*_read` methods to most types, converting the `*_write` path to the common type-conversion logic to ensure it works. Note that `*_write_void` is still only implemented for has-inner types, as its unclear what the `void*` would point to for others. --- c-bindings-gen/src/main.rs | 36 +++++++++++++++++++++++++++--------- c-bindings-gen/src/types.rs | 4 ++-- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 5905f62f8cf..c197839c924 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -63,28 +63,46 @@ fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path if let Some(t) = types.maybe_resolve_path(&trait_path, None) { let for_obj; let full_obj_path; + let mut has_inner = false; if let syn::Type::Path(ref p) = for_ty { if let Some(ident) = p.path.get_ident() { - let s = types.maybe_resolve_ident(ident).unwrap(); - if !types.crate_types.opaques.get(&s).is_some() { return; } - for_obj = format!("{}", ident); full_obj_path = for_obj.clone(); + has_inner = types.c_type_has_inner_from_path(&types.resolve_path(&p.path, None)); } else { return; } } else { - return; + // We assume that anything that isn't a Path is somehow a generic that ends up in our + // derived-types module. + let mut for_obj_vec = Vec::new(); + types.write_c_type(&mut for_obj_vec, for_ty, None, false); + full_obj_path = String::from_utf8(for_obj_vec).unwrap(); + assert!(full_obj_path.starts_with(TypeResolver::generated_container_path())); + for_obj = full_obj_path[TypeResolver::generated_container_path().len() + 2..].into(); } match &t as &str { "util::ser::Writeable" => { writeln!(w, "#[no_mangle]").unwrap(); writeln!(w, "pub extern \"C\" fn {}_write(obj: *const {}) -> crate::c_types::derived::CVec_u8Z {{", for_obj, full_obj_path).unwrap(); - writeln!(w, "\tcrate::c_types::serialize_obj(unsafe {{ &(*(*obj).inner) }})").unwrap(); - writeln!(w, "}}").unwrap(); - writeln!(w, "#[no_mangle]").unwrap(); - writeln!(w, "pub(crate) extern \"C\" fn {}_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {{", for_obj).unwrap(); - writeln!(w, "\tcrate::c_types::serialize_obj(unsafe {{ &*(obj as *const native{}) }})", for_obj).unwrap(); + + let ref_type = syn::Type::Reference(syn::TypeReference { + and_token: syn::Token!(&)(Span::call_site()), lifetime: None, mutability: None, + elem: Box::new(for_ty.clone()) }); + assert!(!types.write_from_c_conversion_new_var(w, &syn::Ident::new("obj", Span::call_site()), &ref_type, None)); + + write!(w, "\tcrate::c_types::serialize_obj(").unwrap(); + types.write_from_c_conversion_prefix(w, &ref_type, None); + write!(w, "unsafe {{ &*obj }}").unwrap(); + types.write_from_c_conversion_suffix(w, &ref_type, None); + writeln!(w, ")").unwrap(); + writeln!(w, "}}").unwrap(); + if has_inner { + writeln!(w, "#[no_mangle]").unwrap(); + writeln!(w, "pub(crate) extern \"C\" fn {}_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {{", for_obj).unwrap(); + writeln!(w, "\tcrate::c_types::serialize_obj(unsafe {{ &*(obj as *const native{}) }})", for_obj).unwrap(); + writeln!(w, "}}").unwrap(); + } }, "util::ser::Readable" => { // Create the Result syn::Type diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index b5c17f3eb8b..7ecd9ef1ed4 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -727,7 +727,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { /// Returns the module path in the generated mapping crate to the containers which we generate /// when writing to CrateTypes::template_file. - fn generated_container_path() -> &'static str { + pub fn generated_container_path() -> &'static str { "crate::c_types::derived" } /// Returns the module path in the generated mapping crate to the container templates, which @@ -914,7 +914,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { self.declared.get(ident) } /// Returns true if the object at the given path is mapped as X { inner: *mut origX, .. }. - fn c_type_has_inner_from_path(&self, full_path: &str) -> bool{ + pub fn c_type_has_inner_from_path(&self, full_path: &str) -> bool{ self.crate_types.opaques.get(full_path).is_some() } From ef2b321fdb577245b662b575232d4c40f14ad7b2 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 30 Dec 2020 19:46:39 -0500 Subject: [PATCH 04/13] [bindings] Allow `write_rust_type` to handle leading-colon paths It just stubs out to `write_rust_path` in this case anyway, which handles leading-colons just fine, so no need to panic on them. --- c-bindings-gen/src/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 7ecd9ef1ed4..628d263bf9a 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -1061,7 +1061,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { pub fn write_rust_type(&self, w: &mut W, generics: Option<&GenericTypes>, t: &syn::Type) { match t { syn::Type::Path(p) => { - if p.qself.is_some() || p.path.leading_colon.is_some() { + if p.qself.is_some() { unimplemented!(); } self.write_rust_path(w, generics, &p.path); From 56134a2bd123b75448536de5e945374e8b011f92 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 30 Dec 2020 19:47:32 -0500 Subject: [PATCH 05/13] [bindings] Implement ReadableArgs mapping, try impl mapping for ()s This is most of the code to expose `ChannelManager`/`ChannelMonitor` deserialization in our C bindings, using the new infrastructure to map types in `maybe_convert_trait_impl` and passing generics in from the callsites. We also call `maybe_convert_trait_impl` for tuple types, as the `ChannelManager`/`ChannelMonitor` deserialization returns a `(BlockHash, T)` to indicate the block hash at which users need to start resyncing the chain. The final step to expose them is in the next commit. --- c-bindings-gen/src/main.rs | 88 ++++++++++++++++++++----- lightning-c-bindings/src/c_types/mod.rs | 3 + 2 files changed, 75 insertions(+), 16 deletions(-) diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index c197839c924..ffb70f92001 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -59,8 +59,8 @@ fn convert_macro(w: &mut W, macro_path: &syn::Path, stream: & } /// Convert "impl trait_path for for_ty { .. }" for manually-mapped types (ie (de)serialization) -fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path, for_ty: &syn::Type, types: &mut TypeResolver) { - if let Some(t) = types.maybe_resolve_path(&trait_path, None) { +fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path, for_ty: &syn::Type, types: &mut TypeResolver, generics: &GenericTypes) { + if let Some(t) = types.maybe_resolve_path(&trait_path, Some(generics)) { let for_obj; let full_obj_path; let mut has_inner = false; @@ -68,13 +68,13 @@ fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path if let Some(ident) = p.path.get_ident() { for_obj = format!("{}", ident); full_obj_path = for_obj.clone(); - has_inner = types.c_type_has_inner_from_path(&types.resolve_path(&p.path, None)); + has_inner = types.c_type_has_inner_from_path(&types.resolve_path(&p.path, Some(generics))); } else { return; } } else { // We assume that anything that isn't a Path is somehow a generic that ends up in our // derived-types module. let mut for_obj_vec = Vec::new(); - types.write_c_type(&mut for_obj_vec, for_ty, None, false); + types.write_c_type(&mut for_obj_vec, for_ty, Some(generics), false); full_obj_path = String::from_utf8(for_obj_vec).unwrap(); assert!(full_obj_path.starts_with(TypeResolver::generated_container_path())); for_obj = full_obj_path[TypeResolver::generated_container_path().len() + 2..].into(); @@ -88,12 +88,12 @@ fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path let ref_type = syn::Type::Reference(syn::TypeReference { and_token: syn::Token!(&)(Span::call_site()), lifetime: None, mutability: None, elem: Box::new(for_ty.clone()) }); - assert!(!types.write_from_c_conversion_new_var(w, &syn::Ident::new("obj", Span::call_site()), &ref_type, None)); + assert!(!types.write_from_c_conversion_new_var(w, &syn::Ident::new("obj", Span::call_site()), &ref_type, Some(generics))); write!(w, "\tcrate::c_types::serialize_obj(").unwrap(); - types.write_from_c_conversion_prefix(w, &ref_type, None); + types.write_from_c_conversion_prefix(w, &ref_type, Some(generics)); write!(w, "unsafe {{ &*obj }}").unwrap(); - types.write_from_c_conversion_suffix(w, &ref_type, None); + types.write_from_c_conversion_suffix(w, &ref_type, Some(generics)); writeln!(w, ")").unwrap(); writeln!(w, "}}").unwrap(); @@ -104,7 +104,7 @@ fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path writeln!(w, "}}").unwrap(); } }, - "util::ser::Readable" => { + "util::ser::Readable"|"util::ser::ReadableArgs" => { // Create the Result syn::Type let mut err_segs = syn::punctuated::Punctuated::new(); err_segs.push(syn::PathSegment { ident: syn::Ident::new("ln", Span::call_site()), arguments: syn::PathArguments::None }); @@ -128,17 +128,48 @@ fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path leading_colon: None, segments: res_segs } }); writeln!(w, "#[no_mangle]").unwrap(); - write!(w, "pub extern \"C\" fn {}_read(ser: crate::c_types::u8slice) -> ", for_obj).unwrap(); - types.write_c_type(w, &res_ty, None, false); + write!(w, "pub extern \"C\" fn {}_read(ser: crate::c_types::u8slice", for_obj).unwrap(); + + let mut arg_conv = Vec::new(); + if t == "util::ser::ReadableArgs" { + write!(w, ", arg: ").unwrap(); + assert!(trait_path.leading_colon.is_none()); + let args_seg = trait_path.segments.iter().last().unwrap(); + assert_eq!(format!("{}", args_seg.ident), "ReadableArgs"); + if let syn::PathArguments::AngleBracketed(args) = &args_seg.arguments { + assert_eq!(args.args.len(), 1); + if let syn::GenericArgument::Type(args_ty) = args.args.iter().next().unwrap() { + types.write_c_type(w, args_ty, Some(generics), false); + + assert!(!types.write_from_c_conversion_new_var(&mut arg_conv, &syn::Ident::new("arg", Span::call_site()), &args_ty, Some(generics))); + + write!(&mut arg_conv, "\tlet arg_conv = ").unwrap(); + types.write_from_c_conversion_prefix(&mut arg_conv, &args_ty, Some(generics)); + write!(&mut arg_conv, "arg").unwrap(); + types.write_from_c_conversion_suffix(&mut arg_conv, &args_ty, Some(generics)); + } else { unreachable!(); } + } else { unreachable!(); } + } + write!(w, ") -> ").unwrap(); + types.write_c_type(w, &res_ty, Some(generics), false); writeln!(w, " {{").unwrap(); - writeln!(w, "\tlet res = crate::c_types::deserialize_obj(ser);").unwrap(); + + if t == "util::ser::ReadableArgs" { + w.write(&arg_conv).unwrap(); + write!(w, ";\n\tlet res: ").unwrap(); + // At least in one case we need type annotations here, so provide them. + types.write_rust_type(w, Some(generics), &res_ty); + writeln!(w, " = crate::c_types::deserialize_obj_arg(ser, arg_conv);").unwrap(); + } else { + writeln!(w, "\tlet res = crate::c_types::deserialize_obj(ser);").unwrap(); + } write!(w, "\t").unwrap(); - if types.write_to_c_conversion_new_var(w, &syn::Ident::new("res", Span::call_site()), &res_ty, None, false) { + if types.write_to_c_conversion_new_var(w, &syn::Ident::new("res", Span::call_site()), &res_ty, Some(generics), false) { write!(w, "\n\t").unwrap(); } - types.write_to_c_conversion_inline_prefix(w, &res_ty, None, false); + types.write_to_c_conversion_inline_prefix(w, &res_ty, Some(generics), false); write!(w, "res").unwrap(); - types.write_to_c_conversion_inline_suffix(w, &res_ty, None, false); + types.write_to_c_conversion_inline_suffix(w, &res_ty, Some(generics), false); writeln!(w, "\n}}").unwrap(); }, _ => {}, @@ -675,6 +706,31 @@ fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct, /// /// A few non-crate Traits are hard-coded including Default. fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut TypeResolver) { + if let syn::Type::Tuple(_) = &*i.self_ty { + if types.understood_c_type(&*i.self_ty, None) { + let mut gen_types = GenericTypes::new(); + if !gen_types.learn_generics(&i.generics, types) { + eprintln!("Not implementing anything for `impl (..)` due to not understood generics"); + return; + } + + if i.defaultness.is_some() || i.unsafety.is_some() { unimplemented!(); } + if let Some(trait_path) = i.trait_.as_ref() { + if trait_path.0.is_some() { unimplemented!(); } + if types.understood_c_path(&trait_path.1) { + eprintln!("Not implementing anything for `impl Trait for (..)` - we only support manual defines"); + return; + } else { + // Just do a manual implementation: + maybe_convert_trait_impl(w, &trait_path.1, &*i.self_ty, types, &gen_types); + } + } else { + eprintln!("Not implementing anything for plain `impl (..)` block - we only support `impl Trait for (..)` blocks"); + return; + } + } + return; + } if let &syn::Type::Path(ref p) = &*i.self_ty { if p.qself.is_some() { unimplemented!(); } if let Some(ident) = single_ident_generic_path_to_ident(&p.path) { @@ -896,12 +952,12 @@ fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut Typ }, "PartialEq" => {}, // If we have no generics, try a manual implementation: - _ if p.path.get_ident().is_some() => maybe_convert_trait_impl(w, &trait_path.1, &*i.self_ty, types), + _ if p.path.get_ident().is_some() => maybe_convert_trait_impl(w, &trait_path.1, &*i.self_ty, types, &gen_types), _ => {}, } } else if p.path.get_ident().is_some() { // If we have no generics, try a manual implementation: - maybe_convert_trait_impl(w, &trait_path.1, &*i.self_ty, types); + maybe_convert_trait_impl(w, &trait_path.1, &*i.self_ty, types, &gen_types); } } else { let declared_type = (*types.get_declared_type(&ident).unwrap()).clone(); diff --git a/lightning-c-bindings/src/c_types/mod.rs b/lightning-c-bindings/src/c_types/mod.rs index 20c49a6d92b..dcb8d3078bb 100644 --- a/lightning-c-bindings/src/c_types/mod.rs +++ b/lightning-c-bindings/src/c_types/mod.rs @@ -225,6 +225,9 @@ pub(crate) fn serialize_obj(i: &I) -> derive pub(crate) fn deserialize_obj(s: u8slice) -> Result { I::read(&mut s.to_slice()) } +pub(crate) fn deserialize_obj_arg>(s: u8slice, args: A) -> Result { + I::read(&mut s.to_slice(), args) +} #[repr(C)] #[derive(Copy, Clone)] From ac078c103c64f19a70f7967dce620a1905397426 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 31 Dec 2020 11:14:22 -0500 Subject: [PATCH 06/13] [bindings] Don't require trait impl for-structs to have no generics This (finally) exposes `ChannelManager`/`ChannelMonitor` _write methods, which were (needlessly) excluded as the structs themselves have generic parameters. Sadly, we also now need to parse `(C-not exported)` doc comments on impl blocks as we otherwise try to expose _write methods for `&Vec`, which doesn't work (and isn't particularly interesting for users anyway). We add such doc comments there. --- c-bindings-gen/src/main.rs | 12 ++++++++---- lightning/src/ln/chan_utils.rs | 2 ++ lightning/src/routing/router.rs | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index ffb70f92001..4cd3ff557cd 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -65,7 +65,7 @@ fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path let full_obj_path; let mut has_inner = false; if let syn::Type::Path(ref p) = for_ty { - if let Some(ident) = p.path.get_ident() { + if let Some(ident) = single_ident_generic_path_to_ident(&p.path) { for_obj = format!("{}", ident); full_obj_path = for_obj.clone(); has_inner = types.c_type_has_inner_from_path(&types.resolve_path(&p.path, Some(generics))); @@ -706,6 +706,11 @@ fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct, /// /// A few non-crate Traits are hard-coded including Default. fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut TypeResolver) { + match export_status(&i.attrs) { + ExportStatus::Export => {}, + ExportStatus::NoExport|ExportStatus::TestOnly => return, + } + if let syn::Type::Tuple(_) = &*i.self_ty { if types.understood_c_type(&*i.self_ty, None) { let mut gen_types = GenericTypes::new(); @@ -952,10 +957,9 @@ fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut Typ }, "PartialEq" => {}, // If we have no generics, try a manual implementation: - _ if p.path.get_ident().is_some() => maybe_convert_trait_impl(w, &trait_path.1, &*i.self_ty, types, &gen_types), - _ => {}, + _ => maybe_convert_trait_impl(w, &trait_path.1, &*i.self_ty, types, &gen_types), } - } else if p.path.get_ident().is_some() { + } else { // If we have no generics, try a manual implementation: maybe_convert_trait_impl(w, &trait_path.1, &*i.self_ty, types, &gen_types); } diff --git a/lightning/src/ln/chan_utils.rs b/lightning/src/ln/chan_utils.rs index 2ccee7b2d52..b1171f54398 100644 --- a/lightning/src/ln/chan_utils.rs +++ b/lightning/src/ln/chan_utils.rs @@ -843,6 +843,7 @@ impl PartialEq for CommitmentTransaction { } } +/// (C-not exported) as users never need to call this directly impl Writeable for Vec { #[inline] fn write(&self, w: &mut W) -> Result<(), ::std::io::Error> { @@ -854,6 +855,7 @@ impl Writeable for Vec { } } +/// (C-not exported) as users never need to call this directly impl Readable for Vec { #[inline] fn read(r: &mut R) -> Result { diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index f73a9a501bf..32084fad581 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -45,6 +45,7 @@ pub struct RouteHop { pub cltv_expiry_delta: u32, } +/// (C-not exported) impl Writeable for Vec { fn write(&self, writer: &mut W) -> Result<(), ::std::io::Error> { (self.len() as u8).write(writer)?; @@ -60,6 +61,7 @@ impl Writeable for Vec { } } +/// (C-not exported) impl Readable for Vec { fn read(reader: &mut R) -> Result, DecodeError> { let hops_count: u8 = Readable::read(reader)?; From 53f2e25a96e59a32baf14f821f16360d7bb6461f Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 30 Dec 2020 22:09:26 -0500 Subject: [PATCH 07/13] [bindings] Use new non-null annotation feature in cbindgen This adds a new annotation for objects we take by reference in the C header indicating the pointers must not be null. We have to disable some warning clang now dumps that we haven't annotated all pointers, as cbindgen is not yet able to add a nullable annotation. --- c-bindings-gen/src/main.rs | 16 ++++++++++++---- genbindings.sh | 16 +++++++++------- lightning-c-bindings/cbindgen.toml | 3 +++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 4cd3ff557cd..90937bfa0e5 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -1556,10 +1556,18 @@ fn main() { let mut cpp_header_file = std::fs::OpenOptions::new().write(true).create(true).truncate(true) .open(&args[6]).expect("Unable to open new header file"); - writeln!(header_file, "#if defined(__GNUC__)\n#define MUST_USE_STRUCT __attribute__((warn_unused))").unwrap(); - writeln!(header_file, "#else\n#define MUST_USE_STRUCT\n#endif").unwrap(); - writeln!(header_file, "#if defined(__GNUC__)\n#define MUST_USE_RES __attribute__((warn_unused_result))").unwrap(); - writeln!(header_file, "#else\n#define MUST_USE_RES\n#endif").unwrap(); + writeln!(header_file, "#if defined(__GNUC__)").unwrap(); + writeln!(header_file, "#define MUST_USE_STRUCT __attribute__((warn_unused))").unwrap(); + writeln!(header_file, "#define MUST_USE_RES __attribute__((warn_unused_result))").unwrap(); + writeln!(header_file, "#else").unwrap(); + writeln!(header_file, "#define MUST_USE_STRUCT").unwrap(); + writeln!(header_file, "#define MUST_USE_RES").unwrap(); + writeln!(header_file, "#endif").unwrap(); + writeln!(header_file, "#if defined(__clang__)").unwrap(); + writeln!(header_file, "#define NONNULL_PTR _Nonnull").unwrap(); + writeln!(header_file, "#else").unwrap(); + writeln!(header_file, "#define NONNULL_PTR").unwrap(); + writeln!(header_file, "#endif").unwrap(); writeln!(cpp_header_file, "#include \nnamespace LDK {{").unwrap(); // First parse the full crate's ASTs, caching them so that we can hold references to the AST diff --git a/genbindings.sh b/genbindings.sh index 007f69e99da..c63de7dbc05 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -60,9 +60,11 @@ else echo "WARNING: Please install valgrind for more testing" fi +CLANGOPTS="-Wall -Wno-nullability-completeness -pthread" + # Test a statically-linked C++ version, tracking the resulting binary size and runtime # across debug, LTO, and cross-language LTO builds (using the same compiler each time). -clang++ -std=c++11 -Wall -pthread demo.cpp target/debug/libldk.a -ldl +clang++ $CLANGOPTS demo.cpp target/debug/libldk.a -ldl strip ./a.out echo " C++ Bin size and runtime w/o optimization:" ls -lha a.out @@ -83,11 +85,11 @@ if [ "$HOST_PLATFORM" = "host: x86_64-unknown-linux-gnu" ]; then set +e # First the C demo app... - clang-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.c target/debug/libldk.a -ldl + clang-$LLVM_V $CLANGOPTS -fsanitize=memory -fsanitize-memory-track-origins -g demo.c target/debug/libldk.a -ldl ./a.out # ...then the C++ demo app - clang++-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.cpp target/debug/libldk.a -ldl + clang++-$LLVM_V -std=c++11 $CLANGOPTS -fsanitize=memory -fsanitize-memory-track-origins -g demo.cpp target/debug/libldk.a -ldl ./a.out >/dev/null # restore exit-on-failure @@ -153,11 +155,11 @@ if [ "$HOST_PLATFORM" = "host: x86_64-unknown-linux-gnu" -o "$HOST_PLATFORM" = " mv Cargo.toml.bk Cargo.toml # First the C demo app... - $CLANG -fsanitize=address -Wall -g -pthread demo.c target/debug/libldk.a -ldl + $CLANG $CLANGOPTS -fsanitize=address -g demo.c target/debug/libldk.a -ldl ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' ./a.out # ...then the C++ demo app - $CLANGPP -std=c++11 -fsanitize=address -Wall -g -pthread demo.cpp target/debug/libldk.a -ldl + $CLANGPP $CLANGOPTS -std=c++11 -fsanitize=address -g demo.cpp target/debug/libldk.a -ldl ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' ./a.out >/dev/null else echo "WARNING: Please install clang-$RUSTC_LLVM_V and clang++-$RUSTC_LLVM_V to build with address sanitizer" @@ -168,7 +170,7 @@ fi # Now build with LTO on on both C++ and rust, but without cross-language LTO: CARGO_PROFILE_RELEASE_LTO=true cargo rustc -v --release -- -C lto -clang++ -std=c++11 -Wall -flto -O2 -pthread demo.cpp target/release/libldk.a -ldl +clang++ $CLANGOPTS -std=c++11 -flto -O2 demo.cpp target/release/libldk.a -ldl strip ./a.out echo "C++ Bin size and runtime with only RL (LTO) optimized:" ls -lha a.out @@ -181,7 +183,7 @@ if [ "$HOST_PLATFORM" != "host: x86_64-apple-darwin" -a "$CLANGPP" != "" ]; then # packaging than simply shipping the rustup binaries (eg Debian should Just Work # here). CARGO_PROFILE_RELEASE_LTO=true cargo rustc -v --release -- -C linker-plugin-lto -C lto -C link-arg=-fuse-ld=lld - $CLANGPP -Wall -std=c++11 -flto -fuse-ld=lld -O2 -pthread demo.cpp target/release/libldk.a -ldl + $CLANGPP $CLANGOPTS -flto -fuse-ld=lld -O2 demo.cpp target/release/libldk.a -ldl strip ./a.out echo "C++ Bin size and runtime with cross-language LTO:" ls -lha a.out diff --git a/lightning-c-bindings/cbindgen.toml b/lightning-c-bindings/cbindgen.toml index 48267780f31..9480b8688c7 100644 --- a/lightning-c-bindings/cbindgen.toml +++ b/lightning-c-bindings/cbindgen.toml @@ -550,3 +550,6 @@ default_features = true # # default: [] features = ["cbindgen"] + +[ptr] +non_null_attribute = "NONNULL_PTR" From 1e06274765ce2c5614175baa355f6b67edefc14f Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 30 Dec 2020 23:27:36 -0500 Subject: [PATCH 08/13] [bindings] Use references in a few places instead of pointers Previously, references and pointers ended up identical in C, so there was little reason to differentiate. With the addition of nullability annotations, there is a (very slight) reason to prefer references, so use them in a few places where its a trivial change. --- c-bindings-gen/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 90937bfa0e5..9a329eeab6a 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -38,7 +38,7 @@ fn convert_macro(w: &mut W, macro_path: &syn::Path, stream: & if let Some(s) = types.maybe_resolve_ident(&struct_for) { if !types.crate_types.opaques.get(&s).is_some() { return; } writeln!(w, "#[no_mangle]").unwrap(); - writeln!(w, "pub extern \"C\" fn {}_write(obj: *const {}) -> crate::c_types::derived::CVec_u8Z {{", struct_for, struct_for).unwrap(); + writeln!(w, "pub extern \"C\" fn {}_write(obj: &{}) -> crate::c_types::derived::CVec_u8Z {{", struct_for, struct_for).unwrap(); writeln!(w, "\tcrate::c_types::serialize_obj(unsafe {{ &(*(*obj).inner) }})").unwrap(); writeln!(w, "}}").unwrap(); writeln!(w, "#[no_mangle]").unwrap(); @@ -83,7 +83,7 @@ fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path match &t as &str { "util::ser::Writeable" => { writeln!(w, "#[no_mangle]").unwrap(); - writeln!(w, "pub extern \"C\" fn {}_write(obj: *const {}) -> crate::c_types::derived::CVec_u8Z {{", for_obj, full_obj_path).unwrap(); + writeln!(w, "pub extern \"C\" fn {}_write(obj: &{}) -> crate::c_types::derived::CVec_u8Z {{", for_obj, full_obj_path).unwrap(); let ref_type = syn::Type::Reference(syn::TypeReference { and_token: syn::Token!(&)(Span::call_site()), lifetime: None, mutability: None, @@ -791,7 +791,7 @@ fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut Typ writeln!(w, "\t\tret.free = Some({}_free_void);", ident).unwrap(); writeln!(w, "\t\tret\n\t}}\n}}").unwrap(); - write!(w, "#[no_mangle]\npub extern \"C\" fn {}_as_{}(this_arg: *const {}) -> crate::{} {{\n", ident, trait_obj.ident, ident, full_trait_path).unwrap(); + write!(w, "#[no_mangle]\npub extern \"C\" fn {}_as_{}(this_arg: &{}) -> crate::{} {{\n", ident, trait_obj.ident, ident, full_trait_path).unwrap(); writeln!(w, "\tcrate::{} {{", full_trait_path).unwrap(); writeln!(w, "\t\tthis_arg: unsafe {{ (*this_arg).inner as *mut c_void }},").unwrap(); writeln!(w, "\t\tfree: None,").unwrap(); From e57c225e0f1822809879da01e79e6157cc0996f7 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 31 Dec 2020 15:34:50 -0500 Subject: [PATCH 09/13] [C++ bindings] Add move-assign operator, require rvalue for move This adds a move-assignment operator (`A& operator=(A&& o)`) to our C++ wrapper classes as well as requiring an rvalue for the move auto-convert operator (`operator CStruct()() &&`). The second makes the C++ wrapper classes much easier to work with by requiring an explicit `std::move` when the bindings will automatically move a C++-wrapper object into a C object. --- c-bindings-gen/src/blocks.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/c-bindings-gen/src/blocks.rs b/c-bindings-gen/src/blocks.rs index 6ba829537ad..107c72b3db4 100644 --- a/c-bindings-gen/src/blocks.rs +++ b/c-bindings-gen/src/blocks.rs @@ -16,12 +16,15 @@ pub fn write_cpp_wrapper(cpp_header_file: &mut File, ty: &str, has_destructor: b writeln!(cpp_header_file, "\tLDK{} self;", ty).unwrap(); writeln!(cpp_header_file, "public:").unwrap(); writeln!(cpp_header_file, "\t{}(const {}&) = delete;", ty, ty).unwrap(); + writeln!(cpp_header_file, "\t{}({}&& o) : self(o.self) {{ memset(&o, 0, sizeof({})); }}", ty, ty, ty).unwrap(); + writeln!(cpp_header_file, "\t{}(LDK{}&& m_self) : self(m_self) {{ memset(&m_self, 0, sizeof(LDK{})); }}", ty, ty, ty).unwrap(); + writeln!(cpp_header_file, "\toperator LDK{}() && {{ LDK{} res = self; memset(&self, 0, sizeof(LDK{})); return res; }}", ty, ty, ty).unwrap(); if has_destructor { writeln!(cpp_header_file, "\t~{}() {{ {}_free(self); }}", ty, ty).unwrap(); + writeln!(cpp_header_file, "\t{}& operator=({}&& o) {{ {}_free(self); self = o.self; memset(&o, 0, sizeof({})); return *this; }}", ty, ty, ty, ty).unwrap(); + } else { + writeln!(cpp_header_file, "\t{}& operator=({}&& o) {{ self = o.self; memset(&o, 0, sizeof({})); return *this; }}", ty, ty, ty).unwrap(); } - writeln!(cpp_header_file, "\t{}({}&& o) : self(o.self) {{ memset(&o, 0, sizeof({})); }}", ty, ty, ty).unwrap(); - writeln!(cpp_header_file, "\t{}(LDK{}&& m_self) : self(m_self) {{ memset(&m_self, 0, sizeof(LDK{})); }}", ty, ty, ty).unwrap(); - writeln!(cpp_header_file, "\toperator LDK{}() {{ LDK{} res = self; memset(&self, 0, sizeof(LDK{})); return res; }}", ty, ty, ty).unwrap(); writeln!(cpp_header_file, "\tLDK{}* operator &() {{ return &self; }}", ty).unwrap(); writeln!(cpp_header_file, "\tLDK{}* operator ->() {{ return &self; }}", ty).unwrap(); writeln!(cpp_header_file, "\tconst LDK{}* operator &() const {{ return &self; }}", ty).unwrap(); From 64aa8baf988382bd9612660112a35822f6577a72 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 4 Jan 2021 14:23:16 -0500 Subject: [PATCH 10/13] Auto-generated bindings updates --- lightning-c-bindings/include/lightning.h | 4386 +++++++++-------- lightning-c-bindings/include/lightningpp.hpp | 1669 ++++--- lightning-c-bindings/include/rust_types.h | 8 +- lightning-c-bindings/src/c_types/derived.rs | 291 ++ .../src/chain/chainmonitor.rs | 4 +- .../src/chain/channelmonitor.rs | 31 +- .../src/chain/keysinterface.rs | 28 +- lightning-c-bindings/src/chain/transaction.rs | 2 +- lightning-c-bindings/src/ln/chan_utils.rs | 16 +- lightning-c-bindings/src/ln/channelmanager.rs | 21 +- lightning-c-bindings/src/ln/msgs.rs | 228 +- .../src/routing/network_graph.rs | 64 +- lightning-c-bindings/src/routing/router.rs | 14 +- lightning-c-bindings/src/util/config.rs | 2 +- lightning-c-bindings/src/util/events.rs | 4 + 15 files changed, 4062 insertions(+), 2706 deletions(-) diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index ca86c4a91bc..4a1e2255d06 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -324,6 +324,24 @@ typedef struct LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut typedef struct LDKCVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_u32TxOutZZ; +typedef struct LDKPublicKey { + uint8_t compressed_form[33]; +} LDKPublicKey; + + + +/** + * One counterparty's public keys which do not change over the life of a channel. + */ +typedef struct MUST_USE_STRUCT LDKChannelPublicKeys { + /** + * 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. + */ + LDKnativeChannelPublicKeys *inner; + bool is_owned; +} LDKChannelPublicKeys; + typedef struct LDKC2TupleTempl_u64__u64 { uint64_t a; uint64_t b; @@ -345,10 +363,6 @@ typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature { struct LDKCVecTempl_Signature b; } LDKC2TupleTempl_Signature__CVecTempl_Signature; -typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature LDKC2Tuple_SignatureCVec_SignatureZZ; - -typedef struct LDKCVecTempl_Signature LDKCVec_SignatureZ; - typedef union LDKCResultPtr_C2TupleTempl_Signature__CVecTempl_Signature________u8 { struct LDKC2TupleTempl_Signature__CVecTempl_Signature *result; uint8_t *err; @@ -361,895 +375,1436 @@ typedef struct LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature______ typedef struct LDKCResultTempl_C2TupleTempl_Signature__CVecTempl_Signature________u8 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ; -typedef union LDKCResultPtr_Signature__u8 { - struct LDKSignature *result; - uint8_t *err; -} LDKCResultPtr_Signature__u8; - -typedef struct LDKCResultTempl_Signature__u8 { - union LDKCResultPtr_Signature__u8 contents; - bool result_ok; -} LDKCResultTempl_Signature__u8; - -typedef struct LDKCResultTempl_Signature__u8 LDKCResult_SignatureNoneZ; -/** - * A Rust str object, ie a reference to a UTF8-valid string. - * This is *not* null-terminated so cannot be used directly as a C string! - */ -typedef struct LDKStr { - const uint8_t *chars; - uintptr_t len; -} LDKStr; /** - * Indicates an error on the client's part (usually some variant of attempting to use too-low or - * too-high values) + * This class tracks the per-transaction information needed to build a commitment transaction and to + * actually build it and sign. It is used for holder transactions that we sign only when needed + * and for transactions we sign for the counterparty. + * + * This class can be used inside a signer implementation to generate a signature given the relevant + * secret key. */ -typedef enum LDKAPIError_Tag { - /** - * Indicates the API was wholly misused (see err for more). Cases where these can be returned - * are documented, but generally indicates some precondition of a function was violated. - */ - LDKAPIError_APIMisuseError, - /** - * Due to a high feerate, we were unable to complete the request. - * For example, this may be returned if the feerate implies we cannot open a channel at the - * requested value, but opening a larger channel would succeed. - */ - LDKAPIError_FeeRateTooHigh, - /** - * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, - * too-many-hops, etc). - */ - LDKAPIError_RouteError, - /** - * We were unable to complete the request as the Channel required to do so is unable to - * complete the request (or was not found). This can take many forms, including disconnected - * peer, channel at capacity, channel shutting down, etc. - */ - LDKAPIError_ChannelUnavailable, - /** - * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the - * attempted action to fail. - */ - LDKAPIError_MonitorUpdateFailed, +typedef struct MUST_USE_STRUCT LDKCommitmentTransaction { /** - * Must be last for serialization purposes + * 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. */ - LDKAPIError_Sentinel, -} LDKAPIError_Tag; - -typedef struct LDKAPIError_LDKAPIMisuseError_Body { - LDKCVec_u8Z err; -} LDKAPIError_LDKAPIMisuseError_Body; - -typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { - LDKCVec_u8Z err; - uint32_t feerate; -} LDKAPIError_LDKFeeRateTooHigh_Body; - -typedef struct LDKAPIError_LDKRouteError_Body { - struct LDKStr err; -} LDKAPIError_LDKRouteError_Body; - -typedef struct LDKAPIError_LDKChannelUnavailable_Body { - LDKCVec_u8Z err; -} LDKAPIError_LDKChannelUnavailable_Body; - -typedef struct MUST_USE_STRUCT LDKAPIError { - LDKAPIError_Tag tag; - union { - LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; - LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; - LDKAPIError_LDKRouteError_Body route_error; - LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; - }; -} LDKAPIError; - -typedef union LDKCResultPtr_u8__APIError { - uint8_t *result; - struct LDKAPIError *err; -} LDKCResultPtr_u8__APIError; - -typedef struct LDKCResultTempl_u8__APIError { - union LDKCResultPtr_u8__APIError contents; - bool result_ok; -} LDKCResultTempl_u8__APIError; - -typedef struct LDKCResultTempl_u8__APIError LDKCResult_NoneAPIErrorZ; + LDKnativeCommitmentTransaction *inner; + bool is_owned; +} LDKCommitmentTransaction; /** - * If a payment fails to send, it can be in one of several states. This enum is returned as the - * Err() type describing which state the payment is in, see the description of individual enum - * states for more. + * Information needed to build and sign a holder's commitment transaction. + * + * The transaction is only signed once we are ready to broadcast. */ -typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { +typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction { /** * 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. */ - LDKnativePaymentSendFailure *inner; + LDKnativeHolderCommitmentTransaction *inner; bool is_owned; -} LDKPaymentSendFailure; +} LDKHolderCommitmentTransaction; -typedef union LDKCResultPtr_u8__PaymentSendFailure { - uint8_t *result; - struct LDKPaymentSendFailure *err; -} LDKCResultPtr_u8__PaymentSendFailure; +typedef union LDKCResultPtr_Signature__u8 { + struct LDKSignature *result; + uint8_t *err; +} LDKCResultPtr_Signature__u8; -typedef struct LDKCResultTempl_u8__PaymentSendFailure { - union LDKCResultPtr_u8__PaymentSendFailure contents; +typedef struct LDKCResultTempl_Signature__u8 { + union LDKCResultPtr_Signature__u8 contents; bool result_ok; -} LDKCResultTempl_u8__PaymentSendFailure; +} LDKCResultTempl_Signature__u8; -typedef struct LDKCResultTempl_u8__PaymentSendFailure LDKCResult_NonePaymentSendFailureZ; +typedef struct LDKCResultTempl_Signature__u8 LDKCResult_SignatureNoneZ; /** - * A channel_announcement message to be sent or received from a peer + * Information about an HTLC as it appears in a commitment transaction */ -typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { +typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment { /** * 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. */ - LDKnativeChannelAnnouncement *inner; + LDKnativeHTLCOutputInCommitment *inner; bool is_owned; -} LDKChannelAnnouncement; +} LDKHTLCOutputInCommitment; /** - * A channel_update message to be sent or received from a peer + * The unsigned part of a channel_announcement */ -typedef struct MUST_USE_STRUCT LDKChannelUpdate { +typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { /** * 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. */ - LDKnativeChannelUpdate *inner; + LDKnativeUnsignedChannelAnnouncement *inner; bool is_owned; -} LDKChannelUpdate; - -typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate { - struct LDKChannelAnnouncement a; - struct LDKChannelUpdate b; - struct LDKChannelUpdate c; -} LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate; - -typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; +} LDKUnsignedChannelAnnouncement; /** - * An Err type for failure to process messages. + * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction). + * The fields are organized by holder/counterparty. + * + * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters + * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions. */ -typedef struct MUST_USE_STRUCT LDKLightningError { +typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters { /** * 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. */ - LDKnativeLightningError *inner; + LDKnativeChannelTransactionParameters *inner; bool is_owned; -} LDKLightningError; - -typedef union LDKCResultPtr_u8__LightningError { - uint8_t *result; - struct LDKLightningError *err; -} LDKCResultPtr_u8__LightningError; - -typedef struct LDKCResultTempl_u8__LightningError { - union LDKCResultPtr_u8__LightningError contents; - bool result_ok; -} LDKCResultTempl_u8__LightningError; - -typedef struct LDKCResultTempl_u8__LightningError LDKCResult_NoneLightningErrorZ; - - +} LDKChannelTransactionParameters; /** - * Error for PeerManager errors. If you get one of these, you must disconnect the socket and - * generate no further read_event/write_buffer_space_avail calls for the descriptor, only - * triggering a single socket_disconnected call (unless it was provided in response to a - * new_*_connection event, in which case no such socket_disconnected() must be called and the - * socket silently disconencted). + * Set of lightning keys needed to operate a channel as described in BOLT 3. + * + * Signing services could be implemented on a hardware wallet. In this case, + * the current ChannelKeys would be a front-end on top of a communication + * channel connected to your secure device and lightning key material wouldn't + * reside on a hot server. Nevertheless, a this deployment would still need + * to trust the ChannelManager to avoid loss of funds as this latest component + * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys. + * + * A more secure iteration would be to use hashlock (or payment points) to pair + * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager + * at the price of more state and computation on the hardware wallet side. In the future, + * we are looking forward to design such interface. + * + * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted + * to act, as liveness and breach reply correctness are always going to be hard requirements + * of LN security model, orthogonal of key management issues. + * + * If you're implementing a custom signer, you almost certainly want to implement + * Readable/Writable to serialize out a unique reference to this set of keys so + * that you can serialize the full ChannelManager object. + * */ -typedef struct MUST_USE_STRUCT LDKPeerHandleError { +typedef struct LDKChannelKeys { + void *this_arg; /** - * 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. + * Gets the per-commitment point for a specific commitment number + * + * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. */ - LDKnativePeerHandleError *inner; - bool is_owned; -} LDKPeerHandleError; - -typedef union LDKCResultPtr_u8__PeerHandleError { - uint8_t *result; - struct LDKPeerHandleError *err; -} LDKCResultPtr_u8__PeerHandleError; - -typedef struct LDKCResultTempl_u8__PeerHandleError { - union LDKCResultPtr_u8__PeerHandleError contents; - bool result_ok; -} LDKCResultTempl_u8__PeerHandleError; - -typedef struct LDKCResultTempl_u8__PeerHandleError LDKCResult_NonePeerHandleErrorZ; - - - + struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx); + /** + * Gets the commitment secret for a specific commitment number as part of the revocation process + * + * An external signer implementation should error here if the commitment was already signed + * and should refuse to sign it in the future. + * + * May be called more than once for the same index. + * + * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. + * TODO: return a Result so we can signal a validation error + */ + struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx); + /** + * Gets the holder's channel public keys and basepoints + */ + struct LDKChannelPublicKeys pubkeys; + /** + * Fill in the pubkeys field as a reference to it will be given to Rust after this returns + * Note that this takes a pointer to this object, not the this_ptr like other methods do + * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating. + */ + void (*set_pubkeys)(const struct LDKChannelKeys*NONNULL_PTR ); + /** + * Gets arbitrary identifiers describing the set of keys which are provided back to you in + * some SpendableOutputDescriptor types. These should be sufficient to identify this + * ChannelKeys object uniquely and lookup or re-derive its keys. + */ + LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg); + /** + * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. + * + * Note that if signing fails or is rejected, the channel will be force-closed. + */ + LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx); + /** + * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions. + * This will only ever be called with a non-revoked commitment_tx. This will be called with the + * latest commitment_tx when we initiate a force-close. + * This will be called with the previous latest, just to get claiming HTLC signatures, if we are + * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to + * the latest. + * This may be called multiple times for the same transaction. + * + * An external signer implementation should check that the commitment has not been revoked. + * + * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case. + */ + LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); + /** + * Create a signature for the given input in a transaction spending an HTLC or commitment + * transaction output when our counterparty broadcasts an old state. + * + * A justice transaction may claim multiples outputs at the same time if timelocks are + * similar, but only a signature for the input at index `input` should be signed for here. + * It may be called multiples time for same output(s) if a fee-bump is needed with regards + * to an upcoming timelock expiration. + * + * Amount is value of the output spent by this input, committed to in the BIP 143 signature. + * + * per_commitment_key is revocation secret which was provided by our counterparty when they + * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does + * not allow the spending of any funds by itself (you need our holder revocation_secret to do + * so). + * + * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus + * changing the format of the witness script (which is committed to in the BIP 143 + * signatures). + */ + LDKCResult_SignatureNoneZ (*sign_justice_transaction)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); + /** + * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment + * transaction, either offered or received. + * + * Such a transaction may claim multiples offered outputs at same time if we know the + * preimage for each when we create it, but only the input at index `input` should be + * signed for here. It may be called multiple times for same output(s) if a fee-bump is + * needed with regards to an upcoming timelock expiration. + * + * Witness_script is either a offered or received script as defined in BOLT3 for HTLC + * outputs. + * + * Amount is value of the output spent by this input, committed to in the BIP 143 signature. + * + * Per_commitment_point is the dynamic point corresponding to the channel state + * detected onchain. It has been generated by our counterparty and is used to derive + * channel state keys, which are then included in the witness script and committed to in the + * BIP 143 signature. + */ + LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); + /** + * Create a signature for a (proposed) closing transaction. + * + * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have + * chosen to forgo their output as dust. + */ + LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx); + /** + * Signs a channel announcement message with our funding key, proving it comes from one + * of the channel participants. + * + * Note that if this fails or is rejected, the channel will not be publicly announced and + * our counterparty may (though likely will not) close the channel on us for violating the + * protocol. + */ + LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); + /** + * Set the counterparty static channel data, including basepoints, + * counterparty_selected/holder_selected_contest_delay and funding outpoint. + * This is done as soon as the funding outpoint is known. Since these are static channel data, + * they MUST NOT be allowed to change to different values once set. + * + * channel_parameters.is_populated() MUST be true. + * + * We bind holder_selected_contest_delay late here for API convenience. + * + * Will be called before any signatures are applied. + */ + void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters); + void *(*clone)(const void *this_arg); + LDKCVec_u8Z (*write)(const void *this_arg); + void (*free)(void *this_arg); +} LDKChannelKeys; + + + /** - * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin - * transaction and the transaction creation keys) are trusted. + * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates + * on-chain transactions to ensure no loss of funds occurs. * - * See trust() and verify() functions on CommitmentTransaction. + * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date + * information and are actively monitoring the chain. * - * This structure implements Deref. + * Pending Events or updated HTLCs which have not yet been read out by + * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and + * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events + * gotten are fully handled before re-serializing the new state. + * + * Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which + * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along + * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the + * returned block hash and the the current chain and then reconnecting blocks to get to the + * best chain) upon deserializing the object! */ -typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction { +typedef struct MUST_USE_STRUCT LDKChannelMonitor { /** * 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. */ - LDKnativeTrustedCommitmentTransaction *inner; + LDKnativeChannelMonitor *inner; bool is_owned; -} LDKTrustedCommitmentTransaction; - -typedef union LDKCResultPtr_TrustedCommitmentTransaction__u8 { - struct LDKTrustedCommitmentTransaction *result; - uint8_t *err; -} LDKCResultPtr_TrustedCommitmentTransaction__u8; - -typedef struct LDKCResultTempl_TrustedCommitmentTransaction__u8 { - union LDKCResultPtr_TrustedCommitmentTransaction__u8 contents; - bool result_ok; -} LDKCResultTempl_TrustedCommitmentTransaction__u8; +} LDKChannelMonitor; -typedef struct LDKCResultTempl_TrustedCommitmentTransaction__u8 LDKCResult_TrustedCommitmentTransactionNoneZ; +typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor { + struct LDKThirtyTwoBytes a; + struct LDKChannelMonitor b; +} LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor; -typedef union LDKCResultPtr_CVecTempl_Signature_____u8 { - struct LDKCVecTempl_Signature *result; - uint8_t *err; -} LDKCResultPtr_CVecTempl_Signature_____u8; +typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor LDKC2Tuple_BlockHashChannelMonitorZ; -typedef struct LDKCResultTempl_CVecTempl_Signature_____u8 { - union LDKCResultPtr_CVecTempl_Signature_____u8 contents; - bool result_ok; -} LDKCResultTempl_CVecTempl_Signature_____u8; +typedef struct LDKC2TupleTempl_Signature__CVecTempl_Signature LDKC2Tuple_SignatureCVec_SignatureZZ; -typedef struct LDKCResultTempl_CVecTempl_Signature_____u8 LDKCResult_CVec_SignatureZNoneZ; +typedef struct LDKCVecTempl_Signature LDKCVec_SignatureZ; -typedef struct LDKPublicKey { - uint8_t compressed_form[33]; -} LDKPublicKey; +/** + * A Rust str object, ie a reference to a UTF8-valid string. + * This is *not* null-terminated so cannot be used directly as a C string! + */ +typedef struct LDKStr { + const uint8_t *chars; + uintptr_t len; +} LDKStr; /** - * When on-chain outputs are created by rust-lightning (which our counterparty is not able to - * claim at any point in the future) an event is generated which you must track and be able to - * spend on-chain. The information needed to do this is provided in this enum, including the - * outpoint describing which txid and output index is available, the full output which exists at - * that txid/index, and any keys or other information required to sign. + * Indicates an error on the client's part (usually some variant of attempting to use too-low or + * too-high values) */ -typedef enum LDKSpendableOutputDescriptor_Tag { +typedef enum LDKAPIError_Tag { /** - * An output to a script which was provided via KeysInterface, thus you should already know - * how to spend it. No keys are provided as rust-lightning was never given any keys - only the - * script_pubkey as it appears in the output. - * These may include outputs from a transaction punishing our counterparty or claiming an HTLC - * on-chain using the payment preimage or after it has timed out. + * Indicates the API was wholly misused (see err for more). Cases where these can be returned + * are documented, but generally indicates some precondition of a function was violated. */ - LDKSpendableOutputDescriptor_StaticOutput, + LDKAPIError_APIMisuseError, /** - * An output to a P2WSH script which can be spent with a single signature after a CSV delay. - * - * The witness in the spending input should be: - * (MINIMALIF standard rule) - * - * Note that the nSequence field in the spending input must be set to to_self_delay - * (which means the transaction is not broadcastable until at least to_self_delay - * blocks after the outpoint confirms). - * - * These are generally the result of a \"revocable\" output to us, spendable only by us unless - * it is an output from an old state which we broadcast (which should never happen). - * - * To derive the delayed_payment key which is used to sign for this input, you must pass the - * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in - * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to - * chan_utils::derive_private_key. The public key can be generated without the secret key - * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in - * ChannelKeys::pubkeys(). - * - * To derive the revocation_pubkey provided here (which is used in the witness - * script generation), you must pass the counterparty revocation_basepoint (which appears in the - * call to ChannelKeys::ready_channel) and the provided per_commitment point - * to chan_utils::derive_public_revocation_key. - * - * The witness script which is hashed and included in the output script_pubkey may be - * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey - * (derived as above), and the to_self_delay contained here to - * chan_utils::get_revokeable_redeemscript. + * Due to a high feerate, we were unable to complete the request. + * For example, this may be returned if the feerate implies we cannot open a channel at the + * requested value, but opening a larger channel would succeed. */ - LDKSpendableOutputDescriptor_DynamicOutputP2WSH, + LDKAPIError_FeeRateTooHigh, /** - * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which - * corresponds to the public key in ChannelKeys::pubkeys().payment_point). - * The witness in the spending input, is, thus, simply: - * - * - * These are generally the result of our counterparty having broadcast the current state, - * allowing us to claim the non-HTLC-encumbered outputs immediately. + * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, + * too-many-hops, etc). */ - LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment, + LDKAPIError_RouteError, + /** + * We were unable to complete the request as the Channel required to do so is unable to + * complete the request (or was not found). This can take many forms, including disconnected + * peer, channel at capacity, channel shutting down, etc. + */ + LDKAPIError_ChannelUnavailable, + /** + * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the + * attempted action to fail. + */ + LDKAPIError_MonitorUpdateFailed, /** * Must be last for serialization purposes */ - LDKSpendableOutputDescriptor_Sentinel, -} LDKSpendableOutputDescriptor_Tag; + LDKAPIError_Sentinel, +} LDKAPIError_Tag; -typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body { - struct LDKOutPoint outpoint; - struct LDKTxOut output; -} LDKSpendableOutputDescriptor_LDKStaticOutput_Body; - -typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body { - struct LDKOutPoint outpoint; - struct LDKPublicKey per_commitment_point; - uint16_t to_self_delay; - struct LDKTxOut output; - LDKC2Tuple_u64u64Z key_derivation_params; - struct LDKPublicKey revocation_pubkey; -} LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body; - -typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body { - struct LDKOutPoint outpoint; - struct LDKTxOut output; - LDKC2Tuple_u64u64Z key_derivation_params; -} LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body; - -typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor { - LDKSpendableOutputDescriptor_Tag tag; - union { - LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output; - LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh; - LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment; - }; -} LDKSpendableOutputDescriptor; - -typedef struct LDKCVecTempl_SpendableOutputDescriptor { - struct LDKSpendableOutputDescriptor *data; - uintptr_t datalen; -} LDKCVecTempl_SpendableOutputDescriptor; - -typedef struct LDKCVecTempl_SpendableOutputDescriptor LDKCVec_SpendableOutputDescriptorZ; - -/** - * An Event which you should probably take some action in response to. - * - * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use - * them directly as they don't round-trip exactly (for example FundingGenerationReady is never - * written as it makes no sense to respond to it after reconnecting to peers). - */ -typedef enum LDKEvent_Tag { - /** - * Used to indicate that the client should generate a funding transaction with the given - * parameters and then call ChannelManager::funding_transaction_generated. - * Generated in ChannelManager message handling. - * Note that *all inputs* in the funding transaction must spend SegWit outputs or your - * counterparty can steal your funds! - */ - LDKEvent_FundingGenerationReady, - /** - * Used to indicate that the client may now broadcast the funding transaction it created for a - * channel. Broadcasting such a transaction prior to this event may lead to our counterparty - * trivially stealing all funds in the funding transaction! - */ - LDKEvent_FundingBroadcastSafe, - /** - * Indicates we've received money! Just gotta dig out that payment preimage and feed it to - * ChannelManager::claim_funds to get it.... - * Note that if the preimage is not known or the amount paid is incorrect, you should call - * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid - * network congestion. - * The amount paid should be considered 'incorrect' when it is less than or more than twice - * the amount expected. - * If you fail to call either ChannelManager::claim_funds or - * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be - * automatically failed. - */ - LDKEvent_PaymentReceived, - /** - * Indicates an outbound payment we made succeeded (ie it made it all the way to its target - * and we got back the payment preimage for it). - * Note that duplicative PaymentSent Events may be generated - it is your responsibility to - * deduplicate them by payment_preimage (which MUST be unique)! - */ - LDKEvent_PaymentSent, - /** - * Indicates an outbound payment we made failed. Probably some intermediary node dropped - * something. You may wish to retry with a different route. - * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to - * deduplicate them by payment_hash (which MUST be unique)! - */ - LDKEvent_PaymentFailed, - /** - * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a - * time in the future. - */ - LDKEvent_PendingHTLCsForwardable, - /** - * Used to indicate that an output was generated on-chain which you should know how to spend. - * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your - * counterparty spending them due to some kind of timeout. Thus, you need to store them - * somewhere and spend them when you create on-chain transactions. - */ - LDKEvent_SpendableOutputs, - /** - * Must be last for serialization purposes - */ - LDKEvent_Sentinel, -} LDKEvent_Tag; - -typedef struct LDKEvent_LDKFundingGenerationReady_Body { - struct LDKThirtyTwoBytes temporary_channel_id; - uint64_t channel_value_satoshis; - LDKCVec_u8Z output_script; - uint64_t user_channel_id; -} LDKEvent_LDKFundingGenerationReady_Body; - -typedef struct LDKEvent_LDKFundingBroadcastSafe_Body { - struct LDKOutPoint funding_txo; - uint64_t user_channel_id; -} LDKEvent_LDKFundingBroadcastSafe_Body; - -typedef struct LDKEvent_LDKPaymentReceived_Body { - struct LDKThirtyTwoBytes payment_hash; - struct LDKThirtyTwoBytes payment_secret; - uint64_t amt; -} LDKEvent_LDKPaymentReceived_Body; - -typedef struct LDKEvent_LDKPaymentSent_Body { - struct LDKThirtyTwoBytes payment_preimage; -} LDKEvent_LDKPaymentSent_Body; +typedef struct LDKAPIError_LDKAPIMisuseError_Body { + LDKCVec_u8Z err; +} LDKAPIError_LDKAPIMisuseError_Body; -typedef struct LDKEvent_LDKPaymentFailed_Body { - struct LDKThirtyTwoBytes payment_hash; - bool rejected_by_dest; -} LDKEvent_LDKPaymentFailed_Body; +typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { + LDKCVec_u8Z err; + uint32_t feerate; +} LDKAPIError_LDKFeeRateTooHigh_Body; -typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { - uint64_t time_forwardable; -} LDKEvent_LDKPendingHTLCsForwardable_Body; +typedef struct LDKAPIError_LDKRouteError_Body { + struct LDKStr err; +} LDKAPIError_LDKRouteError_Body; -typedef struct LDKEvent_LDKSpendableOutputs_Body { - LDKCVec_SpendableOutputDescriptorZ outputs; -} LDKEvent_LDKSpendableOutputs_Body; +typedef struct LDKAPIError_LDKChannelUnavailable_Body { + LDKCVec_u8Z err; +} LDKAPIError_LDKChannelUnavailable_Body; -typedef struct MUST_USE_STRUCT LDKEvent { - LDKEvent_Tag tag; +typedef struct MUST_USE_STRUCT LDKAPIError { + LDKAPIError_Tag tag; union { - LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready; - LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe; - LDKEvent_LDKPaymentReceived_Body payment_received; - LDKEvent_LDKPaymentSent_Body payment_sent; - LDKEvent_LDKPaymentFailed_Body payment_failed; - LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable; - LDKEvent_LDKSpendableOutputs_Body spendable_outputs; + LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; + LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; + LDKAPIError_LDKRouteError_Body route_error; + LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; }; -} LDKEvent; +} LDKAPIError; +typedef union LDKCResultPtr_u8__APIError { + uint8_t *result; + struct LDKAPIError *err; +} LDKCResultPtr_u8__APIError; +typedef struct LDKCResultTempl_u8__APIError { + union LDKCResultPtr_u8__APIError contents; + bool result_ok; +} LDKCResultTempl_u8__APIError; -/** - * An accept_channel message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKAcceptChannel { - /** - * 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. - */ - LDKnativeAcceptChannel *inner; - bool is_owned; -} LDKAcceptChannel; +typedef struct LDKCResultTempl_u8__APIError LDKCResult_NoneAPIErrorZ; /** - * An open_channel message to be sent or received from a peer + * If a payment fails to send, it can be in one of several states. This enum is returned as the + * Err() type describing which state the payment is in, see the description of individual enum + * states for more. */ -typedef struct MUST_USE_STRUCT LDKOpenChannel { +typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { /** * 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. */ - LDKnativeOpenChannel *inner; + LDKnativePaymentSendFailure *inner; bool is_owned; -} LDKOpenChannel; +} LDKPaymentSendFailure; +typedef union LDKCResultPtr_u8__PaymentSendFailure { + uint8_t *result; + struct LDKPaymentSendFailure *err; +} LDKCResultPtr_u8__PaymentSendFailure; +typedef struct LDKCResultTempl_u8__PaymentSendFailure { + union LDKCResultPtr_u8__PaymentSendFailure contents; + bool result_ok; +} LDKCResultTempl_u8__PaymentSendFailure; -/** - * A funding_created message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKFundingCreated { - /** - * 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. - */ - LDKnativeFundingCreated *inner; - bool is_owned; -} LDKFundingCreated; +typedef struct LDKCResultTempl_u8__PaymentSendFailure LDKCResult_NonePaymentSendFailureZ; /** - * A funding_signed message to be sent or received from a peer + * An update generated by the underlying Channel itself which contains some new information the + * ChannelMonitor should be made aware of. */ -typedef struct MUST_USE_STRUCT LDKFundingSigned { +typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { /** * 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. */ - LDKnativeFundingSigned *inner; + LDKnativeChannelMonitorUpdate *inner; bool is_owned; -} LDKFundingSigned; +} LDKChannelMonitorUpdate; /** - * A funding_locked message to be sent or received from a peer + * An event to be processed by the ChannelManager. */ -typedef struct MUST_USE_STRUCT LDKFundingLocked { +typedef struct MUST_USE_STRUCT LDKMonitorEvent { /** * 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. */ - LDKnativeFundingLocked *inner; + LDKnativeMonitorEvent *inner; bool is_owned; -} LDKFundingLocked; +} LDKMonitorEvent; +typedef struct LDKCVecTempl_MonitorEvent { + struct LDKMonitorEvent *data; + uintptr_t datalen; +} LDKCVecTempl_MonitorEvent; +typedef struct LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ; /** - * An announcement_signatures message to be sent or received from a peer + * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as + * blocks are connected and disconnected. + * + * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are + * responsible for maintaining a set of monitors such that they can be updated accordingly as + * channel state changes and HTLCs are resolved. See method documentation for specific + * requirements. + * + * Implementations **must** ensure that updates are successfully applied and persisted upon method + * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down + * without taking any further action such as persisting the current state. + * + * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing + * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it + * could result in a revoked transaction being broadcast, allowing the counterparty to claim all + * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle + * multiple instances. + * + * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html + * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html + * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure */ -typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures { +typedef struct LDKWatch { + void *this_arg; /** - * 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. + * Watches a channel identified by `funding_txo` using `monitor`. + * + * Implementations are responsible for watching the chain for the funding transaction along + * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means + * calling [`block_connected`] and [`block_disconnected`] on the monitor. + * + * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch + * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected + * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected */ - LDKnativeAnnouncementSignatures *inner; - bool is_owned; -} LDKAnnouncementSignatures; + LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); + /** + * Updates a channel identified by `funding_txo` by applying `update` to its monitor. + * + * Implementations must call [`update_monitor`] with the given update. See + * [`ChannelMonitorUpdateErr`] for invariants around returning an error. + * + * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor + * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html + */ + LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update); + /** + * Returns any monitor events since the last call. Subsequent calls must only return new + * events. + */ + LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg); + void (*free)(void *this_arg); +} LDKWatch; + +/** + * An interface to send a transaction to the Bitcoin network. + */ +typedef struct LDKBroadcasterInterface { + void *this_arg; + /** + * Sends a transaction out to (hopefully) be mined. + */ + void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx); + void (*free)(void *this_arg); +} LDKBroadcasterInterface; + +typedef struct LDKSecretKey { + uint8_t bytes[32]; +} LDKSecretKey; /** - * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment - * transaction updates if they were pending. + * An error in decoding a message or struct. */ -typedef struct MUST_USE_STRUCT LDKCommitmentUpdate { +typedef struct MUST_USE_STRUCT LDKDecodeError { /** * 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. */ - LDKnativeCommitmentUpdate *inner; + LDKnativeDecodeError *inner; bool is_owned; -} LDKCommitmentUpdate; +} LDKDecodeError; + +typedef union LDKCResultPtr_ChannelKeys__DecodeError { + struct LDKChannelKeys *result; + struct LDKDecodeError *err; +} LDKCResultPtr_ChannelKeys__DecodeError; + +typedef struct LDKCResultTempl_ChannelKeys__DecodeError { + union LDKCResultPtr_ChannelKeys__DecodeError contents; + bool result_ok; +} LDKCResultTempl_ChannelKeys__DecodeError; +typedef struct LDKCResultTempl_ChannelKeys__DecodeError LDKCResult_ChanKeySignerDecodeErrorZ; +typedef struct LDKu8slice { + const uint8_t *data; + uintptr_t datalen; +} LDKu8slice; /** - * A revoke_and_ack message to be sent or received from a peer + * A trait to describe an object which can get user secrets and key material. */ -typedef struct MUST_USE_STRUCT LDKRevokeAndACK { +typedef struct LDKKeysInterface { + void *this_arg; /** - * 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. + * Get node secret key (aka node_id or network_key) */ - LDKnativeRevokeAndACK *inner; - bool is_owned; -} LDKRevokeAndACK; + struct LDKSecretKey (*get_node_secret)(const void *this_arg); + /** + * Get destination redeemScript to encumber static protocol exit points. + */ + LDKCVec_u8Z (*get_destination_script)(const void *this_arg); + /** + * Get shutdown_pubkey to use as PublicKey at channel closure + */ + struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg); + /** + * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you + * restarted with some stale data! + */ + struct LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis); + /** + * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting + * onion packets and for temporary channel IDs. There is no requirement that these be + * persisted anywhere, though they must be unique across restarts. + */ + struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); + /** + * Reads a `ChanKeySigner` for this `KeysInterface` from the given input stream. + * This is only called during deserialization of other objects which contain + * `ChannelKeys`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s). + * The bytes are exactly those which `::write()` writes, and + * contain no versioning scheme. You may wish to include your own version prefix and ensure + * you've read all of the provided bytes to ensure no corruption occurred. + */ + LDKCResult_ChanKeySignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); + void (*free)(void *this_arg); +} LDKKeysInterface; + +/** + * A trait which should be implemented to provide feerate information on a number of time + * horizons. + * + * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're + * called from inside the library in response to chain events, P2P events, or timer events). + */ +typedef struct LDKFeeEstimator { + void *this_arg; + /** + * Gets estimated satoshis of fee required per 1000 Weight-Units. + * + * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs + * don't put us below 1 satoshi-per-byte). + * + * This translates to: + * * satoshis-per-byte * 250 + * * ceil(satoshis-per-kbyte / 4) + */ + uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target); + void (*free)(void *this_arg); +} LDKFeeEstimator; + +/** + * A trait encapsulating the operations required of a logger + */ +typedef struct LDKLogger { + void *this_arg; + /** + * Logs the `Record` + */ + void (*log)(const void *this_arg, const char *record); + void (*free)(void *this_arg); +} LDKLogger; /** - * A closing_signed message to be sent or received from a peer + * Manager which keeps track of a number of channels and sends messages to the appropriate + * channel, also tracking HTLC preimages and forwarding onion packets appropriately. + * + * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through + * to individual Channels. + * + * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for + * all peers during write/read (though does not modify this instance, only the instance being + * serialized). This will result in any channels which have not yet exchanged funding_created (ie + * called funding_transaction_generated for outbound channels). + * + * Note that you can be a bit lazier about writing out ChannelManager than you can be with + * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before + * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates + * happens out-of-band (and will prevent any other ChannelManager operations from occurring during + * the serialization process). If the deserialized version is out-of-date compared to the + * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the + * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees). + * + * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which + * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along + * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call + * block_connected() to step towards your best block) upon deserialization before using the + * object! + * + * Note that ChannelManager is responsible for tracking liveness of its channels and generating + * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid + * spam due to quick disconnection/reconnection, updates are not sent until the channel has been + * offline for a full minute. In order to track this, you must call + * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect. + * + * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager + * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but + * essentially you should default to using a SimpleRefChannelManager, and use a + * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when + * you're using lightning-net-tokio. */ -typedef struct MUST_USE_STRUCT LDKClosingSigned { +typedef struct MUST_USE_STRUCT LDKChannelManager { /** * 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. */ - LDKnativeClosingSigned *inner; + LDKnativeChannelManager *inner; bool is_owned; -} LDKClosingSigned; +} LDKChannelManager; + +typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager { + struct LDKThirtyTwoBytes a; + struct LDKChannelManager b; +} LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager; + +typedef struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager LDKC2Tuple_BlockHashChannelManagerZ; /** - * A shutdown message to be sent or received from a peer + * A channel_announcement message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKShutdown { +typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { /** * 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. */ - LDKnativeShutdown *inner; + LDKnativeChannelAnnouncement *inner; bool is_owned; -} LDKShutdown; +} LDKChannelAnnouncement; /** - * A channel_reestablish message to be sent or received from a peer + * A channel_update message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKChannelReestablish { +typedef struct MUST_USE_STRUCT LDKChannelUpdate { /** * 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. */ - LDKnativeChannelReestablish *inner; + LDKnativeChannelUpdate *inner; bool is_owned; -} LDKChannelReestablish; +} LDKChannelUpdate; + +typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate { + struct LDKChannelAnnouncement a; + struct LDKChannelUpdate b; + struct LDKChannelUpdate c; +} LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate; + +typedef struct LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; /** - * A node_announcement message to be sent or received from a peer + * An Err type for failure to process messages. */ -typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { +typedef struct MUST_USE_STRUCT LDKLightningError { /** * 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. */ - LDKnativeNodeAnnouncement *inner; + LDKnativeLightningError *inner; bool is_owned; -} LDKNodeAnnouncement; +} LDKLightningError; + +typedef union LDKCResultPtr_u8__LightningError { + uint8_t *result; + struct LDKLightningError *err; +} LDKCResultPtr_u8__LightningError; + +typedef struct LDKCResultTempl_u8__LightningError { + union LDKCResultPtr_u8__LightningError contents; + bool result_ok; +} LDKCResultTempl_u8__LightningError; + +typedef struct LDKCResultTempl_u8__LightningError LDKCResult_NoneLightningErrorZ; /** - * An error message to be sent or received from a peer + * Error for PeerManager errors. If you get one of these, you must disconnect the socket and + * generate no further read_event/write_buffer_space_avail calls for the descriptor, only + * triggering a single socket_disconnected call (unless it was provided in response to a + * new_*_connection event, in which case no such socket_disconnected() must be called and the + * socket silently disconencted). */ -typedef struct MUST_USE_STRUCT LDKErrorMessage { +typedef struct MUST_USE_STRUCT LDKPeerHandleError { /** * 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. */ - LDKnativeErrorMessage *inner; + LDKnativePeerHandleError *inner; bool is_owned; -} LDKErrorMessage; +} LDKPeerHandleError; -/** - * Used to put an error message in a LightningError +typedef union LDKCResultPtr_u8__PeerHandleError { + uint8_t *result; + struct LDKPeerHandleError *err; +} LDKCResultPtr_u8__PeerHandleError; + +typedef struct LDKCResultTempl_u8__PeerHandleError { + union LDKCResultPtr_u8__PeerHandleError contents; + bool result_ok; +} LDKCResultTempl_u8__PeerHandleError; + +typedef struct LDKCResultTempl_u8__PeerHandleError LDKCResult_NonePeerHandleErrorZ; + + + +/** + * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin + * transaction and the transaction creation keys) are trusted. + * + * See trust() and verify() functions on CommitmentTransaction. + * + * This structure implements Deref. */ -typedef enum LDKErrorAction_Tag { - /** - * The peer took some action which made us think they were useless. Disconnect them. - */ - LDKErrorAction_DisconnectPeer, - /** - * The peer did something harmless that we weren't able to process, just log and ignore - */ - LDKErrorAction_IgnoreError, - /** - * The peer did something incorrect. Tell them. - */ - LDKErrorAction_SendErrorMessage, +typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction { /** - * Must be last for serialization purposes + * 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. */ - LDKErrorAction_Sentinel, -} LDKErrorAction_Tag; + LDKnativeTrustedCommitmentTransaction *inner; + bool is_owned; +} LDKTrustedCommitmentTransaction; -typedef struct LDKErrorAction_LDKDisconnectPeer_Body { - struct LDKErrorMessage msg; -} LDKErrorAction_LDKDisconnectPeer_Body; +typedef union LDKCResultPtr_TrustedCommitmentTransaction__u8 { + struct LDKTrustedCommitmentTransaction *result; + uint8_t *err; +} LDKCResultPtr_TrustedCommitmentTransaction__u8; -typedef struct LDKErrorAction_LDKSendErrorMessage_Body { - struct LDKErrorMessage msg; -} LDKErrorAction_LDKSendErrorMessage_Body; +typedef struct LDKCResultTempl_TrustedCommitmentTransaction__u8 { + union LDKCResultPtr_TrustedCommitmentTransaction__u8 contents; + bool result_ok; +} LDKCResultTempl_TrustedCommitmentTransaction__u8; -typedef struct MUST_USE_STRUCT LDKErrorAction { - LDKErrorAction_Tag tag; - union { - LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer; - LDKErrorAction_LDKSendErrorMessage_Body send_error_message; - }; -} LDKErrorAction; +typedef struct LDKCResultTempl_TrustedCommitmentTransaction__u8 LDKCResult_TrustedCommitmentTransactionNoneZ; + +typedef union LDKCResultPtr_CVecTempl_Signature_____u8 { + struct LDKCVecTempl_Signature *result; + uint8_t *err; +} LDKCResultPtr_CVecTempl_Signature_____u8; + +typedef struct LDKCResultTempl_CVecTempl_Signature_____u8 { + union LDKCResultPtr_CVecTempl_Signature_____u8 contents; + bool result_ok; +} LDKCResultTempl_CVecTempl_Signature_____u8; + +typedef struct LDKCResultTempl_CVecTempl_Signature_____u8 LDKCResult_CVec_SignatureZNoneZ; /** - * The information we received from a peer along the route of a payment we originated. This is - * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into - * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map. + * When on-chain outputs are created by rust-lightning (which our counterparty is not able to + * claim at any point in the future) an event is generated which you must track and be able to + * spend on-chain. The information needed to do this is provided in this enum, including the + * outpoint describing which txid and output index is available, the full output which exists at + * that txid/index, and any keys or other information required to sign. */ -typedef enum LDKHTLCFailChannelUpdate_Tag { +typedef enum LDKSpendableOutputDescriptor_Tag { /** - * We received an error which included a full ChannelUpdate message. + * An output to a script which was provided via KeysInterface, thus you should already know + * how to spend it. No keys are provided as rust-lightning was never given any keys - only the + * script_pubkey as it appears in the output. + * These may include outputs from a transaction punishing our counterparty or claiming an HTLC + * on-chain using the payment preimage or after it has timed out. */ - LDKHTLCFailChannelUpdate_ChannelUpdateMessage, + LDKSpendableOutputDescriptor_StaticOutput, /** - * We received an error which indicated only that a channel has been closed + * An output to a P2WSH script which can be spent with a single signature after a CSV delay. + * + * The witness in the spending input should be: + * (MINIMALIF standard rule) + * + * Note that the nSequence field in the spending input must be set to to_self_delay + * (which means the transaction is not broadcastable until at least to_self_delay + * blocks after the outpoint confirms). + * + * These are generally the result of a \"revocable\" output to us, spendable only by us unless + * it is an output from an old state which we broadcast (which should never happen). + * + * To derive the delayed_payment key which is used to sign for this input, you must pass the + * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in + * ChannelKeys::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to + * chan_utils::derive_private_key. The public key can be generated without the secret key + * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in + * ChannelKeys::pubkeys(). + * + * To derive the revocation_pubkey provided here (which is used in the witness + * script generation), you must pass the counterparty revocation_basepoint (which appears in the + * call to ChannelKeys::ready_channel) and the provided per_commitment point + * to chan_utils::derive_public_revocation_key. + * + * The witness script which is hashed and included in the output script_pubkey may be + * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey + * (derived as above), and the to_self_delay contained here to + * chan_utils::get_revokeable_redeemscript. */ - LDKHTLCFailChannelUpdate_ChannelClosed, + LDKSpendableOutputDescriptor_DynamicOutputP2WSH, /** - * We received an error which indicated only that a node has failed + * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which + * corresponds to the public key in ChannelKeys::pubkeys().payment_point). + * The witness in the spending input, is, thus, simply: + * + * + * These are generally the result of our counterparty having broadcast the current state, + * allowing us to claim the non-HTLC-encumbered outputs immediately. */ - LDKHTLCFailChannelUpdate_NodeFailure, + LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment, /** * Must be last for serialization purposes */ - LDKHTLCFailChannelUpdate_Sentinel, -} LDKHTLCFailChannelUpdate_Tag; + LDKSpendableOutputDescriptor_Sentinel, +} LDKSpendableOutputDescriptor_Tag; -typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body { - struct LDKChannelUpdate msg; -} LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body; +typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body { + struct LDKOutPoint outpoint; + struct LDKTxOut output; +} LDKSpendableOutputDescriptor_LDKStaticOutput_Body; -typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body { - uint64_t short_channel_id; - bool is_permanent; -} LDKHTLCFailChannelUpdate_LDKChannelClosed_Body; +typedef struct LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body { + struct LDKOutPoint outpoint; + struct LDKPublicKey per_commitment_point; + uint16_t to_self_delay; + struct LDKTxOut output; + LDKC2Tuple_u64u64Z key_derivation_params; + struct LDKPublicKey revocation_pubkey; +} LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body; -typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body { - struct LDKPublicKey node_id; - bool is_permanent; -} LDKHTLCFailChannelUpdate_LDKNodeFailure_Body; +typedef struct LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body { + struct LDKOutPoint outpoint; + struct LDKTxOut output; + LDKC2Tuple_u64u64Z key_derivation_params; +} LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body; -typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate { - LDKHTLCFailChannelUpdate_Tag tag; +typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor { + LDKSpendableOutputDescriptor_Tag tag; union { - LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message; - LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed; - LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure; + LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output; + LDKSpendableOutputDescriptor_LDKDynamicOutputP2WSH_Body dynamic_output_p2wsh; + LDKSpendableOutputDescriptor_LDKStaticOutputCounterpartyPayment_Body static_output_counterparty_payment; }; -} LDKHTLCFailChannelUpdate; - - - -/** - * A query_channel_range message is used to query a peer for channel - * UTXOs in a range of blocks. The recipient of a query makes a best - * effort to reply to the query using one or more reply_channel_range - * messages. - */ -typedef struct MUST_USE_STRUCT LDKQueryChannelRange { - /** - * 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. - */ - LDKnativeQueryChannelRange *inner; - bool is_owned; -} LDKQueryChannelRange; +} LDKSpendableOutputDescriptor; +typedef struct LDKCVecTempl_SpendableOutputDescriptor { + struct LDKSpendableOutputDescriptor *data; + uintptr_t datalen; +} LDKCVecTempl_SpendableOutputDescriptor; +typedef struct LDKCVecTempl_SpendableOutputDescriptor LDKCVec_SpendableOutputDescriptorZ; /** - * A query_short_channel_ids message is used to query a peer for - * routing gossip messages related to one or more short_channel_ids. - * The query recipient will reply with the latest, if available, - * channel_announcement, channel_update and node_announcement messages - * it maintains for the requested short_channel_ids followed by a - * reply_short_channel_ids_end message. The short_channel_ids sent in - * this query are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. + * An Event which you should probably take some action in response to. + * + * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use + * them directly as they don't round-trip exactly (for example FundingGenerationReady is never + * written as it makes no sense to respond to it after reconnecting to peers). */ -typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds { +typedef enum LDKEvent_Tag { /** - * 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. + * Used to indicate that the client should generate a funding transaction with the given + * parameters and then call ChannelManager::funding_transaction_generated. + * Generated in ChannelManager message handling. + * Note that *all inputs* in the funding transaction must spend SegWit outputs or your + * counterparty can steal your funds! */ - LDKnativeQueryShortChannelIds *inner; - bool is_owned; -} LDKQueryShortChannelIds; - -/** - * An event generated by ChannelManager which indicates a message should be sent to a peer (or - * broadcast to most peers). - * These events are handled by PeerManager::process_events if you are using a PeerManager. - */ -typedef enum LDKMessageSendEvent_Tag { + LDKEvent_FundingGenerationReady, /** - * Used to indicate that we've accepted a channel open and should send the accept_channel - * message provided to the given peer. + * Used to indicate that the client may now broadcast the funding transaction it created for a + * channel. Broadcasting such a transaction prior to this event may lead to our counterparty + * trivially stealing all funds in the funding transaction! */ - LDKMessageSendEvent_SendAcceptChannel, + LDKEvent_FundingBroadcastSafe, /** - * Used to indicate that we've initiated a channel open and should send the open_channel - * message provided to the given peer. + * Indicates we've received money! Just gotta dig out that payment preimage and feed it to + * ChannelManager::claim_funds to get it.... + * Note that if the preimage is not known or the amount paid is incorrect, you should call + * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid + * network congestion. + * The amount paid should be considered 'incorrect' when it is less than or more than twice + * the amount expected. + * If you fail to call either ChannelManager::claim_funds or + * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be + * automatically failed. */ - LDKMessageSendEvent_SendOpenChannel, + LDKEvent_PaymentReceived, /** - * Used to indicate that a funding_created message should be sent to the peer with the given node_id. - */ - LDKMessageSendEvent_SendFundingCreated, - /** - * Used to indicate that a funding_signed message should be sent to the peer with the given node_id. + * Indicates an outbound payment we made succeeded (ie it made it all the way to its target + * and we got back the payment preimage for it). + * Note that duplicative PaymentSent Events may be generated - it is your responsibility to + * deduplicate them by payment_preimage (which MUST be unique)! */ - LDKMessageSendEvent_SendFundingSigned, + LDKEvent_PaymentSent, /** - * Used to indicate that a funding_locked message should be sent to the peer with the given node_id. + * Indicates an outbound payment we made failed. Probably some intermediary node dropped + * something. You may wish to retry with a different route. + * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to + * deduplicate them by payment_hash (which MUST be unique)! */ - LDKMessageSendEvent_SendFundingLocked, + LDKEvent_PaymentFailed, /** - * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id. + * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a + * time in the future. */ - LDKMessageSendEvent_SendAnnouncementSignatures, + LDKEvent_PendingHTLCsForwardable, /** - * Used to indicate that a series of HTLC update messages, as well as a commitment_signed - * message should be sent to the peer with the given node_id. + * Used to indicate that an output was generated on-chain which you should know how to spend. + * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your + * counterparty spending them due to some kind of timeout. Thus, you need to store them + * somewhere and spend them when you create on-chain transactions. */ - LDKMessageSendEvent_UpdateHTLCs, + LDKEvent_SpendableOutputs, /** - * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id. + * Must be last for serialization purposes */ - LDKMessageSendEvent_SendRevokeAndACK, + LDKEvent_Sentinel, +} LDKEvent_Tag; + +typedef struct LDKEvent_LDKFundingGenerationReady_Body { + struct LDKThirtyTwoBytes temporary_channel_id; + uint64_t channel_value_satoshis; + LDKCVec_u8Z output_script; + uint64_t user_channel_id; +} LDKEvent_LDKFundingGenerationReady_Body; + +typedef struct LDKEvent_LDKFundingBroadcastSafe_Body { + struct LDKOutPoint funding_txo; + uint64_t user_channel_id; +} LDKEvent_LDKFundingBroadcastSafe_Body; + +typedef struct LDKEvent_LDKPaymentReceived_Body { + struct LDKThirtyTwoBytes payment_hash; + struct LDKThirtyTwoBytes payment_secret; + uint64_t amt; +} LDKEvent_LDKPaymentReceived_Body; + +typedef struct LDKEvent_LDKPaymentSent_Body { + struct LDKThirtyTwoBytes payment_preimage; +} LDKEvent_LDKPaymentSent_Body; + +typedef struct LDKEvent_LDKPaymentFailed_Body { + struct LDKThirtyTwoBytes payment_hash; + bool rejected_by_dest; +} LDKEvent_LDKPaymentFailed_Body; + +typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { + uint64_t time_forwardable; +} LDKEvent_LDKPendingHTLCsForwardable_Body; + +typedef struct LDKEvent_LDKSpendableOutputs_Body { + LDKCVec_SpendableOutputDescriptorZ outputs; +} LDKEvent_LDKSpendableOutputs_Body; + +typedef struct MUST_USE_STRUCT LDKEvent { + LDKEvent_Tag tag; + union { + LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready; + LDKEvent_LDKFundingBroadcastSafe_Body funding_broadcast_safe; + LDKEvent_LDKPaymentReceived_Body payment_received; + LDKEvent_LDKPaymentSent_Body payment_sent; + LDKEvent_LDKPaymentFailed_Body payment_failed; + LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable; + LDKEvent_LDKSpendableOutputs_Body spendable_outputs; + }; +} LDKEvent; + + + +/** + * An accept_channel message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKAcceptChannel { /** - * Used to indicate that a closing_signed message should be sent to the peer with the given node_id. + * 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. */ - LDKMessageSendEvent_SendClosingSigned, + LDKnativeAcceptChannel *inner; + bool is_owned; +} LDKAcceptChannel; + + + +/** + * An open_channel message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKOpenChannel { /** - * Used to indicate that a shutdown message should be sent to the peer with the given node_id. + * 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. */ - LDKMessageSendEvent_SendShutdown, + LDKnativeOpenChannel *inner; + bool is_owned; +} LDKOpenChannel; + + + +/** + * A funding_created message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKFundingCreated { /** - * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id. + * 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. */ - LDKMessageSendEvent_SendChannelReestablish, + LDKnativeFundingCreated *inner; + bool is_owned; +} LDKFundingCreated; + + + +/** + * A funding_signed message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKFundingSigned { /** - * Used to indicate that a channel_announcement and channel_update should be broadcast to all - * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). - * - * Note that after doing so, you very likely (unless you did so very recently) want to call - * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event. - * This ensures that any nodes which see our channel_announcement also have a relevant - * node_announcement, including relevant feature flags which may be important for routing - * through or to us. + * 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. */ - LDKMessageSendEvent_BroadcastChannelAnnouncement, + LDKnativeFundingSigned *inner; + bool is_owned; +} LDKFundingSigned; + + + +/** + * A funding_locked message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKFundingLocked { /** - * Used to indicate that a node_announcement should be broadcast to all peers. + * 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. */ - LDKMessageSendEvent_BroadcastNodeAnnouncement, + LDKnativeFundingLocked *inner; + bool is_owned; +} LDKFundingLocked; + + + +/** + * An announcement_signatures message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures { /** - * Used to indicate that a channel_update should be broadcast to all peers. + * 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. */ - LDKMessageSendEvent_BroadcastChannelUpdate, + LDKnativeAnnouncementSignatures *inner; + bool is_owned; +} LDKAnnouncementSignatures; + + + +/** + * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment + * transaction updates if they were pending. + */ +typedef struct MUST_USE_STRUCT LDKCommitmentUpdate { /** - * Broadcast an error downstream to be handled + * 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. */ - LDKMessageSendEvent_HandleError, + LDKnativeCommitmentUpdate *inner; + bool is_owned; +} LDKCommitmentUpdate; + + + +/** + * A revoke_and_ack message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKRevokeAndACK { /** - * When a payment fails we may receive updates back from the hop where it failed. In such - * cases this event is generated so that we can inform the network graph of this information. + * 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. */ - LDKMessageSendEvent_PaymentFailureNetworkUpdate, + LDKnativeRevokeAndACK *inner; + bool is_owned; +} LDKRevokeAndACK; + + + +/** + * A closing_signed message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKClosingSigned { /** - * Query a peer for channels with funding transaction UTXOs in a block range. + * 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. */ - LDKMessageSendEvent_SendChannelRangeQuery, + LDKnativeClosingSigned *inner; + bool is_owned; +} LDKClosingSigned; + + + +/** + * A shutdown message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKShutdown { /** - * Request routing gossip messages from a peer for a list of channels identified by - * their short_channel_ids. + * 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. */ - LDKMessageSendEvent_SendShortIdsQuery, + LDKnativeShutdown *inner; + bool is_owned; +} LDKShutdown; + + + +/** + * A channel_reestablish message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKChannelReestablish { /** - * Must be last for serialization purposes + * 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. */ - LDKMessageSendEvent_Sentinel, -} LDKMessageSendEvent_Tag; + LDKnativeChannelReestablish *inner; + bool is_owned; +} LDKChannelReestablish; -typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body { - struct LDKPublicKey node_id; - struct LDKAcceptChannel msg; -} LDKMessageSendEvent_LDKSendAcceptChannel_Body; -typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body { - struct LDKPublicKey node_id; - struct LDKOpenChannel msg; + +/** + * A node_announcement message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { + /** + * 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. + */ + LDKnativeNodeAnnouncement *inner; + bool is_owned; +} LDKNodeAnnouncement; + + + +/** + * An error message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKErrorMessage { + /** + * 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. + */ + LDKnativeErrorMessage *inner; + bool is_owned; +} LDKErrorMessage; + +/** + * Used to put an error message in a LightningError + */ +typedef enum LDKErrorAction_Tag { + /** + * The peer took some action which made us think they were useless. Disconnect them. + */ + LDKErrorAction_DisconnectPeer, + /** + * The peer did something harmless that we weren't able to process, just log and ignore + */ + LDKErrorAction_IgnoreError, + /** + * The peer did something incorrect. Tell them. + */ + LDKErrorAction_SendErrorMessage, + /** + * Must be last for serialization purposes + */ + LDKErrorAction_Sentinel, +} LDKErrorAction_Tag; + +typedef struct LDKErrorAction_LDKDisconnectPeer_Body { + struct LDKErrorMessage msg; +} LDKErrorAction_LDKDisconnectPeer_Body; + +typedef struct LDKErrorAction_LDKSendErrorMessage_Body { + struct LDKErrorMessage msg; +} LDKErrorAction_LDKSendErrorMessage_Body; + +typedef struct MUST_USE_STRUCT LDKErrorAction { + LDKErrorAction_Tag tag; + union { + LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer; + LDKErrorAction_LDKSendErrorMessage_Body send_error_message; + }; +} LDKErrorAction; + +/** + * The information we received from a peer along the route of a payment we originated. This is + * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into + * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map. + */ +typedef enum LDKHTLCFailChannelUpdate_Tag { + /** + * We received an error which included a full ChannelUpdate message. + */ + LDKHTLCFailChannelUpdate_ChannelUpdateMessage, + /** + * We received an error which indicated only that a channel has been closed + */ + LDKHTLCFailChannelUpdate_ChannelClosed, + /** + * We received an error which indicated only that a node has failed + */ + LDKHTLCFailChannelUpdate_NodeFailure, + /** + * Must be last for serialization purposes + */ + LDKHTLCFailChannelUpdate_Sentinel, +} LDKHTLCFailChannelUpdate_Tag; + +typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body { + struct LDKChannelUpdate msg; +} LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body; + +typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body { + uint64_t short_channel_id; + bool is_permanent; +} LDKHTLCFailChannelUpdate_LDKChannelClosed_Body; + +typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body { + struct LDKPublicKey node_id; + bool is_permanent; +} LDKHTLCFailChannelUpdate_LDKNodeFailure_Body; + +typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate { + LDKHTLCFailChannelUpdate_Tag tag; + union { + LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message; + LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed; + LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure; + }; +} LDKHTLCFailChannelUpdate; + + + +/** + * A query_channel_range message is used to query a peer for channel + * UTXOs in a range of blocks. The recipient of a query makes a best + * effort to reply to the query using one or more reply_channel_range + * messages. + */ +typedef struct MUST_USE_STRUCT LDKQueryChannelRange { + /** + * 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. + */ + LDKnativeQueryChannelRange *inner; + bool is_owned; +} LDKQueryChannelRange; + + + +/** + * A query_short_channel_ids message is used to query a peer for + * routing gossip messages related to one or more short_channel_ids. + * The query recipient will reply with the latest, if available, + * channel_announcement, channel_update and node_announcement messages + * it maintains for the requested short_channel_ids followed by a + * reply_short_channel_ids_end message. The short_channel_ids sent in + * this query are encoded. We only support encoding_type=0 uncompressed + * serialization and do not support encoding_type=1 zlib serialization. + */ +typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds { + /** + * 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. + */ + LDKnativeQueryShortChannelIds *inner; + bool is_owned; +} LDKQueryShortChannelIds; + +/** + * An event generated by ChannelManager which indicates a message should be sent to a peer (or + * broadcast to most peers). + * These events are handled by PeerManager::process_events if you are using a PeerManager. + */ +typedef enum LDKMessageSendEvent_Tag { + /** + * Used to indicate that we've accepted a channel open and should send the accept_channel + * message provided to the given peer. + */ + LDKMessageSendEvent_SendAcceptChannel, + /** + * Used to indicate that we've initiated a channel open and should send the open_channel + * message provided to the given peer. + */ + LDKMessageSendEvent_SendOpenChannel, + /** + * Used to indicate that a funding_created message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendFundingCreated, + /** + * Used to indicate that a funding_signed message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendFundingSigned, + /** + * Used to indicate that a funding_locked message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendFundingLocked, + /** + * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendAnnouncementSignatures, + /** + * Used to indicate that a series of HTLC update messages, as well as a commitment_signed + * message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_UpdateHTLCs, + /** + * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendRevokeAndACK, + /** + * Used to indicate that a closing_signed message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendClosingSigned, + /** + * Used to indicate that a shutdown message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendShutdown, + /** + * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendChannelReestablish, + /** + * Used to indicate that a channel_announcement and channel_update should be broadcast to all + * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). + * + * Note that after doing so, you very likely (unless you did so very recently) want to call + * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event. + * This ensures that any nodes which see our channel_announcement also have a relevant + * node_announcement, including relevant feature flags which may be important for routing + * through or to us. + */ + LDKMessageSendEvent_BroadcastChannelAnnouncement, + /** + * Used to indicate that a node_announcement should be broadcast to all peers. + */ + LDKMessageSendEvent_BroadcastNodeAnnouncement, + /** + * Used to indicate that a channel_update should be broadcast to all peers. + */ + LDKMessageSendEvent_BroadcastChannelUpdate, + /** + * Broadcast an error downstream to be handled + */ + LDKMessageSendEvent_HandleError, + /** + * When a payment fails we may receive updates back from the hop where it failed. In such + * cases this event is generated so that we can inform the network graph of this information. + */ + LDKMessageSendEvent_PaymentFailureNetworkUpdate, + /** + * Query a peer for channels with funding transaction UTXOs in a block range. + */ + LDKMessageSendEvent_SendChannelRangeQuery, + /** + * Request routing gossip messages from a peer for a list of channels identified by + * their short_channel_ids. + */ + LDKMessageSendEvent_SendShortIdsQuery, + /** + * Must be last for serialization purposes + */ + LDKMessageSendEvent_Sentinel, +} LDKMessageSendEvent_Tag; + +typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body { + struct LDKPublicKey node_id; + struct LDKAcceptChannel msg; +} LDKMessageSendEvent_LDKSendAcceptChannel_Body; + +typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body { + struct LDKPublicKey node_id; + struct LDKOpenChannel msg; } LDKMessageSendEvent_LDKSendOpenChannel_Body; typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body { @@ -1380,506 +1935,119 @@ typedef struct LDKCVecTempl_Event { typedef struct LDKCVecTempl_Event LDKCVec_EventZ; -/** - * A trait indicating an object may generate events - */ -typedef struct LDKEventsProvider { - void *this_arg; - /** - * Gets the list of pending events which were generated by previous actions, clearing the list - * in the process. - */ - LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg); - void (*free)(void *this_arg); -} LDKEventsProvider; - -/** - * A trait encapsulating the operations required of a logger - */ -typedef struct LDKLogger { - void *this_arg; - /** - * Logs the `Record` - */ - void (*log)(const void *this_arg, const char *record); - void (*free)(void *this_arg); -} LDKLogger; - - - -/** - * Configuration we set when applicable. - * - * Default::default() provides sane defaults. - */ -typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig { - /** - * 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. - */ - LDKnativeChannelHandshakeConfig *inner; - bool is_owned; -} LDKChannelHandshakeConfig; - - - -/** - * Optional channel limits which are applied during channel creation. - * - * These limits are only applied to our counterparty's limits, not our own. - * - * Use 0/::max_value() as appropriate to skip checking. - * - * Provides sane defaults for most configurations. - * - * Most additional limits are disabled except those with which specify a default in individual - * field documentation. Note that this may result in barely-usable channels, but since they - * are applied mostly only to incoming channels that's not much of a problem. - */ -typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits { - /** - * 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. - */ - LDKnativeChannelHandshakeLimits *inner; - bool is_owned; -} LDKChannelHandshakeLimits; - - - -/** - * Options which apply on a per-channel basis and may change at runtime or based on negotiation - * with our counterparty. - */ -typedef struct MUST_USE_STRUCT LDKChannelConfig { - /** - * 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. - */ - LDKnativeChannelConfig *inner; - bool is_owned; -} LDKChannelConfig; - -typedef struct LDKu8slice { - const uint8_t *data; - uintptr_t datalen; -} LDKu8slice; - - - -/** - * Top-level config which holds ChannelHandshakeLimits and ChannelConfig. - * - * Default::default() provides sane defaults for most configurations - * (but currently with 0 relay fees!) - */ -typedef struct MUST_USE_STRUCT LDKUserConfig { - /** - * 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. - */ - LDKnativeUserConfig *inner; - bool is_owned; -} LDKUserConfig; - -typedef union LDKCResultPtr_TxOut__AccessError { - struct LDKTxOut *result; - enum LDKAccessError *err; -} LDKCResultPtr_TxOut__AccessError; - -typedef struct LDKCResultTempl_TxOut__AccessError { - union LDKCResultPtr_TxOut__AccessError contents; - bool result_ok; -} LDKCResultTempl_TxOut__AccessError; - -typedef struct LDKCResultTempl_TxOut__AccessError LDKCResult_TxOutAccessErrorZ; - -/** - * The `Access` trait defines behavior for accessing chain data and state, such as blocks and - * UTXOs. - */ -typedef struct LDKAccess { - void *this_arg; - /** - * 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. - * - * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id - */ - LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id); - void (*free)(void *this_arg); -} LDKAccess; - - - -/** - * One counterparty's public keys which do not change over the life of a channel. - */ -typedef struct MUST_USE_STRUCT LDKChannelPublicKeys { - /** - * 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. - */ - LDKnativeChannelPublicKeys *inner; - bool is_owned; -} LDKChannelPublicKeys; - - - -/** - * This class tracks the per-transaction information needed to build a commitment transaction and to - * actually build it and sign. It is used for holder transactions that we sign only when needed - * and for transactions we sign for the counterparty. - * - * This class can be used inside a signer implementation to generate a signature given the relevant - * secret key. - */ -typedef struct MUST_USE_STRUCT LDKCommitmentTransaction { - /** - * 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. - */ - LDKnativeCommitmentTransaction *inner; - bool is_owned; -} LDKCommitmentTransaction; - - - -/** - * Information needed to build and sign a holder's commitment transaction. - * - * The transaction is only signed once we are ready to broadcast. - */ -typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction { - /** - * 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. - */ - LDKnativeHolderCommitmentTransaction *inner; - bool is_owned; -} LDKHolderCommitmentTransaction; - - - -/** - * Information about an HTLC as it appears in a commitment transaction - */ -typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment { - /** - * 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. - */ - LDKnativeHTLCOutputInCommitment *inner; - bool is_owned; -} LDKHTLCOutputInCommitment; - - - -/** - * The unsigned part of a channel_announcement - */ -typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { - /** - * 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. - */ - LDKnativeUnsignedChannelAnnouncement *inner; - bool is_owned; -} LDKUnsignedChannelAnnouncement; - - - -/** - * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction). - * The fields are organized by holder/counterparty. - * - * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters - * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions. - */ -typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters { - /** - * 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. - */ - LDKnativeChannelTransactionParameters *inner; - bool is_owned; -} LDKChannelTransactionParameters; - -/** - * Set of lightning keys needed to operate a channel as described in BOLT 3. - * - * Signing services could be implemented on a hardware wallet. In this case, - * the current ChannelKeys would be a front-end on top of a communication - * channel connected to your secure device and lightning key material wouldn't - * reside on a hot server. Nevertheless, a this deployment would still need - * to trust the ChannelManager to avoid loss of funds as this latest component - * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys. - * - * A more secure iteration would be to use hashlock (or payment points) to pair - * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager - * at the price of more state and computation on the hardware wallet side. In the future, - * we are looking forward to design such interface. - * - * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted - * to act, as liveness and breach reply correctness are always going to be hard requirements - * of LN security model, orthogonal of key management issues. - * - * If you're implementing a custom signer, you almost certainly want to implement - * Readable/Writable to serialize out a unique reference to this set of keys so - * that you can serialize the full ChannelManager object. - * - */ -typedef struct LDKChannelKeys { - void *this_arg; - /** - * Gets the per-commitment point for a specific commitment number - * - * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. - */ - struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx); - /** - * Gets the commitment secret for a specific commitment number as part of the revocation process - * - * An external signer implementation should error here if the commitment was already signed - * and should refuse to sign it in the future. - * - * May be called more than once for the same index. - * - * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. - * TODO: return a Result so we can signal a validation error - */ - struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx); - /** - * Gets the holder's channel public keys and basepoints - */ - struct LDKChannelPublicKeys pubkeys; - /** - * Fill in the pubkeys field as a reference to it will be given to Rust after this returns - * Note that this takes a pointer to this object, not the this_ptr like other methods do - * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating. - */ - void (*set_pubkeys)(const struct LDKChannelKeys*); - /** - * Gets arbitrary identifiers describing the set of keys which are provided back to you in - * some SpendableOutputDescriptor types. These should be sufficient to identify this - * ChannelKeys object uniquely and lookup or re-derive its keys. - */ - LDKC2Tuple_u64u64Z (*key_derivation_params)(const void *this_arg); - /** - * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. - * - * Note that if signing fails or is rejected, the channel will be force-closed. - */ - LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *commitment_tx); - /** - * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions. - * This will only ever be called with a non-revoked commitment_tx. This will be called with the - * latest commitment_tx when we initiate a force-close. - * This will be called with the previous latest, just to get claiming HTLC signatures, if we are - * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to - * the latest. - * This may be called multiple times for the same transaction. - * - * An external signer implementation should check that the commitment has not been revoked. - * - * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case. - */ - LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *commitment_tx); - /** - * Create a signature for the given input in a transaction spending an HTLC or commitment - * transaction output when our counterparty broadcasts an old state. - * - * A justice transaction may claim multiples outputs at the same time if timelocks are - * similar, but only a signature for the input at index `input` should be signed for here. - * It may be called multiples time for same output(s) if a fee-bump is needed with regards - * to an upcoming timelock expiration. - * - * Amount is value of the output spent by this input, committed to in the BIP 143 signature. - * - * per_commitment_key is revocation secret which was provided by our counterparty when they - * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does - * not allow the spending of any funds by itself (you need our holder revocation_secret to do - * so). - * - * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus - * changing the format of the witness script (which is committed to in the BIP 143 - * signatures). - */ - LDKCResult_SignatureNoneZ (*sign_justice_transaction)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *htlc); - /** - * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment - * transaction, either offered or received. - * - * Such a transaction may claim multiples offered outputs at same time if we know the - * preimage for each when we create it, but only the input at index `input` should be - * signed for here. It may be called multiple times for same output(s) if a fee-bump is - * needed with regards to an upcoming timelock expiration. - * - * Witness_script is either a offered or received script as defined in BOLT3 for HTLC - * outputs. - * - * Amount is value of the output spent by this input, committed to in the BIP 143 signature. - * - * Per_commitment_point is the dynamic point corresponding to the channel state - * detected onchain. It has been generated by our counterparty and is used to derive - * channel state keys, which are then included in the witness script and committed to in the - * BIP 143 signature. - */ - LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *htlc); - /** - * Create a signature for a (proposed) closing transaction. - * - * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have - * chosen to forgo their output as dust. - */ - LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx); - /** - * Signs a channel announcement message with our funding key, proving it comes from one - * of the channel participants. - * - * Note that if this fails or is rejected, the channel will not be publicly announced and - * our counterparty may (though likely will not) close the channel on us for violating the - * protocol. - */ - LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *msg); - /** - * Set the counterparty static channel data, including basepoints, - * counterparty_selected/holder_selected_contest_delay and funding outpoint. - * This is done as soon as the funding outpoint is known. Since these are static channel data, - * they MUST NOT be allowed to change to different values once set. - * - * channel_parameters.is_populated() MUST be true. - * - * We bind holder_selected_contest_delay late here for API convenience. - * - * Will be called before any signatures are applied. +/** + * A trait indicating an object may generate events + */ +typedef struct LDKEventsProvider { + void *this_arg; + /** + * Gets the list of pending events which were generated by previous actions, clearing the list + * in the process. */ - void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *channel_parameters); - void *(*clone)(const void *this_arg); - LDKCVec_u8Z (*write)(const void *this_arg); + LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg); void (*free)(void *this_arg); -} LDKChannelKeys; +} LDKEventsProvider; /** - * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates - * on-chain transactions to ensure no loss of funds occurs. - * - * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date - * information and are actively monitoring the chain. - * - * Pending Events or updated HTLCs which have not yet been read out by - * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and - * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events - * gotten are fully handled before re-serializing the new state. + * Configuration we set when applicable. * - * Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which - * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along - * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the - * returned block hash and the the current chain and then reconnecting blocks to get to the - * best chain) upon deserializing the object! + * Default::default() provides sane defaults. */ -typedef struct MUST_USE_STRUCT LDKChannelMonitor { +typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig { /** * 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. */ - LDKnativeChannelMonitor *inner; + LDKnativeChannelHandshakeConfig *inner; bool is_owned; -} LDKChannelMonitor; +} LDKChannelHandshakeConfig; /** - * An update generated by the underlying Channel itself which contains some new information the - * ChannelMonitor should be made aware of. + * Optional channel limits which are applied during channel creation. + * + * These limits are only applied to our counterparty's limits, not our own. + * + * Use 0/::max_value() as appropriate to skip checking. + * + * Provides sane defaults for most configurations. + * + * Most additional limits are disabled except those with which specify a default in individual + * field documentation. Note that this may result in barely-usable channels, but since they + * are applied mostly only to incoming channels that's not much of a problem. */ -typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { +typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits { /** * 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. */ - LDKnativeChannelMonitorUpdate *inner; + LDKnativeChannelHandshakeLimits *inner; bool is_owned; -} LDKChannelMonitorUpdate; +} LDKChannelHandshakeLimits; /** - * An event to be processed by the ChannelManager. + * Options which apply on a per-channel basis and may change at runtime or based on negotiation + * with our counterparty. */ -typedef struct MUST_USE_STRUCT LDKMonitorEvent { +typedef struct MUST_USE_STRUCT LDKChannelConfig { /** * 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. */ - LDKnativeMonitorEvent *inner; + LDKnativeChannelConfig *inner; bool is_owned; -} LDKMonitorEvent; +} LDKChannelConfig; -typedef struct LDKCVecTempl_MonitorEvent { - struct LDKMonitorEvent *data; - uintptr_t datalen; -} LDKCVecTempl_MonitorEvent; -typedef struct LDKCVecTempl_MonitorEvent LDKCVec_MonitorEventZ; /** - * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as - * blocks are connected and disconnected. - * - * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are - * responsible for maintaining a set of monitors such that they can be updated accordingly as - * channel state changes and HTLCs are resolved. See method documentation for specific - * requirements. - * - * Implementations **must** ensure that updates are successfully applied and persisted upon method - * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down - * without taking any further action such as persisting the current state. - * - * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing - * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it - * could result in a revoked transaction being broadcast, allowing the counterparty to claim all - * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle - * multiple instances. + * Top-level config which holds ChannelHandshakeLimits and ChannelConfig. * - * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html - * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html - * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure + * Default::default() provides sane defaults for most configurations + * (but currently with 0 relay fees!) */ -typedef struct LDKWatch { - void *this_arg; +typedef struct MUST_USE_STRUCT LDKUserConfig { /** - * Watches a channel identified by `funding_txo` using `monitor`. - * - * Implementations are responsible for watching the chain for the funding transaction along - * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means - * calling [`block_connected`] and [`block_disconnected`] on the monitor. - * - * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch - * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected - * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected + * 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. */ - LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); + LDKnativeUserConfig *inner; + bool is_owned; +} LDKUserConfig; + +typedef union LDKCResultPtr_TxOut__AccessError { + struct LDKTxOut *result; + enum LDKAccessError *err; +} LDKCResultPtr_TxOut__AccessError; + +typedef struct LDKCResultTempl_TxOut__AccessError { + union LDKCResultPtr_TxOut__AccessError contents; + bool result_ok; +} LDKCResultTempl_TxOut__AccessError; + +typedef struct LDKCResultTempl_TxOut__AccessError LDKCResult_TxOutAccessErrorZ; + +/** + * The `Access` trait defines behavior for accessing chain data and state, such as blocks and + * UTXOs. + */ +typedef struct LDKAccess { + void *this_arg; /** - * Updates a channel identified by `funding_txo` by applying `update` to its monitor. - * - * Implementations must call [`update_monitor`] with the given update. See - * [`ChannelMonitorUpdateErr`] for invariants around returning an error. + * 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. * - * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor - * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html - */ - LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update); - /** - * Returns any monitor events since the last call. Subsequent calls must only return new - * events. + * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id */ - LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg); + LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id); void (*free)(void *this_arg); -} LDKWatch; +} LDKAccess; /** * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to @@ -1915,45 +2083,10 @@ typedef struct LDKFilter { * Registers interest in spends of a transaction output identified by `outpoint` having * `script_pubkey` as the spending condition. */ - void (*register_output)(const void *this_arg, const struct LDKOutPoint *outpoint, struct LDKu8slice script_pubkey); + void (*register_output)(const void *this_arg, const struct LDKOutPoint *NONNULL_PTR outpoint, struct LDKu8slice script_pubkey); void (*free)(void *this_arg); } LDKFilter; -/** - * An interface to send a transaction to the Bitcoin network. - */ -typedef struct LDKBroadcasterInterface { - void *this_arg; - /** - * Sends a transaction out to (hopefully) be mined. - */ - void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx); - void (*free)(void *this_arg); -} LDKBroadcasterInterface; - -/** - * A trait which should be implemented to provide feerate information on a number of time - * horizons. - * - * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're - * called from inside the library in response to chain events, P2P events, or timer events). - */ -typedef struct LDKFeeEstimator { - void *this_arg; - /** - * Gets estimated satoshis of fee required per 1000 Weight-Units. - * - * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs - * don't put us below 1 satoshi-per-byte). - * - * This translates to: - * * satoshis-per-byte * 250 - * * ceil(satoshis-per-kbyte / 4) - */ - uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target); - void (*free)(void *this_arg); -} LDKFeeEstimator; - /** * `Persist` defines behavior for persisting channel monitors: this could mean * writing once to disk, and/or uploading to one or more backup services. @@ -1982,7 +2115,7 @@ typedef struct LDKPersist { * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html */ - LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *data); + LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data); /** * Update one channel's data. The provided `ChannelMonitor` has already * applied the given update. @@ -2012,7 +2145,7 @@ typedef struct LDKPersist { * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html */ - LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *update, const struct LDKChannelMonitor *data); + LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data); void (*free)(void *this_arg); } LDKPersist; @@ -2046,6 +2179,18 @@ typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction { typedef struct LDKCVecTempl_C2TupleTempl_usize__Transaction LDKCVec_C2Tuple_usizeTransactionZZ; +typedef union LDKCResultPtr_ChannelMonitorUpdate__DecodeError { + struct LDKChannelMonitorUpdate *result; + struct LDKDecodeError *err; +} LDKCResultPtr_ChannelMonitorUpdate__DecodeError; + +typedef struct LDKCResultTempl_ChannelMonitorUpdate__DecodeError { + union LDKCResultPtr_ChannelMonitorUpdate__DecodeError contents; + bool result_ok; +} LDKCResultTempl_ChannelMonitorUpdate__DecodeError; + +typedef struct LDKCResultTempl_ChannelMonitorUpdate__DecodeError LDKCResult_ChannelMonitorUpdateDecodeErrorZ; + /** @@ -2078,75 +2223,29 @@ typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_ typedef struct LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_C2TupleTempl_u32__TxOut LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ; -typedef struct LDKSecretKey { - uint8_t bytes[32]; -} LDKSecretKey; - - - -/** - * An error in decoding a message or struct. - */ -typedef struct MUST_USE_STRUCT LDKDecodeError { - /** - * 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. - */ - LDKnativeDecodeError *inner; - bool is_owned; -} LDKDecodeError; - -typedef union LDKCResultPtr_ChannelKeys__DecodeError { - struct LDKChannelKeys *result; +typedef union LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError { + struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelMonitor *result; struct LDKDecodeError *err; -} LDKCResultPtr_ChannelKeys__DecodeError; - -typedef struct LDKCResultTempl_ChannelKeys__DecodeError { - union LDKCResultPtr_ChannelKeys__DecodeError contents; - bool result_ok; -} LDKCResultTempl_ChannelKeys__DecodeError; - -typedef struct LDKCResultTempl_ChannelKeys__DecodeError LDKCResult_ChanKeySignerDecodeErrorZ; - -/** - * A trait to describe an object which can get user secrets and key material. - */ -typedef struct LDKKeysInterface { - void *this_arg; - /** - * Get node secret key (aka node_id or network_key) - */ - struct LDKSecretKey (*get_node_secret)(const void *this_arg); - /** - * Get destination redeemScript to encumber static protocol exit points. - */ - LDKCVec_u8Z (*get_destination_script)(const void *this_arg); - /** - * Get shutdown_pubkey to use as PublicKey at channel closure - */ - struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg); - /** - * Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you - * restarted with some stale data! - */ - struct LDKChannelKeys (*get_channel_keys)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis); - /** - * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting - * onion packets and for temporary channel IDs. There is no requirement that these be - * persisted anywhere, though they must be unique across restarts. - */ - struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); - /** - * Reads a `ChanKeySigner` for this `KeysInterface` from the given input stream. - * This is only called during deserialization of other objects which contain - * `ChannelKeys`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s). - * The bytes are exactly those which `::write()` writes, and - * contain no versioning scheme. You may wish to include your own version prefix and ensure - * you've read all of the provided bytes to ensure no corruption occurred. - */ - LDKCResult_ChanKeySignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); - void (*free)(void *this_arg); -} LDKKeysInterface; +} LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError; + +typedef struct LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError { + union LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError contents; + bool result_ok; +} LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError; + +typedef struct LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelMonitor_____DecodeError LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; + +typedef union LDKCResultPtr_SpendableOutputDescriptor__DecodeError { + struct LDKSpendableOutputDescriptor *result; + struct LDKDecodeError *err; +} LDKCResultPtr_SpendableOutputDescriptor__DecodeError; + +typedef struct LDKCResultTempl_SpendableOutputDescriptor__DecodeError { + union LDKCResultPtr_SpendableOutputDescriptor__DecodeError contents; + bool result_ok; +} LDKCResultTempl_SpendableOutputDescriptor__DecodeError; + +typedef struct LDKCResultTempl_SpendableOutputDescriptor__DecodeError LDKCResult_SpendableOutputDescriptorDecodeErrorZ; @@ -2165,6 +2264,18 @@ typedef struct MUST_USE_STRUCT LDKInMemoryChannelKeys { bool is_owned; } LDKInMemoryChannelKeys; +typedef union LDKCResultPtr_InMemoryChannelKeys__DecodeError { + struct LDKInMemoryChannelKeys *result; + struct LDKDecodeError *err; +} LDKCResultPtr_InMemoryChannelKeys__DecodeError; + +typedef struct LDKCResultTempl_InMemoryChannelKeys__DecodeError { + union LDKCResultPtr_InMemoryChannelKeys__DecodeError contents; + bool result_ok; +} LDKCResultTempl_InMemoryChannelKeys__DecodeError; + +typedef struct LDKCResultTempl_InMemoryChannelKeys__DecodeError LDKCResult_InMemoryChannelKeysDecodeErrorZ; + /** @@ -2187,55 +2298,6 @@ typedef struct MUST_USE_STRUCT LDKKeysManager { -/** - * Manager which keeps track of a number of channels and sends messages to the appropriate - * channel, also tracking HTLC preimages and forwarding onion packets appropriately. - * - * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through - * to individual Channels. - * - * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for - * all peers during write/read (though does not modify this instance, only the instance being - * serialized). This will result in any channels which have not yet exchanged funding_created (ie - * called funding_transaction_generated for outbound channels). - * - * Note that you can be a bit lazier about writing out ChannelManager than you can be with - * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before - * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates - * happens out-of-band (and will prevent any other ChannelManager operations from occurring during - * the serialization process). If the deserialized version is out-of-date compared to the - * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the - * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees). - * - * Note that the deserializer is only implemented for (Sha256dHash, ChannelManager), which - * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along - * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call - * block_connected() to step towards your best block) upon deserialization before using the - * object! - * - * Note that ChannelManager is responsible for tracking liveness of its channels and generating - * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid - * spam due to quick disconnection/reconnection, updates are not sent until the channel has been - * offline for a full minute. In order to track this, you must call - * timer_chan_freshness_every_min roughly once per minute, though it doesn't have to be perfect. - * - * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager - * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but - * essentially you should default to using a SimpleRefChannelManager, and use a - * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when - * you're using lightning-net-tokio. - */ -typedef struct MUST_USE_STRUCT LDKChannelManager { - /** - * 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. - */ - LDKnativeChannelManager *inner; - bool is_owned; -} LDKChannelManager; - - - /** * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels */ @@ -2476,63 +2538,63 @@ typedef struct LDKChannelMessageHandler { /** * Handle an incoming open_channel message from the given peer. */ - void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *msg); + void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg); /** * Handle an incoming accept_channel message from the given peer. */ - void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *msg); + void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg); /** * Handle an incoming funding_created message from the given peer. */ - void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *msg); + void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg); /** * Handle an incoming funding_signed message from the given peer. */ - void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *msg); + void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg); /** * Handle an incoming funding_locked message from the given peer. */ - void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *msg); + void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg); /** * Handle an incoming shutdown message from the given peer. */ - void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *msg); + void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg); /** * Handle an incoming closing_signed message from the given peer. */ - void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *msg); + void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg); /** * Handle an incoming update_add_htlc message from the given peer. */ - void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *msg); + void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg); /** * Handle an incoming update_fulfill_htlc message from the given peer. */ - void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *msg); + void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg); /** * Handle an incoming update_fail_htlc message from the given peer. */ - void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *msg); + void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg); /** * Handle an incoming update_fail_malformed_htlc message from the given peer. */ - void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *msg); + void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg); /** * Handle an incoming commitment_signed message from the given peer. */ - void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *msg); + void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg); /** * Handle an incoming revoke_and_ack message from the given peer. */ - void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *msg); + void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg); /** * Handle an incoming update_fee message from the given peer. */ - void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *msg); + void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg); /** * Handle an incoming announcement_signatures message from the given peer. */ - void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *msg); + void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg); /** * Indicates a connection to the peer failed/an existing connection was lost. If no connection * is believed to be possible in the future (eg they're sending us messages we don't @@ -2543,15 +2605,15 @@ typedef struct LDKChannelMessageHandler { /** * Handle a peer reconnecting, possibly generating channel_reestablish message(s). */ - void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *msg); + void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg); /** * Handle an incoming channel_reestablish message from the given peer. */ - void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *msg); + void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg); /** * Handle an incoming error message from the given peer. */ - void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *msg); + void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg); struct LDKMessageSendEventsProvider MessageSendEventsProvider; void (*free)(void *this_arg); } LDKChannelMessageHandler; @@ -2590,6 +2652,18 @@ typedef struct LDKCVecTempl_ChannelMonitor { typedef struct LDKCVecTempl_ChannelMonitor LDKCVec_ChannelMonitorZ; +typedef union LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError { + struct LDKC2TupleTempl_ThirtyTwoBytes__ChannelManager *result; + struct LDKDecodeError *err; +} LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError; + +typedef struct LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError { + union LDKCResultPtr_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError contents; + bool result_ok; +} LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError; + +typedef struct LDKCResultTempl_C2TupleTempl_ThirtyTwoBytes__ChannelManager_____DecodeError LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ; + /** @@ -2635,6 +2709,28 @@ typedef struct MUST_USE_STRUCT LDKDataLossProtect { bool is_owned; } LDKDataLossProtect; +typedef union LDKCResultPtr_NetAddress__u8 { + struct LDKNetAddress *result; + uint8_t *err; +} LDKCResultPtr_NetAddress__u8; + +typedef struct LDKCResultTempl_NetAddress__u8 { + union LDKCResultPtr_NetAddress__u8 contents; + bool result_ok; +} LDKCResultTempl_NetAddress__u8; + +typedef union LDKCResultPtr_CResultTempl_NetAddress__u8_____DecodeError { + struct LDKCResultTempl_NetAddress__u8 *result; + struct LDKDecodeError *err; +} LDKCResultPtr_CResultTempl_NetAddress__u8_____DecodeError; + +typedef struct LDKCResultTempl_CResultTempl_NetAddress__u8_____DecodeError { + union LDKCResultPtr_CResultTempl_NetAddress__u8_____DecodeError contents; + bool result_ok; +} LDKCResultTempl_CResultTempl_NetAddress__u8_____DecodeError; + +typedef struct LDKCResultTempl_CResultTempl_NetAddress__u8_____DecodeError LDKCResult_CResult_NetAddressu8ZDecodeErrorZ; + /** @@ -2820,21 +2916,21 @@ typedef struct LDKRoutingMessageHandler { * Handle an incoming node_announcement message, returning true if it should be forwarded on, * false or returning an Err otherwise. */ - LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *msg); + LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); /** * Handle a channel_announcement message, returning true if it should be forwarded on, false * or returning an Err otherwise. */ - LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *msg); + LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg); /** * Handle an incoming channel_update message, returning true if it should be forwarded on, * false or returning an Err otherwise. */ - LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *msg); + LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); /** * Handle some updates to the route graph that we learned due to an outbound failed payment. */ - void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *update); + void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update); /** * Gets a subset of the channel announcements and updates required to dump our routing table * to a remote node, starting at the short_channel_id indicated by starting_point and @@ -2853,7 +2949,7 @@ typedef struct LDKRoutingMessageHandler { * perform routing table synchronization using a strategy defined by the * implementor. */ - void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *init); + void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init); /** * Handles the reply of a query we initiated to learn about channels * for a given range of blocks. We can expect to receive one or more @@ -2881,6 +2977,162 @@ typedef struct LDKRoutingMessageHandler { void (*free)(void *this_arg); } LDKRoutingMessageHandler; +typedef union LDKCResultPtr_ChannelReestablish__DecodeError { + struct LDKChannelReestablish *result; + struct LDKDecodeError *err; +} LDKCResultPtr_ChannelReestablish__DecodeError; + +typedef struct LDKCResultTempl_ChannelReestablish__DecodeError { + union LDKCResultPtr_ChannelReestablish__DecodeError contents; + bool result_ok; +} LDKCResultTempl_ChannelReestablish__DecodeError; + +typedef struct LDKCResultTempl_ChannelReestablish__DecodeError LDKCResult_ChannelReestablishDecodeErrorZ; + +typedef union LDKCResultPtr_Init__DecodeError { + struct LDKInit *result; + struct LDKDecodeError *err; +} LDKCResultPtr_Init__DecodeError; + +typedef struct LDKCResultTempl_Init__DecodeError { + union LDKCResultPtr_Init__DecodeError contents; + bool result_ok; +} LDKCResultTempl_Init__DecodeError; + +typedef struct LDKCResultTempl_Init__DecodeError LDKCResult_InitDecodeErrorZ; + +typedef union LDKCResultPtr_Ping__DecodeError { + struct LDKPing *result; + struct LDKDecodeError *err; +} LDKCResultPtr_Ping__DecodeError; + +typedef struct LDKCResultTempl_Ping__DecodeError { + union LDKCResultPtr_Ping__DecodeError contents; + bool result_ok; +} LDKCResultTempl_Ping__DecodeError; + +typedef struct LDKCResultTempl_Ping__DecodeError LDKCResult_PingDecodeErrorZ; + +typedef union LDKCResultPtr_Pong__DecodeError { + struct LDKPong *result; + struct LDKDecodeError *err; +} LDKCResultPtr_Pong__DecodeError; + +typedef struct LDKCResultTempl_Pong__DecodeError { + union LDKCResultPtr_Pong__DecodeError contents; + bool result_ok; +} LDKCResultTempl_Pong__DecodeError; + +typedef struct LDKCResultTempl_Pong__DecodeError LDKCResult_PongDecodeErrorZ; + +typedef union LDKCResultPtr_UnsignedChannelAnnouncement__DecodeError { + struct LDKUnsignedChannelAnnouncement *result; + struct LDKDecodeError *err; +} LDKCResultPtr_UnsignedChannelAnnouncement__DecodeError; + +typedef struct LDKCResultTempl_UnsignedChannelAnnouncement__DecodeError { + union LDKCResultPtr_UnsignedChannelAnnouncement__DecodeError contents; + bool result_ok; +} LDKCResultTempl_UnsignedChannelAnnouncement__DecodeError; + +typedef struct LDKCResultTempl_UnsignedChannelAnnouncement__DecodeError LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ; + +typedef union LDKCResultPtr_UnsignedChannelUpdate__DecodeError { + struct LDKUnsignedChannelUpdate *result; + struct LDKDecodeError *err; +} LDKCResultPtr_UnsignedChannelUpdate__DecodeError; + +typedef struct LDKCResultTempl_UnsignedChannelUpdate__DecodeError { + union LDKCResultPtr_UnsignedChannelUpdate__DecodeError contents; + bool result_ok; +} LDKCResultTempl_UnsignedChannelUpdate__DecodeError; + +typedef struct LDKCResultTempl_UnsignedChannelUpdate__DecodeError LDKCResult_UnsignedChannelUpdateDecodeErrorZ; + +typedef union LDKCResultPtr_ErrorMessage__DecodeError { + struct LDKErrorMessage *result; + struct LDKDecodeError *err; +} LDKCResultPtr_ErrorMessage__DecodeError; + +typedef struct LDKCResultTempl_ErrorMessage__DecodeError { + union LDKCResultPtr_ErrorMessage__DecodeError contents; + bool result_ok; +} LDKCResultTempl_ErrorMessage__DecodeError; + +typedef struct LDKCResultTempl_ErrorMessage__DecodeError LDKCResult_ErrorMessageDecodeErrorZ; + +typedef union LDKCResultPtr_UnsignedNodeAnnouncement__DecodeError { + struct LDKUnsignedNodeAnnouncement *result; + struct LDKDecodeError *err; +} LDKCResultPtr_UnsignedNodeAnnouncement__DecodeError; + +typedef struct LDKCResultTempl_UnsignedNodeAnnouncement__DecodeError { + union LDKCResultPtr_UnsignedNodeAnnouncement__DecodeError contents; + bool result_ok; +} LDKCResultTempl_UnsignedNodeAnnouncement__DecodeError; + +typedef struct LDKCResultTempl_UnsignedNodeAnnouncement__DecodeError LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ; + +typedef union LDKCResultPtr_QueryShortChannelIds__DecodeError { + struct LDKQueryShortChannelIds *result; + struct LDKDecodeError *err; +} LDKCResultPtr_QueryShortChannelIds__DecodeError; + +typedef struct LDKCResultTempl_QueryShortChannelIds__DecodeError { + union LDKCResultPtr_QueryShortChannelIds__DecodeError contents; + bool result_ok; +} LDKCResultTempl_QueryShortChannelIds__DecodeError; + +typedef struct LDKCResultTempl_QueryShortChannelIds__DecodeError LDKCResult_QueryShortChannelIdsDecodeErrorZ; + +typedef union LDKCResultPtr_ReplyShortChannelIdsEnd__DecodeError { + struct LDKReplyShortChannelIdsEnd *result; + struct LDKDecodeError *err; +} LDKCResultPtr_ReplyShortChannelIdsEnd__DecodeError; + +typedef struct LDKCResultTempl_ReplyShortChannelIdsEnd__DecodeError { + union LDKCResultPtr_ReplyShortChannelIdsEnd__DecodeError contents; + bool result_ok; +} LDKCResultTempl_ReplyShortChannelIdsEnd__DecodeError; + +typedef struct LDKCResultTempl_ReplyShortChannelIdsEnd__DecodeError LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ; + +typedef union LDKCResultPtr_QueryChannelRange__DecodeError { + struct LDKQueryChannelRange *result; + struct LDKDecodeError *err; +} LDKCResultPtr_QueryChannelRange__DecodeError; + +typedef struct LDKCResultTempl_QueryChannelRange__DecodeError { + union LDKCResultPtr_QueryChannelRange__DecodeError contents; + bool result_ok; +} LDKCResultTempl_QueryChannelRange__DecodeError; + +typedef struct LDKCResultTempl_QueryChannelRange__DecodeError LDKCResult_QueryChannelRangeDecodeErrorZ; + +typedef union LDKCResultPtr_ReplyChannelRange__DecodeError { + struct LDKReplyChannelRange *result; + struct LDKDecodeError *err; +} LDKCResultPtr_ReplyChannelRange__DecodeError; + +typedef struct LDKCResultTempl_ReplyChannelRange__DecodeError { + union LDKCResultPtr_ReplyChannelRange__DecodeError contents; + bool result_ok; +} LDKCResultTempl_ReplyChannelRange__DecodeError; + +typedef struct LDKCResultTempl_ReplyChannelRange__DecodeError LDKCResult_ReplyChannelRangeDecodeErrorZ; + +typedef union LDKCResultPtr_GossipTimestampFilter__DecodeError { + struct LDKGossipTimestampFilter *result; + struct LDKDecodeError *err; +} LDKCResultPtr_GossipTimestampFilter__DecodeError; + +typedef struct LDKCResultTempl_GossipTimestampFilter__DecodeError { + union LDKCResultPtr_GossipTimestampFilter__DecodeError contents; + bool result_ok; +} LDKCResultTempl_GossipTimestampFilter__DecodeError; + +typedef struct LDKCResultTempl_GossipTimestampFilter__DecodeError LDKCResult_GossipTimestampFilterDecodeErrorZ; + /** @@ -2935,7 +3187,7 @@ typedef struct LDKSocketDescriptor { * socket_disconnected but prior to socket_disconnected returning. */ void (*disconnect_socket)(void *this_arg); - bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *other_arg); + bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg); uint64_t (*hash)(const void *this_arg); void *(*clone)(const void *this_arg); void (*free)(void *this_arg); @@ -3125,6 +3377,18 @@ typedef struct LDKCVecTempl_CVecTempl_RouteHop { typedef struct LDKCVecTempl_CVecTempl_RouteHop LDKCVec_CVec_RouteHopZZ; +typedef union LDKCResultPtr_Route__DecodeError { + struct LDKRoute *result; + struct LDKDecodeError *err; +} LDKCResultPtr_Route__DecodeError; + +typedef struct LDKCResultTempl_Route__DecodeError { + union LDKCResultPtr_Route__DecodeError contents; + bool result_ok; +} LDKCResultTempl_Route__DecodeError; + +typedef struct LDKCResultTempl_Route__DecodeError LDKCResult_RouteDecodeErrorZ; + /** @@ -3250,6 +3514,18 @@ typedef struct MUST_USE_STRUCT LDKChannelInfo { bool is_owned; } LDKChannelInfo; +typedef union LDKCResultPtr_RoutingFees__DecodeError { + struct LDKRoutingFees *result; + struct LDKDecodeError *err; +} LDKCResultPtr_RoutingFees__DecodeError; + +typedef struct LDKCResultTempl_RoutingFees__DecodeError { + union LDKCResultPtr_RoutingFees__DecodeError contents; + bool result_ok; +} LDKCResultTempl_RoutingFees__DecodeError; + +typedef struct LDKCResultTempl_RoutingFees__DecodeError LDKCResult_RoutingFeesDecodeErrorZ; + /** @@ -3264,6 +3540,18 @@ typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo { bool is_owned; } LDKNodeAnnouncementInfo; +typedef union LDKCResultPtr_NodeAnnouncementInfo__DecodeError { + struct LDKNodeAnnouncementInfo *result; + struct LDKDecodeError *err; +} LDKCResultPtr_NodeAnnouncementInfo__DecodeError; + +typedef struct LDKCResultTempl_NodeAnnouncementInfo__DecodeError { + union LDKCResultPtr_NodeAnnouncementInfo__DecodeError contents; + bool result_ok; +} LDKCResultTempl_NodeAnnouncementInfo__DecodeError; + +typedef struct LDKCResultTempl_NodeAnnouncementInfo__DecodeError LDKCResult_NodeAnnouncementInfoDecodeErrorZ; + /** @@ -3278,6 +3566,32 @@ typedef struct MUST_USE_STRUCT LDKNodeInfo { bool is_owned; } LDKNodeInfo; +typedef union LDKCResultPtr_NodeInfo__DecodeError { + struct LDKNodeInfo *result; + struct LDKDecodeError *err; +} LDKCResultPtr_NodeInfo__DecodeError; + +typedef struct LDKCResultTempl_NodeInfo__DecodeError { + union LDKCResultPtr_NodeInfo__DecodeError contents; + bool result_ok; +} LDKCResultTempl_NodeInfo__DecodeError; + +typedef struct LDKCResultTempl_NodeInfo__DecodeError LDKCResult_NodeInfoDecodeErrorZ; + +typedef union LDKCResultPtr_NetworkGraph__DecodeError { + struct LDKNetworkGraph *result; + struct LDKDecodeError *err; +} LDKCResultPtr_NetworkGraph__DecodeError; + +typedef struct LDKCResultTempl_NetworkGraph__DecodeError { + union LDKCResultPtr_NetworkGraph__DecodeError contents; + bool result_ok; +} LDKCResultTempl_NetworkGraph__DecodeError; + +typedef struct LDKCResultTempl_NetworkGraph__DecodeError LDKCResult_NetworkGraphDecodeErrorZ; + +typedef struct LDKCResultTempl_NetAddress__u8 LDKCResult_NetAddressu8Z; + typedef struct LDKCVecTempl_RouteHop LDKCVec_RouteHopZ; extern const void (*CVec_SpendableOutputDescriptorZ_free)(LDKCVec_SpendableOutputDescriptorZ); @@ -3296,6 +3610,12 @@ extern const LDKCResult_NoneChannelMonitorUpdateErrZ (*CResult_NoneChannelMonito extern const void (*CVec_MonitorEventZ_free)(LDKCVec_MonitorEventZ); +extern const void (*CResult_ChannelMonitorUpdateDecodeErrorZ_free)(LDKCResult_ChannelMonitorUpdateDecodeErrorZ); + +extern const LDKCResult_ChannelMonitorUpdateDecodeErrorZ (*CResult_ChannelMonitorUpdateDecodeErrorZ_ok)(struct LDKChannelMonitorUpdate); + +extern const LDKCResult_ChannelMonitorUpdateDecodeErrorZ (*CResult_ChannelMonitorUpdateDecodeErrorZ_err)(struct LDKDecodeError); + extern const void (*CResult_NoneMonitorUpdateErrorZ_free)(LDKCResult_NoneMonitorUpdateErrorZ); extern const LDKCResult_NoneMonitorUpdateErrorZ (*CResult_NoneMonitorUpdateErrorZ_err)(struct LDKMonitorUpdateError); @@ -3312,8 +3632,22 @@ extern const void (*C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free)(LDKC2Tuple_TxidCV extern const void (*CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free)(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ); +extern const void (*C2Tuple_BlockHashChannelMonitorZ_free)(LDKC2Tuple_BlockHashChannelMonitorZ); + +extern const void (*CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free)(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ); + +extern const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ (*CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok)(LDKC2Tuple_BlockHashChannelMonitorZ); + +extern const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ (*CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err)(struct LDKDecodeError); + extern const void (*C2Tuple_u64u64Z_free)(LDKC2Tuple_u64u64Z); +extern const void (*CResult_SpendableOutputDescriptorDecodeErrorZ_free)(LDKCResult_SpendableOutputDescriptorDecodeErrorZ); + +extern const LDKCResult_SpendableOutputDescriptorDecodeErrorZ (*CResult_SpendableOutputDescriptorDecodeErrorZ_ok)(struct LDKSpendableOutputDescriptor); + +extern const LDKCResult_SpendableOutputDescriptorDecodeErrorZ (*CResult_SpendableOutputDescriptorDecodeErrorZ_err)(struct LDKDecodeError); + extern const void (*CVec_SignatureZ_free)(LDKCVec_SignatureZ); extern const void (*C2Tuple_SignatureCVec_SignatureZZ_free)(LDKC2Tuple_SignatureCVec_SignatureZZ); @@ -3332,6 +3666,12 @@ extern const LDKCResult_ChanKeySignerDecodeErrorZ (*CResult_ChanKeySignerDecodeE extern const LDKCResult_ChanKeySignerDecodeErrorZ (*CResult_ChanKeySignerDecodeErrorZ_err)(struct LDKDecodeError); +extern const void (*CResult_InMemoryChannelKeysDecodeErrorZ_free)(LDKCResult_InMemoryChannelKeysDecodeErrorZ); + +extern const LDKCResult_InMemoryChannelKeysDecodeErrorZ (*CResult_InMemoryChannelKeysDecodeErrorZ_ok)(struct LDKInMemoryChannelKeys); + +extern const LDKCResult_InMemoryChannelKeysDecodeErrorZ (*CResult_InMemoryChannelKeysDecodeErrorZ_err)(struct LDKDecodeError); + extern const void (*CResult_TxOutAccessErrorZ_free)(LDKCResult_TxOutAccessErrorZ); extern const LDKCResult_TxOutAccessErrorZ (*CResult_TxOutAccessErrorZ_ok)(struct LDKTxOut); @@ -3352,6 +3692,26 @@ extern const void (*CVec_NetAddressZ_free)(LDKCVec_NetAddressZ); extern const void (*CVec_ChannelMonitorZ_free)(LDKCVec_ChannelMonitorZ); +extern const void (*C2Tuple_BlockHashChannelManagerZ_free)(LDKC2Tuple_BlockHashChannelManagerZ); + +extern const void (*CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free)(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ); + +extern const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ (*CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok)(LDKC2Tuple_BlockHashChannelManagerZ); + +extern const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ (*CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_NetAddressu8Z_free)(LDKCResult_NetAddressu8Z); + +extern const LDKCResult_NetAddressu8Z (*CResult_NetAddressu8Z_ok)(struct LDKNetAddress); + +extern const LDKCResult_NetAddressu8Z (*CResult_NetAddressu8Z_err)(uint8_t); + +extern const void (*CResult_CResult_NetAddressu8ZDecodeErrorZ_free)(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ); + +extern const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ (*CResult_CResult_NetAddressu8ZDecodeErrorZ_ok)(LDKCResult_NetAddressu8Z); + +extern const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ (*CResult_CResult_NetAddressu8ZDecodeErrorZ_err)(struct LDKDecodeError); + extern const void (*CVec_u64Z_free)(LDKCVec_u64Z); extern const void (*CVec_UpdateAddHTLCZ_free)(LDKCVec_UpdateAddHTLCZ); @@ -3378,6 +3738,84 @@ extern const void (*CResult_NoneLightningErrorZ_free)(LDKCResult_NoneLightningEr extern const LDKCResult_NoneLightningErrorZ (*CResult_NoneLightningErrorZ_err)(struct LDKLightningError); +extern const void (*CResult_ChannelReestablishDecodeErrorZ_free)(LDKCResult_ChannelReestablishDecodeErrorZ); + +extern const LDKCResult_ChannelReestablishDecodeErrorZ (*CResult_ChannelReestablishDecodeErrorZ_ok)(struct LDKChannelReestablish); + +extern const LDKCResult_ChannelReestablishDecodeErrorZ (*CResult_ChannelReestablishDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_InitDecodeErrorZ_free)(LDKCResult_InitDecodeErrorZ); + +extern const LDKCResult_InitDecodeErrorZ (*CResult_InitDecodeErrorZ_ok)(struct LDKInit); + +extern const LDKCResult_InitDecodeErrorZ (*CResult_InitDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_PingDecodeErrorZ_free)(LDKCResult_PingDecodeErrorZ); + +extern const LDKCResult_PingDecodeErrorZ (*CResult_PingDecodeErrorZ_ok)(struct LDKPing); + +extern const LDKCResult_PingDecodeErrorZ (*CResult_PingDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_PongDecodeErrorZ_free)(LDKCResult_PongDecodeErrorZ); + +extern const LDKCResult_PongDecodeErrorZ (*CResult_PongDecodeErrorZ_ok)(struct LDKPong); + +extern const LDKCResult_PongDecodeErrorZ (*CResult_PongDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_UnsignedChannelAnnouncementDecodeErrorZ_free)(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ); + +extern const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ (*CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok)(struct LDKUnsignedChannelAnnouncement); + +extern const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ (*CResult_UnsignedChannelAnnouncementDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_UnsignedChannelUpdateDecodeErrorZ_free)(LDKCResult_UnsignedChannelUpdateDecodeErrorZ); + +extern const LDKCResult_UnsignedChannelUpdateDecodeErrorZ (*CResult_UnsignedChannelUpdateDecodeErrorZ_ok)(struct LDKUnsignedChannelUpdate); + +extern const LDKCResult_UnsignedChannelUpdateDecodeErrorZ (*CResult_UnsignedChannelUpdateDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_ErrorMessageDecodeErrorZ_free)(LDKCResult_ErrorMessageDecodeErrorZ); + +extern const LDKCResult_ErrorMessageDecodeErrorZ (*CResult_ErrorMessageDecodeErrorZ_ok)(struct LDKErrorMessage); + +extern const LDKCResult_ErrorMessageDecodeErrorZ (*CResult_ErrorMessageDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_UnsignedNodeAnnouncementDecodeErrorZ_free)(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ); + +extern const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ (*CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok)(struct LDKUnsignedNodeAnnouncement); + +extern const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ (*CResult_UnsignedNodeAnnouncementDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_QueryShortChannelIdsDecodeErrorZ_free)(LDKCResult_QueryShortChannelIdsDecodeErrorZ); + +extern const LDKCResult_QueryShortChannelIdsDecodeErrorZ (*CResult_QueryShortChannelIdsDecodeErrorZ_ok)(struct LDKQueryShortChannelIds); + +extern const LDKCResult_QueryShortChannelIdsDecodeErrorZ (*CResult_QueryShortChannelIdsDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_ReplyShortChannelIdsEndDecodeErrorZ_free)(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ); + +extern const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ (*CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok)(struct LDKReplyShortChannelIdsEnd); + +extern const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ (*CResult_ReplyShortChannelIdsEndDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_QueryChannelRangeDecodeErrorZ_free)(LDKCResult_QueryChannelRangeDecodeErrorZ); + +extern const LDKCResult_QueryChannelRangeDecodeErrorZ (*CResult_QueryChannelRangeDecodeErrorZ_ok)(struct LDKQueryChannelRange); + +extern const LDKCResult_QueryChannelRangeDecodeErrorZ (*CResult_QueryChannelRangeDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_ReplyChannelRangeDecodeErrorZ_free)(LDKCResult_ReplyChannelRangeDecodeErrorZ); + +extern const LDKCResult_ReplyChannelRangeDecodeErrorZ (*CResult_ReplyChannelRangeDecodeErrorZ_ok)(struct LDKReplyChannelRange); + +extern const LDKCResult_ReplyChannelRangeDecodeErrorZ (*CResult_ReplyChannelRangeDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_GossipTimestampFilterDecodeErrorZ_free)(LDKCResult_GossipTimestampFilterDecodeErrorZ); + +extern const LDKCResult_GossipTimestampFilterDecodeErrorZ (*CResult_GossipTimestampFilterDecodeErrorZ_ok)(struct LDKGossipTimestampFilter); + +extern const LDKCResult_GossipTimestampFilterDecodeErrorZ (*CResult_GossipTimestampFilterDecodeErrorZ_err)(struct LDKDecodeError); + extern const void (*CVec_PublicKeyZ_free)(LDKCVec_PublicKeyZ); extern const void (*CVec_u8Z_free)(LDKCVec_u8Z); @@ -3428,6 +3866,12 @@ extern const void (*CVec_RouteHopZ_free)(LDKCVec_RouteHopZ); extern const void (*CVec_CVec_RouteHopZZ_free)(LDKCVec_CVec_RouteHopZZ); +extern const void (*CResult_RouteDecodeErrorZ_free)(LDKCResult_RouteDecodeErrorZ); + +extern const LDKCResult_RouteDecodeErrorZ (*CResult_RouteDecodeErrorZ_ok)(struct LDKRoute); + +extern const LDKCResult_RouteDecodeErrorZ (*CResult_RouteDecodeErrorZ_err)(struct LDKDecodeError); + extern const void (*CVec_RouteHintZ_free)(LDKCVec_RouteHintZ); extern const void (*CResult_RouteLightningErrorZ_free)(LDKCResult_RouteLightningErrorZ); @@ -3436,6 +3880,30 @@ extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_ok)( extern const LDKCResult_RouteLightningErrorZ (*CResult_RouteLightningErrorZ_err)(struct LDKLightningError); +extern const void (*CResult_RoutingFeesDecodeErrorZ_free)(LDKCResult_RoutingFeesDecodeErrorZ); + +extern const LDKCResult_RoutingFeesDecodeErrorZ (*CResult_RoutingFeesDecodeErrorZ_ok)(struct LDKRoutingFees); + +extern const LDKCResult_RoutingFeesDecodeErrorZ (*CResult_RoutingFeesDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_NodeAnnouncementInfoDecodeErrorZ_free)(LDKCResult_NodeAnnouncementInfoDecodeErrorZ); + +extern const LDKCResult_NodeAnnouncementInfoDecodeErrorZ (*CResult_NodeAnnouncementInfoDecodeErrorZ_ok)(struct LDKNodeAnnouncementInfo); + +extern const LDKCResult_NodeAnnouncementInfoDecodeErrorZ (*CResult_NodeAnnouncementInfoDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_NodeInfoDecodeErrorZ_free)(LDKCResult_NodeInfoDecodeErrorZ); + +extern const LDKCResult_NodeInfoDecodeErrorZ (*CResult_NodeInfoDecodeErrorZ_ok)(struct LDKNodeInfo); + +extern const LDKCResult_NodeInfoDecodeErrorZ (*CResult_NodeInfoDecodeErrorZ_err)(struct LDKDecodeError); + +extern const void (*CResult_NetworkGraphDecodeErrorZ_free)(LDKCResult_NetworkGraphDecodeErrorZ); + +extern const LDKCResult_NetworkGraphDecodeErrorZ (*CResult_NetworkGraphDecodeErrorZ_ok)(struct LDKNetworkGraph); + +extern const LDKCResult_NetworkGraphDecodeErrorZ (*CResult_NetworkGraphDecodeErrorZ_err)(struct LDKDecodeError); + extern const uintptr_t MAX_BUF_SIZE; extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; @@ -3458,6 +3926,8 @@ LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, LDKCVec_C2Tuple_u32TxOutZZ b); +LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); + LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, LDKCVec_SignatureZ b); @@ -3470,6 +3940,8 @@ LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); +LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); + LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c); LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); @@ -3482,11 +3954,13 @@ LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); void Event_free(struct LDKEvent this_ptr); -struct LDKEvent Event_clone(const struct LDKEvent *orig); +struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); + +LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr); -struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *orig); +struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig); /** * Calls the free function if one is set @@ -3500,9 +3974,9 @@ void EventsProvider_free(struct LDKEventsProvider this_ptr); void APIError_free(struct LDKAPIError this_ptr); -struct LDKAPIError APIError_clone(const struct LDKAPIError *orig); +struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig); -enum LDKLevel Level_clone(const enum LDKLevel *orig); +enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig); /** * Returns the most verbose logging level. @@ -3516,7 +3990,7 @@ void Logger_free(struct LDKLogger this_ptr); void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_ptr); -struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *orig); +struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig); /** * Confirmations we will wait for before considering the channel locked in. @@ -3525,7 +3999,7 @@ struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKCh * * Default value: 6. */ -uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *this_ptr); +uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** * Confirmations we will wait for before considering the channel locked in. @@ -3534,7 +4008,7 @@ uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandsha * * Default value: 6. */ -void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *this_ptr, uint32_t val); +void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); /** * Set to the amount of time we require our counterparty to wait to claim their money. @@ -3550,7 +4024,7 @@ void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig * * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel * opening so you can tweak config to ask for more security, not less. */ -uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *this_ptr); +uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** * Set to the amount of time we require our counterparty to wait to claim their money. @@ -3566,7 +4040,7 @@ uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHan * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel * opening so you can tweak config to ask for more security, not less. */ -void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *this_ptr, uint16_t val); +void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); /** * Set to the smallest value HTLC we will accept to process. @@ -3577,7 +4051,7 @@ void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConf * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required * by the protocol. */ -uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *this_ptr); +uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** * Set to the smallest value HTLC we will accept to process. @@ -3588,7 +4062,7 @@ uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChanne * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required * by the protocol. */ -void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *this_ptr, uint64_t val); +void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val); MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg); @@ -3596,7 +4070,7 @@ MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(voi void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_ptr); -struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *orig); +struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig); /** * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so @@ -3604,7 +4078,7 @@ struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKCh * * Default value: 0. */ -uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *this_ptr); +uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so @@ -3612,7 +4086,7 @@ uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannel * * Default value: 0. */ -void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *this_ptr, uint64_t val); +void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows @@ -3620,7 +4094,7 @@ void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeL * * Default value: u64::max_value. */ -uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *this_ptr); +uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows @@ -3628,7 +4102,7 @@ uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChanne * * Default value: u64::max_value. */ -void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *this_ptr, uint64_t val); +void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** * The remote node sets a limit on the maximum value of pending HTLCs to them at any given @@ -3636,7 +4110,7 @@ void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshake * * Default value: 0. */ -uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *this_ptr); +uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * The remote node sets a limit on the maximum value of pending HTLCs to them at any given @@ -3644,7 +4118,7 @@ uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const stru * * Default value: 0. */ -void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *this_ptr, uint64_t val); +void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** * The remote node will require we keep a certain amount in direct payment to ourselves at all @@ -3653,7 +4127,7 @@ void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChan * * Default value: u64::max_value. */ -uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *this_ptr); +uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * The remote node will require we keep a certain amount in direct payment to ourselves at all @@ -3662,7 +4136,7 @@ uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LD * * Default value: u64::max_value. */ -void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *this_ptr, uint64_t val); +void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** * The remote node sets a limit on the maximum number of pending HTLCs to them at any given @@ -3670,7 +4144,7 @@ void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHa * * Default value: 0. */ -uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *this_ptr); +uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * The remote node sets a limit on the maximum number of pending HTLCs to them at any given @@ -3678,7 +4152,7 @@ uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChann * * Default value: 0. */ -void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *this_ptr, uint16_t val); +void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); /** * Outputs below a certain value will not be added to on-chain transactions. The dust value is @@ -3691,7 +4165,7 @@ void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshak * * Default value: 546, the current dust limit on the Bitcoin network. */ -uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *this_ptr); +uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * Outputs below a certain value will not be added to on-chain transactions. The dust value is @@ -3704,7 +4178,7 @@ uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChan * * Default value: 546, the current dust limit on the Bitcoin network. */ -void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *this_ptr, uint64_t val); +void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** * Maximum allowed threshold above which outputs will not be generated in their commitment @@ -3713,7 +4187,7 @@ void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandsha * * Default value: u64::max_value. */ -uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *this_ptr); +uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * Maximum allowed threshold above which outputs will not be generated in their commitment @@ -3722,7 +4196,7 @@ uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChan * * Default value: u64::max_value. */ -void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *this_ptr, uint64_t val); +void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** * Before a channel is usable the funding transaction will need to be confirmed by at least a @@ -3732,7 +4206,7 @@ void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandsha * * Default value: 144, or roughly one day and only applies to outbound channels. */ -uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *this_ptr); +uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * Before a channel is usable the funding transaction will need to be confirmed by at least a @@ -3742,7 +4216,7 @@ uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHan * * Default value: 144, or roughly one day and only applies to outbound channels. */ -void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *this_ptr, uint32_t val); +void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val); /** * Set to force the incoming channel to match our announced channel preference in @@ -3751,7 +4225,7 @@ void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimi * Default value: true, to make the default that no announced channels are possible (which is * appropriate for any nodes which are not online very reliably). */ -bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *this_ptr); +bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * Set to force the incoming channel to match our announced channel preference in @@ -3760,7 +4234,7 @@ bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct * Default value: true, to make the default that no announced channels are possible (which is * appropriate for any nodes which are not online very reliably). */ -void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *this_ptr, bool val); +void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); /** * Set to the amount of time we're willing to wait to claim money back to us. @@ -3771,7 +4245,7 @@ void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKCha * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts) */ -uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *this_ptr); +uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** * Set to the amount of time we're willing to wait to claim money back to us. @@ -3782,7 +4256,7 @@ uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelH * Default value: MAX_LOCAL_BREAKDOWN_TIMEOUT (1008), which we also enforce as a maximum value * so you can tweak config to reduce the loss of having useless locked funds (if your peer accepts) */ -void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *this_ptr, uint16_t val); +void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint64_t min_dust_limit_satoshis_arg, uint64_t max_dust_limit_satoshis_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg); @@ -3790,7 +4264,7 @@ MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(voi void ChannelConfig_free(struct LDKChannelConfig this_ptr); -struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *orig); +struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); /** * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi. @@ -3799,7 +4273,7 @@ struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *orig) * * Default value: 0. */ -uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *this_ptr); +uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi. @@ -3808,7 +4282,7 @@ uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelCo * * Default value: 0. */ -void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *this_ptr, uint32_t val); +void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); /** * Set to announce the channel publicly and notify all nodes that they can route via this @@ -3823,7 +4297,7 @@ void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *this * * Default value: false. */ -bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *this_ptr); +bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** * Set to announce the channel publicly and notify all nodes that they can route via this @@ -3838,7 +4312,7 @@ bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *this_ptr * * Default value: false. */ -void ChannelConfig_set_announced_channel(struct LDKChannelConfig *this_ptr, bool val); +void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); /** * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty @@ -3853,7 +4327,7 @@ void ChannelConfig_set_announced_channel(struct LDKChannelConfig *this_ptr, bool * * Default value: true. */ -bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *this_ptr); +bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty @@ -3868,55 +4342,55 @@ bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelCon * * Default value: true. */ -void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *this_ptr, bool val); +void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg); MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void); -LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *obj); +LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj); struct LDKChannelConfig ChannelConfig_read(struct LDKu8slice ser); void UserConfig_free(struct LDKUserConfig this_ptr); -struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *orig); +struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); /** * Channel config that we propose to our counterparty. */ -struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *this_ptr); +struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** * Channel config that we propose to our counterparty. */ -void UserConfig_set_own_channel_config(struct LDKUserConfig *this_ptr, struct LDKChannelHandshakeConfig val); +void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); /** * Limits applied to our counterparty's proposed channel config settings. */ -struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *this_ptr); +struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** * Limits applied to our counterparty's proposed channel config settings. */ -void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *this_ptr, struct LDKChannelHandshakeLimits val); +void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); /** * Channel config which affects behavior during channel lifetime. */ -struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *this_ptr); +struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** * Channel config which affects behavior during channel lifetime. */ -void UserConfig_set_channel_options(struct LDKUserConfig *this_ptr, struct LDKChannelConfig val); +void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg); MUST_USE_RES struct LDKUserConfig UserConfig_default(void); -enum LDKAccessError AccessError_clone(const enum LDKAccessError *orig); +enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig); /** * Calls the free function if one is set @@ -3938,7 +4412,7 @@ void Filter_free(struct LDKFilter this_ptr); */ void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr); -enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *orig); +enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig); /** * Calls the free function if one is set @@ -3962,7 +4436,7 @@ void ChainMonitor_free(struct LDKChainMonitor this_ptr); * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events * [`chain::Filter`]: ../trait.Filter.html */ -void ChainMonitor_block_connected(const struct LDKChainMonitor *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); +void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); /** * Dispatches to per-channel monitors, which are responsible for updating their on-chain view @@ -3971,7 +4445,7 @@ void ChainMonitor_block_connected(const struct LDKChainMonitor *this_arg, const * * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected */ -void ChainMonitor_block_disconnected(const struct LDKChainMonitor *this_arg, const uint8_t (*header)[80], uint32_t disconnected_height); +void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height); /** * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels. @@ -3986,13 +4460,13 @@ void ChainMonitor_block_disconnected(const struct LDKChainMonitor *this_arg, con */ MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister); -struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *this_arg); +struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg); -struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *this_arg); +struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg); void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_ptr); -struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *orig); +struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig); /** * The sequence number of this update. Updates *must* be replayed in-order according to this @@ -4009,7 +4483,7 @@ struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChanne * * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html */ -uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *this_ptr); +uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr); /** * The sequence number of this update. Updates *must* be replayed in-order according to this @@ -4026,48 +4500,50 @@ uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate * * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html */ -void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *this_ptr, uint64_t val); +void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val); -LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *obj); +LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj); -struct LDKChannelMonitorUpdate ChannelMonitorUpdate_read(struct LDKu8slice ser); +LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); -enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *orig); +enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig); void MonitorUpdateError_free(struct LDKMonitorUpdateError this_ptr); void MonitorEvent_free(struct LDKMonitorEvent this_ptr); -struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *orig); +struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig); void HTLCUpdate_free(struct LDKHTLCUpdate this_ptr); -struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *orig); +struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig); -LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *obj); +LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj); struct LDKHTLCUpdate HTLCUpdate_read(struct LDKu8slice ser); void ChannelMonitor_free(struct LDKChannelMonitor this_ptr); +LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj); + /** * Updates a ChannelMonitor on the basis of some new information provided by the Channel * itself. * * panics if the given update is not the next update by update_id. */ -MUST_USE_RES LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(struct LDKChannelMonitor *this_arg, const struct LDKChannelMonitorUpdate *updates, const struct LDKBroadcasterInterface *broadcaster, const struct LDKFeeEstimator *fee_estimator, const struct LDKLogger *logger); +MUST_USE_RES LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this * ChannelMonitor. */ -MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *this_arg); +MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for. */ -MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *this_arg); +MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** * Get the list of HTLCs who's status has been updated on chain. This should be called by @@ -4075,7 +4551,7 @@ MUST_USE_RES LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const str * * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events */ -MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(struct LDKChannelMonitor *this_arg); +MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(struct LDKChannelMonitor *NONNULL_PTR this_arg); /** * Gets the list of pending events which were generated by previous actions, clearing the list @@ -4085,7 +4561,7 @@ MUST_USE_RES LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_ * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do * no internal locking in ChannelMonitors. */ -MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct LDKChannelMonitor *this_arg); +MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct LDKChannelMonitor *NONNULL_PTR this_arg); /** * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of @@ -4098,7 +4574,7 @@ MUST_USE_RES LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(struct L * out-of-band the other node operator to coordinate with him if option is available to you. * In any-case, choice is up to the user. */ -MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(struct LDKChannelMonitor *this_arg, const struct LDKLogger *logger); +MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger); /** * Processes transactions in a newly connected block, which may result in any of the following: @@ -4113,59 +4589,65 @@ MUST_USE_RES LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_tx * * [`get_outputs_to_watch`]: #method.get_outputs_to_watch */ -MUST_USE_RES LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(struct LDKChannelMonitor *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +MUST_USE_RES LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); /** * Determines if the disconnected block contained any transactions of interest and updates * appropriately. */ -void ChannelMonitor_block_disconnected(struct LDKChannelMonitor *this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +void ChannelMonitor_block_disconnected(struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); /** * Calls the free function if one is set */ void Persist_free(struct LDKPersist this_ptr); +LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg); + void OutPoint_free(struct LDKOutPoint this_ptr); -struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *orig); +struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig); /** * The referenced transaction's txid. */ -const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *this_ptr))[32]; +const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32]; /** * The referenced transaction's txid. */ -void OutPoint_set_txid(struct LDKOutPoint *this_ptr, struct LDKThirtyTwoBytes val); +void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The index of the referenced output in its transaction's vout. */ -uint16_t OutPoint_get_index(const struct LDKOutPoint *this_ptr); +uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr); /** * The index of the referenced output in its transaction's vout. */ -void OutPoint_set_index(struct LDKOutPoint *this_ptr, uint16_t val); +void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val); MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg); /** * Convert an `OutPoint` to a lightning channel id. */ -MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *this_arg); +MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg); -LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *obj); +LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj); struct LDKOutPoint OutPoint_read(struct LDKu8slice ser); void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *orig); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig); + +LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj); + +LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); -struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *orig); +struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *NONNULL_PTR orig); /** * Calls the free function if one is set @@ -4179,67 +4661,67 @@ void KeysInterface_free(struct LDKKeysInterface this_ptr); void InMemoryChannelKeys_free(struct LDKInMemoryChannelKeys this_ptr); -struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *orig); +struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *NONNULL_PTR orig); /** * Private key of anchor tx */ -const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *this_ptr))[32]; +const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; /** * Private key of anchor tx */ -void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *this_ptr, struct LDKSecretKey val); +void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder secret key for blinded revocation pubkey */ -const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *this_ptr))[32]; +const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; /** * Holder secret key for blinded revocation pubkey */ -void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *this_ptr, struct LDKSecretKey val); +void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder secret key used for our balance in counterparty-broadcasted commitment transactions */ -const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *this_ptr))[32]; +const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; /** * Holder secret key used for our balance in counterparty-broadcasted commitment transactions */ -void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *this_ptr, struct LDKSecretKey val); +void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder secret key used in HTLC tx */ -const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *this_ptr))[32]; +const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; /** * Holder secret key used in HTLC tx */ -void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *this_ptr, struct LDKSecretKey val); +void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Holder htlc secret key used in commitment tx htlc outputs */ -const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *this_ptr))[32]; +const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; /** * Holder htlc secret key used in commitment tx htlc outputs */ -void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *this_ptr, struct LDKSecretKey val); +void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** * Commitment seed */ -const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *this_ptr))[32]; +const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; /** * Commitment seed */ -void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *this_ptr, struct LDKThirtyTwoBytes val); +void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * Create a new InMemoryChannelKeys @@ -4250,7 +4732,7 @@ MUST_USE_RES struct LDKInMemoryChannelKeys InMemoryChannelKeys_new(struct LDKSec * Counterparty pubkeys. * Will panic if ready_channel wasn't called. */ -MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *this_arg); +MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); /** * The contest_delay value specified by our counterparty and applied on holder-broadcastable @@ -4258,7 +4740,7 @@ MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkey * broadcast a transaction. * Will panic if ready_channel wasn't called. */ -MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *this_arg); +MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); /** * The contest_delay value specified by us and applied on transactions broadcastable @@ -4266,19 +4748,19 @@ MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(co * if they broadcast a transaction. * Will panic if ready_channel wasn't called. */ -MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const struct LDKInMemoryChannelKeys *this_arg); +MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); /** * Whether the holder is the initiator * Will panic if ready_channel wasn't called. */ -MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *this_arg); +MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); /** * Funding outpoint * Will panic if ready_channel wasn't called. */ -MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struct LDKInMemoryChannelKeys *this_arg); +MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); /** * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or @@ -4286,13 +4768,13 @@ MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struc * * Will panic if ready_channel wasn't called. */ -MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *this_arg); +MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); -struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *this_arg); +struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); -LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *obj); +LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj); -struct LDKInMemoryChannelKeys InMemoryChannelKeys_read(struct LDKu8slice ser); +LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser); void KeysManager_free(struct LDKKeysManager this_ptr); @@ -4326,15 +4808,15 @@ MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], en * ChannelKeys::key_derivation_params and is provided inside DynamicOuputP2WSH in case of * onchain output detection for which a corresponding delayed_payment_key must be derived. */ -MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *this_arg, uint64_t channel_value_satoshis, uint64_t params_1, uint64_t params_2); +MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, uint64_t params_1, uint64_t params_2); -struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *this_arg); +struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg); void ChannelManager_free(struct LDKChannelManager this_ptr); void ChannelDetails_free(struct LDKChannelDetails this_ptr); -struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *orig); +struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); /** * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, @@ -4342,7 +4824,7 @@ struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *or * Note that this means this value is *not* persistent - it can change once during the * lifetime of the channel. */ -const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *this_ptr))[32]; +const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32]; /** * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, @@ -4350,51 +4832,51 @@ const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *th * Note that this means this value is *not* persistent - it can change once during the * lifetime of the channel. */ -void ChannelDetails_set_channel_id(struct LDKChannelDetails *this_ptr, struct LDKThirtyTwoBytes val); +void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The node_id of our counterparty */ -struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *this_ptr); +struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * The node_id of our counterparty */ -void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *this_ptr, struct LDKPublicKey val); +void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The Features the channel counterparty provided upon last connection. * Useful for routing as it is the most up-to-date copy of the counterparty's features and * many routing-relevant features are present in the init context. */ -struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *this_ptr); +struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * The Features the channel counterparty provided upon last connection. * Useful for routing as it is the most up-to-date copy of the counterparty's features and * many routing-relevant features are present in the init context. */ -void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *this_ptr, struct LDKInitFeatures val); +void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** * The value, in satoshis, of this channel as appears in the funding output */ -uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *this_ptr); +uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * The value, in satoshis, of this channel as appears in the funding output */ -void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *this_ptr, uint64_t val); +void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** * The user_id passed in to create_channel, or 0 if the channel was inbound. */ -uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *this_ptr); +uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * The user_id passed in to create_channel, or 0 if the channel was inbound. */ -void ChannelDetails_set_user_id(struct LDKChannelDetails *this_ptr, uint64_t val); +void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** * The available outbound capacity for sending HTLCs to the remote peer. This does not include @@ -4402,7 +4884,7 @@ void ChannelDetails_set_user_id(struct LDKChannelDetails *this_ptr, uint64_t val * available for inclusion in new outbound HTLCs). This further does not include any pending * outgoing HTLCs which are awaiting some other resolution to be sent. */ -uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *this_ptr); +uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * The available outbound capacity for sending HTLCs to the remote peer. This does not include @@ -4410,7 +4892,7 @@ uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetail * available for inclusion in new outbound HTLCs). This further does not include any pending * outgoing HTLCs which are awaiting some other resolution to be sent. */ -void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *this_ptr, uint64_t val); +void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** * The available inbound capacity for the remote peer to send HTLCs to us. This does not @@ -4419,7 +4901,7 @@ void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *this_pt * Note that there are some corner cases not fully handled here, so the actual available * inbound capacity may be slightly higher than this. */ -uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *this_ptr); +uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * The available inbound capacity for the remote peer to send HTLCs to us. This does not @@ -4428,19 +4910,19 @@ uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails * Note that there are some corner cases not fully handled here, so the actual available * inbound capacity may be slightly higher than this. */ -void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *this_ptr, uint64_t val); +void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b) * the peer is connected, and (c) no monitor update failure is pending resolution. */ -bool ChannelDetails_get_is_live(const struct LDKChannelDetails *this_ptr); +bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b) * the peer is connected, and (c) no monitor update failure is pending resolution. */ -void ChannelDetails_set_is_live(struct LDKChannelDetails *this_ptr, bool val); +void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); @@ -4476,13 +4958,13 @@ MUST_USE_RES struct LDKChannelManager ChannelManager_new(enum LDKNetwork network * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000. */ -MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config); +MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config); /** * Gets the list of open channels, in random order. See ChannelDetail field documentation for * more information. */ -MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *this_arg); +MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Gets the list of usable channels, in random order. Useful as an argument to @@ -4491,7 +4973,7 @@ MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct L * These are guaranteed to have their is_live value set to true, see the documentation for * ChannelDetails::is_live for more info on exactly what the criteria are. */ -MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *this_arg); +MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs @@ -4500,19 +4982,19 @@ MUST_USE_RES LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const s * * May generate a SendShutdown message event on success, which should be relayed. */ -MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *this_arg, const uint8_t (*channel_id)[32]); +MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]); /** * Force closes a channel, immediately broadcasting the latest local commitment transaction to * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager. */ -MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *this_arg, const uint8_t (*channel_id)[32]); +MUST_USE_RES LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]); /** * Force close all channels, immediately broadcasting the latest local commitment transaction * for each to the chain and rejecting new HTLCs on each. */ -void ChannelManager_force_close_all_channels(const struct LDKChannelManager *this_arg); +void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Sends a payment along a given route. @@ -4555,7 +5037,7 @@ void ChannelManager_force_close_all_channels(const struct LDKChannelManager *thi * bit set (either as required or as available). If multiple paths are present in the Route, * we assume the invoice had the basic_mpp feature set. */ -MUST_USE_RES LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *this_arg, const struct LDKRoute *route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); +MUST_USE_RES LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); /** * Call this upon creation of a funding transaction for the given channel. @@ -4568,7 +5050,7 @@ MUST_USE_RES LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(cons * May panic if the funding_txo is duplicative with some other channel (note that this should * be trivially prevented by using unique funding transaction keys per-channel). */ -void ChannelManager_funding_transaction_generated(const struct LDKChannelManager *this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKOutPoint funding_txo); +void ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKOutPoint funding_txo); /** * Generates a signed node_announcement from the given arguments and creates a @@ -4585,7 +5067,7 @@ void ChannelManager_funding_transaction_generated(const struct LDKChannelManager * * Panics if addresses is absurdly large (more than 500). */ -void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, LDKCVec_NetAddressZ addresses); +void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, LDKCVec_NetAddressZ addresses); /** * Processes HTLCs which are pending waiting on random forward delay. @@ -4593,7 +5075,7 @@ void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager * * Should only really ever be called in response to a PendingHTLCsForwardable event. * Will likely generate further events. */ -void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *this_arg); +void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * If a peer is disconnected we mark any channels with that peer as 'disabled'. @@ -4602,7 +5084,7 @@ void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager * * This method handles all the details, and must be called roughly once per minute. */ -void ChannelManager_timer_chan_freshness_every_min(const struct LDKChannelManager *this_arg); +void ChannelManager_timer_chan_freshness_every_min(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect @@ -4611,7 +5093,7 @@ void ChannelManager_timer_chan_freshness_every_min(const struct LDKChannelManage * Returns false if no payment was found to fail backwards, true if the process of failing the * HTLC backwards has been started. */ -MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *this_arg, const uint8_t (*payment_hash)[32], struct LDKThirtyTwoBytes payment_secret); +MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKThirtyTwoBytes payment_secret); /** * Provides a payment preimage in response to a PaymentReceived event, returning true and @@ -4630,12 +5112,12 @@ MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelMana * * May panic if called except in response to a PaymentReceived event. */ -MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t expected_amount); +MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t expected_amount); /** * Gets the node_id held by this ChannelManager */ -MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *this_arg); +MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Restores a single, given channel to normal operation after a @@ -4659,16 +5141,16 @@ MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDK * 4) once all remote copies are updated, you call this function with the update_id that * completed, and once it is the latest the Channel will be re-enabled. */ -void ChannelManager_channel_monitor_updated(const struct LDKChannelManager *this_arg, const struct LDKOutPoint *funding_txo, uint64_t highest_applied_update_id); +void ChannelManager_channel_monitor_updated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOutPoint *NONNULL_PTR funding_txo, uint64_t highest_applied_update_id); -struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *this_arg); +struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); -struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *this_arg); +struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Updates channel state based on transactions seen in a connected block. */ -void ChannelManager_block_connected(const struct LDKChannelManager *this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); +void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); /** * Updates channel state based on a disconnected block. @@ -4676,9 +5158,11 @@ void ChannelManager_block_connected(const struct LDKChannelManager *this_arg, co * If necessary, the channel may be force-closed without letting the counterparty participate * in the shutdown. */ -void ChannelManager_block_disconnected(const struct LDKChannelManager *this_arg, const uint8_t (*header)[80]); +void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]); -struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *this_arg); +struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); + +LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_ptr); @@ -4687,28 +5171,28 @@ void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_ptr); * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel * signing data. */ -const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *this_ptr); +const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** * The keys provider which will give us relevant keys. Some keys will be loaded during * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel * signing data. */ -void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *this_ptr, struct LDKKeysInterface val); +void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val); /** * The fee_estimator for use in the ChannelManager in the future. * * No calls to the FeeEstimator will be made during deserialization. */ -const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *this_ptr); +const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** * The fee_estimator for use in the ChannelManager in the future. * * No calls to the FeeEstimator will be made during deserialization. */ -void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *this_ptr, struct LDKFeeEstimator val); +void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val); /** * The chain::Watch for use in the ChannelManager in the future. @@ -4717,7 +5201,7 @@ void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs * * you have deserialized ChannelMonitors separately and will add them to your * chain::Watch after deserializing this ChannelManager. */ -const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *this_ptr); +const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** * The chain::Watch for use in the ChannelManager in the future. @@ -4726,45 +5210,45 @@ const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDK * you have deserialized ChannelMonitors separately and will add them to your * chain::Watch after deserializing this ChannelManager. */ -void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *this_ptr, struct LDKWatch val); +void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val); /** * The BroadcasterInterface which will be used in the ChannelManager in the future and may be * used to broadcast the latest local commitment transactions of channels which must be * force-closed during deserialization. */ -const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *this_ptr); +const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** * The BroadcasterInterface which will be used in the ChannelManager in the future and may be * used to broadcast the latest local commitment transactions of channels which must be * force-closed during deserialization. */ -void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *this_ptr, struct LDKBroadcasterInterface val); +void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); /** * The Logger for use in the ChannelManager and which may be used to log information during * deserialization. */ -const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *this_ptr); +const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** * The Logger for use in the ChannelManager and which may be used to log information during * deserialization. */ -void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *this_ptr, struct LDKLogger val); +void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val); /** * Default settings used for new channels. Any existing channels will continue to use the * runtime settings which were stored when the ChannelManager was serialized. */ -struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *this_ptr); +struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** * Default settings used for new channels. Any existing channels will continue to use the * runtime settings which were stored when the ChannelManager was serialized. */ -void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *this_ptr, struct LDKUserConfig val); +void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val); /** * Simple utility function to create a ChannelManagerReadArgs which creates the monitor @@ -4773,25 +5257,27 @@ void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs */ MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, LDKCVec_ChannelMonitorZ channel_monitors); +LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); + void DecodeError_free(struct LDKDecodeError this_ptr); void Init_free(struct LDKInit this_ptr); -struct LDKInit Init_clone(const struct LDKInit *orig); +struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); void ErrorMessage_free(struct LDKErrorMessage this_ptr); -struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *orig); +struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); /** * The channel ID involved in the error */ -const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *this_ptr))[32]; +const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32]; /** * The channel ID involved in the error */ -void ErrorMessage_set_channel_id(struct LDKErrorMessage *this_ptr, struct LDKThirtyTwoBytes val); +void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * A possibly human-readable error description. @@ -4799,7 +5285,7 @@ void ErrorMessage_set_channel_id(struct LDKErrorMessage *this_ptr, struct LDKThi * or printed to stdout). Otherwise, a well crafted error message may trigger a security * vulnerability in the terminal emulator or the logging subsystem. */ -struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *this_ptr); +struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr); /** * A possibly human-readable error description. @@ -4807,1479 +5293,1483 @@ struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *this_ptr); * or printed to stdout). Otherwise, a well crafted error message may trigger a security * vulnerability in the terminal emulator or the logging subsystem. */ -void ErrorMessage_set_data(struct LDKErrorMessage *this_ptr, LDKCVec_u8Z val); +void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, LDKCVec_u8Z val); MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z data_arg); void Ping_free(struct LDKPing this_ptr); -struct LDKPing Ping_clone(const struct LDKPing *orig); +struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig); /** * The desired response length */ -uint16_t Ping_get_ponglen(const struct LDKPing *this_ptr); +uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr); /** * The desired response length */ -void Ping_set_ponglen(struct LDKPing *this_ptr, uint16_t val); +void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); /** * The ping packet size. * This field is not sent on the wire. byteslen zeros are sent. */ -uint16_t Ping_get_byteslen(const struct LDKPing *this_ptr); +uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr); /** * The ping packet size. * This field is not sent on the wire. byteslen zeros are sent. */ -void Ping_set_byteslen(struct LDKPing *this_ptr, uint16_t val); +void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg); void Pong_free(struct LDKPong this_ptr); -struct LDKPong Pong_clone(const struct LDKPong *orig); +struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig); /** * The pong packet size. * This field is not sent on the wire. byteslen zeros are sent. */ -uint16_t Pong_get_byteslen(const struct LDKPong *this_ptr); +uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr); /** * The pong packet size. * This field is not sent on the wire. byteslen zeros are sent. */ -void Pong_set_byteslen(struct LDKPong *this_ptr, uint16_t val); +void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val); MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg); void OpenChannel_free(struct LDKOpenChannel this_ptr); -struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *orig); +struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); /** * The genesis hash of the blockchain where the channel is to be opened */ -const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *this_ptr))[32]; +const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain where the channel is to be opened */ -void OpenChannel_set_chain_hash(struct LDKOpenChannel *this_ptr, struct LDKThirtyTwoBytes val); +void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * A temporary channel ID, until the funding outpoint is announced */ -const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *this_ptr))[32]; +const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; /** * A temporary channel ID, until the funding outpoint is announced */ -void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *this_ptr, struct LDKThirtyTwoBytes val); +void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The channel value */ -uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *this_ptr); +uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The channel value */ -void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *this_ptr, uint64_t val); +void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The amount to push to the counterparty as part of the open, in milli-satoshi */ -uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *this_ptr); +uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The amount to push to the counterparty as part of the open, in milli-satoshi */ -void OpenChannel_set_push_msat(struct LDKOpenChannel *this_ptr, uint64_t val); +void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The threshold below which outputs on transactions broadcast by sender will be omitted */ -uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *this_ptr); +uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The threshold below which outputs on transactions broadcast by sender will be omitted */ -void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *this_ptr, uint64_t val); +void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *this_ptr); +uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *this_ptr, uint64_t val); +void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *this_ptr); +uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *this_ptr, uint64_t val); +void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The minimum HTLC size incoming to sender, in milli-satoshi */ -uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *this_ptr); +uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The minimum HTLC size incoming to sender, in milli-satoshi */ -void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *this_ptr, uint64_t val); +void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The feerate per 1000-weight of sender generated transactions, until updated by update_fee */ -uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *this_ptr); +uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The feerate per 1000-weight of sender generated transactions, until updated by update_fee */ -void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *this_ptr, uint32_t val); +void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val); /** * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *this_ptr); +uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -void OpenChannel_set_to_self_delay(struct LDKOpenChannel *this_ptr, uint16_t val); +void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); /** * The maximum number of inbound HTLCs towards sender */ -uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *this_ptr); +uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The maximum number of inbound HTLCs towards sender */ -void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *this_ptr, uint16_t val); +void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); /** * The sender's key controlling the funding transaction */ -struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *this_ptr); +struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The sender's key controlling the funding transaction */ -void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *this_ptr, struct LDKPublicKey val); +void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Used to derive a revocation key for transactions broadcast by counterparty */ -struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *this_ptr); +struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * Used to derive a revocation key for transactions broadcast by counterparty */ -void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *this_ptr, struct LDKPublicKey val); +void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * A payment key to sender for transactions broadcast by counterparty */ -struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *this_ptr); +struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * A payment key to sender for transactions broadcast by counterparty */ -void OpenChannel_set_payment_point(struct LDKOpenChannel *this_ptr, struct LDKPublicKey val); +void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Used to derive a payment key to sender for transactions broadcast by sender */ -struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *this_ptr); +struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * Used to derive a payment key to sender for transactions broadcast by sender */ -void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *this_ptr, struct LDKPublicKey val); +void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Used to derive an HTLC payment key to sender */ -struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *this_ptr); +struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * Used to derive an HTLC payment key to sender */ -void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *this_ptr, struct LDKPublicKey val); +void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The first to-be-broadcast-by-sender transaction's per commitment point */ -struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *this_ptr); +struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * The first to-be-broadcast-by-sender transaction's per commitment point */ -void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *this_ptr, struct LDKPublicKey val); +void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Channel flags */ -uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *this_ptr); +uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * Channel flags */ -void OpenChannel_set_channel_flags(struct LDKOpenChannel *this_ptr, uint8_t val); +void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val); void AcceptChannel_free(struct LDKAcceptChannel this_ptr); -struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *orig); +struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); /** * A temporary channel ID, until the funding outpoint is announced */ -const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *this_ptr))[32]; +const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32]; /** * A temporary channel ID, until the funding outpoint is announced */ -void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *this_ptr, struct LDKThirtyTwoBytes val); +void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The threshold below which outputs on transactions broadcast by sender will be omitted */ -uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *this_ptr); +uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The threshold below which outputs on transactions broadcast by sender will be omitted */ -void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *this_ptr, uint64_t val); +void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *this_ptr); +uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *this_ptr, uint64_t val); +void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *this_ptr); +uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *this_ptr, uint64_t val); +void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** * The minimum HTLC size incoming to sender, in milli-satoshi */ -uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *this_ptr); +uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The minimum HTLC size incoming to sender, in milli-satoshi */ -void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *this_ptr, uint64_t val); +void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** * Minimum depth of the funding transaction before the channel is considered open */ -uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *this_ptr); +uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * Minimum depth of the funding transaction before the channel is considered open */ -void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *this_ptr, uint32_t val); +void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val); /** * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *this_ptr); +uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *this_ptr, uint16_t val); +void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); /** * The maximum number of inbound HTLCs towards sender */ -uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *this_ptr); +uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The maximum number of inbound HTLCs towards sender */ -void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *this_ptr, uint16_t val); +void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); /** * The sender's key controlling the funding transaction */ -struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *this_ptr); +struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The sender's key controlling the funding transaction */ -void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *this_ptr, struct LDKPublicKey val); +void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Used to derive a revocation key for transactions broadcast by counterparty */ -struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *this_ptr); +struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * Used to derive a revocation key for transactions broadcast by counterparty */ -void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *this_ptr, struct LDKPublicKey val); +void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * A payment key to sender for transactions broadcast by counterparty */ -struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *this_ptr); +struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * A payment key to sender for transactions broadcast by counterparty */ -void AcceptChannel_set_payment_point(struct LDKAcceptChannel *this_ptr, struct LDKPublicKey val); +void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Used to derive a payment key to sender for transactions broadcast by sender */ -struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *this_ptr); +struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * Used to derive a payment key to sender for transactions broadcast by sender */ -void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *this_ptr, struct LDKPublicKey val); +void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty */ -struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *this_ptr); +struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty */ -void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *this_ptr, struct LDKPublicKey val); +void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The first to-be-broadcast-by-sender transaction's per commitment point */ -struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *this_ptr); +struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * The first to-be-broadcast-by-sender transaction's per commitment point */ -void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *this_ptr, struct LDKPublicKey val); +void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); void FundingCreated_free(struct LDKFundingCreated this_ptr); -struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *orig); +struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig); /** * A temporary channel ID, until the funding is established */ -const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *this_ptr))[32]; +const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; /** * A temporary channel ID, until the funding is established */ -void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *this_ptr, struct LDKThirtyTwoBytes val); +void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The funding transaction ID */ -const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *this_ptr))[32]; +const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; /** * The funding transaction ID */ -void FundingCreated_set_funding_txid(struct LDKFundingCreated *this_ptr, struct LDKThirtyTwoBytes val); +void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The specific output index funding this channel */ -uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *this_ptr); +uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** * The specific output index funding this channel */ -void FundingCreated_set_funding_output_index(struct LDKFundingCreated *this_ptr, uint16_t val); +void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val); /** * The signature of the channel initiator (funder) on the funding transaction */ -struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *this_ptr); +struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** * The signature of the channel initiator (funder) on the funding transaction */ -void FundingCreated_set_signature(struct LDKFundingCreated *this_ptr, struct LDKSignature val); +void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val); MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg); void FundingSigned_free(struct LDKFundingSigned this_ptr); -struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *orig); +struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); /** * The channel ID */ -const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *this_ptr))[32]; +const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void FundingSigned_set_channel_id(struct LDKFundingSigned *this_ptr, struct LDKThirtyTwoBytes val); +void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The signature of the channel acceptor (fundee) on the funding transaction */ -struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *this_ptr); +struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); /** * The signature of the channel acceptor (fundee) on the funding transaction */ -void FundingSigned_set_signature(struct LDKFundingSigned *this_ptr, struct LDKSignature val); +void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg); void FundingLocked_free(struct LDKFundingLocked this_ptr); -struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *orig); +struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig); /** * The channel ID */ -const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *this_ptr))[32]; +const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void FundingLocked_set_channel_id(struct LDKFundingLocked *this_ptr, struct LDKThirtyTwoBytes val); +void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The per-commitment point of the second commitment transaction */ -struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *this_ptr); +struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr); /** * The per-commitment point of the second commitment transaction */ -void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *this_ptr, struct LDKPublicKey val); +void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val); MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg); void Shutdown_free(struct LDKShutdown this_ptr); -struct LDKShutdown Shutdown_clone(const struct LDKShutdown *orig); +struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig); /** * The channel ID */ -const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *this_ptr))[32]; +const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void Shutdown_set_channel_id(struct LDKShutdown *this_ptr, struct LDKThirtyTwoBytes val); +void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The destination of this peer's funds on closing. * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. */ -struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *this_ptr); +struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr); /** * The destination of this peer's funds on closing. * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. */ -void Shutdown_set_scriptpubkey(struct LDKShutdown *this_ptr, LDKCVec_u8Z val); +void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, LDKCVec_u8Z val); MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, LDKCVec_u8Z scriptpubkey_arg); void ClosingSigned_free(struct LDKClosingSigned this_ptr); -struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *orig); +struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig); /** * The channel ID */ -const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *this_ptr))[32]; +const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void ClosingSigned_set_channel_id(struct LDKClosingSigned *this_ptr, struct LDKThirtyTwoBytes val); +void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The proposed total fee for the closing transaction */ -uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *this_ptr); +uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** * The proposed total fee for the closing transaction */ -void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *this_ptr, uint64_t val); +void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val); /** * A signature on the closing transaction */ -struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *this_ptr); +struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** * A signature on the closing transaction */ -void ClosingSigned_set_signature(struct LDKClosingSigned *this_ptr, struct LDKSignature val); +void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg); void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_ptr); -struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *orig); +struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); /** * The channel ID */ -const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *this_ptr))[32]; +const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *this_ptr, struct LDKThirtyTwoBytes val); +void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The HTLC ID */ -uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *this_ptr); +uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** * The HTLC ID */ -void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *this_ptr, uint64_t val); +void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); /** * The HTLC value in milli-satoshi */ -uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *this_ptr); +uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** * The HTLC value in milli-satoshi */ -void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *this_ptr, uint64_t val); +void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); /** * The payment hash, the pre-image of which controls HTLC redemption */ -const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *this_ptr))[32]; +const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; /** * The payment hash, the pre-image of which controls HTLC redemption */ -void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *this_ptr, struct LDKThirtyTwoBytes val); +void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The expiry height of the HTLC */ -uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *this_ptr); +uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** * The expiry height of the HTLC */ -void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *this_ptr, uint32_t val); +void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val); void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_ptr); -struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *orig); +struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig); /** * The channel ID */ -const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *this_ptr))[32]; +const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *this_ptr, struct LDKThirtyTwoBytes val); +void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The HTLC ID */ -uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *this_ptr); +uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); /** * The HTLC ID */ -void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *this_ptr, uint64_t val); +void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val); /** * The pre-image of the payment hash, allowing HTLC redemption */ -const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *this_ptr))[32]; +const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; /** * The pre-image of the payment hash, allowing HTLC redemption */ -void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *this_ptr, struct LDKThirtyTwoBytes val); +void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg); void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_ptr); -struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *orig); +struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig); /** * The channel ID */ -const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *this_ptr))[32]; +const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *this_ptr, struct LDKThirtyTwoBytes val); +void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The HTLC ID */ -uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *this_ptr); +uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); /** * The HTLC ID */ -void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *this_ptr, uint64_t val); +void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val); void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_ptr); -struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *orig); +struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig); /** * The channel ID */ -const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *this_ptr))[32]; +const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *this_ptr, struct LDKThirtyTwoBytes val); +void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The HTLC ID */ -uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *this_ptr); +uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** * The HTLC ID */ -void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *this_ptr, uint64_t val); +void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val); /** * The failure code */ -uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *this_ptr); +uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** * The failure code */ -void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *this_ptr, uint16_t val); +void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val); void CommitmentSigned_free(struct LDKCommitmentSigned this_ptr); -struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *orig); +struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig); /** * The channel ID */ -const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *this_ptr))[32]; +const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *this_ptr, struct LDKThirtyTwoBytes val); +void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * A signature on the commitment transaction */ -struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *this_ptr); +struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** * A signature on the commitment transaction */ -void CommitmentSigned_set_signature(struct LDKCommitmentSigned *this_ptr, struct LDKSignature val); +void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val); /** * Signatures on the HTLC transactions */ -void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *this_ptr, LDKCVec_SignatureZ val); +void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, LDKCVec_SignatureZ val); MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, LDKCVec_SignatureZ htlc_signatures_arg); void RevokeAndACK_free(struct LDKRevokeAndACK this_ptr); -struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *orig); +struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig); /** * The channel ID */ -const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *this_ptr))[32]; +const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *this_ptr, struct LDKThirtyTwoBytes val); +void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The secret corresponding to the per-commitment point */ -const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *this_ptr))[32]; +const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; /** * The secret corresponding to the per-commitment point */ -void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *this_ptr, struct LDKThirtyTwoBytes val); +void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The next sender-broadcast commitment transaction's per-commitment point */ -struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *this_ptr); +struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); /** * The next sender-broadcast commitment transaction's per-commitment point */ -void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *this_ptr, struct LDKPublicKey val); +void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val); MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg); void UpdateFee_free(struct LDKUpdateFee this_ptr); -struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *orig); +struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig); /** * The channel ID */ -const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *this_ptr))[32]; +const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void UpdateFee_set_channel_id(struct LDKUpdateFee *this_ptr, struct LDKThirtyTwoBytes val); +void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * Fee rate per 1000-weight of the transaction */ -uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *this_ptr); +uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr); /** * Fee rate per 1000-weight of the transaction */ -void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *this_ptr, uint32_t val); +void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val); MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg); void DataLossProtect_free(struct LDKDataLossProtect this_ptr); -struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *orig); +struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig); /** * Proof that the sender knows the per-commitment secret of a specific commitment transaction * belonging to the recipient */ -const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *this_ptr))[32]; +const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32]; /** * Proof that the sender knows the per-commitment secret of a specific commitment transaction * belonging to the recipient */ -void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *this_ptr, struct LDKThirtyTwoBytes val); +void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The sender's per-commitment point for their current commitment transaction */ -struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *this_ptr); +struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr); /** * The sender's per-commitment point for their current commitment transaction */ -void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *this_ptr, struct LDKPublicKey val); +void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val); MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg); void ChannelReestablish_free(struct LDKChannelReestablish this_ptr); -struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *orig); +struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig); /** * The channel ID */ -const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *this_ptr))[32]; +const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *this_ptr, struct LDKThirtyTwoBytes val); +void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The next commitment number for the sender */ -uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *this_ptr); +uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** * The next commitment number for the sender */ -void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *this_ptr, uint64_t val); +void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); /** * The next commitment number for the recipient */ -uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *this_ptr); +uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** * The next commitment number for the recipient */ -void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *this_ptr, uint64_t val); +void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_ptr); -struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *orig); +struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig); /** * The channel ID */ -const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *this_ptr))[32]; +const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *this_ptr, struct LDKThirtyTwoBytes val); +void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The short channel ID */ -uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *this_ptr); +uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** * The short channel ID */ -void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *this_ptr, uint64_t val); +void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val); /** * A signature by the node key */ -struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *this_ptr); +struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** * A signature by the node key */ -void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *this_ptr, struct LDKSignature val); +void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); /** * A signature by the funding key */ -struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *this_ptr); +struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** * A signature by the funding key */ -void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *this_ptr, struct LDKSignature val); +void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKSignature node_signature_arg, struct LDKSignature bitcoin_signature_arg); void NetAddress_free(struct LDKNetAddress this_ptr); -struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *orig); +struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig); + +LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj); + +LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser); void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_ptr); -struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *orig); +struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig); /** * The advertised features */ -struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *this_ptr); +struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** * The advertised features */ -void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *this_ptr, struct LDKNodeFeatures val); +void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** * A strictly monotonic announcement counter, with gaps allowed */ -uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *this_ptr); +uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** * A strictly monotonic announcement counter, with gaps allowed */ -void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *this_ptr, uint32_t val); +void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val); /** * The node_id this announcement originated from (don't rebroadcast the node_announcement back * to this node). */ -struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *this_ptr); +struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** * The node_id this announcement originated from (don't rebroadcast the node_announcement back * to this node). */ -void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *this_ptr, struct LDKPublicKey val); +void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * An RGB color for UI purposes */ -const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *this_ptr))[3]; +const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3]; /** * An RGB color for UI purposes */ -void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *this_ptr, struct LDKThreeBytes val); +void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val); /** * An alias, for UI purposes. This should be sanitized before use. There is no guarantee * of uniqueness. */ -const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *this_ptr))[32]; +const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32]; /** * An alias, for UI purposes. This should be sanitized before use. There is no guarantee * of uniqueness. */ -void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *this_ptr, struct LDKThirtyTwoBytes val); +void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * List of addresses on which this node is reachable */ -void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *this_ptr, LDKCVec_NetAddressZ val); +void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, LDKCVec_NetAddressZ val); void NodeAnnouncement_free(struct LDKNodeAnnouncement this_ptr); -struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *orig); +struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig); /** * The signature by the node key */ -struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *this_ptr); +struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** * The signature by the node key */ -void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *this_ptr, struct LDKSignature val); +void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** * The actual content of the announcement */ -struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *this_ptr); +struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** * The actual content of the announcement */ -void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *this_ptr, struct LDKUnsignedNodeAnnouncement val); +void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val); MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_ptr); -struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *orig); +struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); /** * The advertised channel features */ -struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *this_ptr); +struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * The advertised channel features */ -void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *this_ptr, struct LDKChannelFeatures val); +void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** * The genesis hash of the blockchain where the channel is to be opened */ -const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *this_ptr))[32]; +const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain where the channel is to be opened */ -void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *this_ptr, struct LDKThirtyTwoBytes val); +void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The short channel ID */ -uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *this_ptr); +uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * The short channel ID */ -void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *this_ptr, uint64_t val); +void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val); /** * One of the two node_ids which are endpoints of this channel */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *this_ptr); +struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * One of the two node_ids which are endpoints of this channel */ -void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *this_ptr, struct LDKPublicKey val); +void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The other of the two node_ids which are endpoints of this channel */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *this_ptr); +struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * The other of the two node_ids which are endpoints of this channel */ -void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *this_ptr, struct LDKPublicKey val); +void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The funding key for the first node */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *this_ptr); +struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * The funding key for the first node */ -void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *this_ptr, struct LDKPublicKey val); +void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The funding key for the second node */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *this_ptr); +struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * The funding key for the second node */ -void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *this_ptr, struct LDKPublicKey val); +void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_ptr); -struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *orig); +struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig); /** * Authentication of the announcement by the first public node */ -struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *this_ptr); +struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Authentication of the announcement by the first public node */ -void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *this_ptr, struct LDKSignature val); +void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** * Authentication of the announcement by the second public node */ -struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *this_ptr); +struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Authentication of the announcement by the second public node */ -void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *this_ptr, struct LDKSignature val); +void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** * Proof of funding UTXO ownership by the first public node */ -struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *this_ptr); +struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Proof of funding UTXO ownership by the first public node */ -void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *this_ptr, struct LDKSignature val); +void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** * Proof of funding UTXO ownership by the second public node */ -struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *this_ptr); +struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Proof of funding UTXO ownership by the second public node */ -void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *this_ptr, struct LDKSignature val); +void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** * The actual announcement */ -struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *this_ptr); +struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * The actual announcement */ -void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *this_ptr, struct LDKUnsignedChannelAnnouncement val); +void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val); MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSignature node_signature_1_arg, struct LDKSignature node_signature_2_arg, struct LDKSignature bitcoin_signature_1_arg, struct LDKSignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg); void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_ptr); -struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *orig); +struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); /** * The genesis hash of the blockchain where the channel is to be opened */ -const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *this_ptr))[32]; +const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain where the channel is to be opened */ -void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *this_ptr, struct LDKThirtyTwoBytes val); +void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The short channel ID */ -uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *this_ptr); +uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * The short channel ID */ -void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *this_ptr, uint64_t val); +void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** * A strictly monotonic announcement counter, with gaps allowed, specific to this channel */ -uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *this_ptr); +uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * A strictly monotonic announcement counter, with gaps allowed, specific to this channel */ -void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *this_ptr, uint32_t val); +void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** * Channel flags */ -uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *this_ptr); +uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * Channel flags */ -void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *this_ptr, uint8_t val); +void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val); /** * The number of blocks to subtract from incoming HTLC cltv_expiry values */ -uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *this_ptr); +uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * The number of blocks to subtract from incoming HTLC cltv_expiry values */ -void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *this_ptr, uint16_t val); +void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val); /** * The minimum HTLC size incoming to sender, in milli-satoshi */ -uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *this_ptr); +uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * The minimum HTLC size incoming to sender, in milli-satoshi */ -void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *this_ptr, uint64_t val); +void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** * The base HTLC fee charged by sender, in milli-satoshi */ -uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *this_ptr); +uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * The base HTLC fee charged by sender, in milli-satoshi */ -void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *this_ptr, uint32_t val); +void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** * The amount to fee multiplier, in micro-satoshi */ -uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *this_ptr); +uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** * The amount to fee multiplier, in micro-satoshi */ -void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *this_ptr, uint32_t val); +void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); void ChannelUpdate_free(struct LDKChannelUpdate this_ptr); -struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *orig); +struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig); /** * A signature of the channel update */ -struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *this_ptr); +struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** * A signature of the channel update */ -void ChannelUpdate_set_signature(struct LDKChannelUpdate *this_ptr, struct LDKSignature val); +void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val); /** * The actual channel update */ -struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *this_ptr); +struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** * The actual channel update */ -void ChannelUpdate_set_contents(struct LDKChannelUpdate *this_ptr, struct LDKUnsignedChannelUpdate val); +void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val); MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); void QueryChannelRange_free(struct LDKQueryChannelRange this_ptr); -struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *orig); +struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig); /** * The genesis hash of the blockchain being queried */ -const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *this_ptr))[32]; +const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain being queried */ -void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *this_ptr, struct LDKThirtyTwoBytes val); +void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The height of the first block for the channel UTXOs being queried */ -uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *this_ptr); +uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); /** * The height of the first block for the channel UTXOs being queried */ -void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *this_ptr, uint32_t val); +void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** * The number of blocks to include in the query results */ -uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *this_ptr); +uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); /** * The number of blocks to include in the query results */ -void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *this_ptr, uint32_t val); +void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg); void ReplyChannelRange_free(struct LDKReplyChannelRange this_ptr); -struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *orig); +struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig); /** * The genesis hash of the blockchain being queried */ -const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *this_ptr))[32]; +const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain being queried */ -void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *this_ptr, struct LDKThirtyTwoBytes val); +void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The height of the first block in the range of the reply */ -uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *this_ptr); +uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** * The height of the first block in the range of the reply */ -void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *this_ptr, uint32_t val); +void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** * The number of blocks included in the range of the reply */ -uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *this_ptr); +uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** * The number of blocks included in the range of the reply */ -void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *this_ptr, uint32_t val); +void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** * Indicates if the query recipient maintains up-to-date channel * information for the chain_hash */ -bool ReplyChannelRange_get_full_information(const struct LDKReplyChannelRange *this_ptr); +bool ReplyChannelRange_get_full_information(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** * Indicates if the query recipient maintains up-to-date channel * information for the chain_hash */ -void ReplyChannelRange_set_full_information(struct LDKReplyChannelRange *this_ptr, bool val); +void ReplyChannelRange_set_full_information(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val); /** * The short_channel_ids in the channel range */ -void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *this_ptr, LDKCVec_u64Z val); +void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, LDKCVec_u64Z val); MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool full_information_arg, LDKCVec_u64Z short_channel_ids_arg); void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_ptr); -struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *orig); +struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig); /** * The genesis hash of the blockchain being queried */ -const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *this_ptr))[32]; +const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain being queried */ -void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *this_ptr, struct LDKThirtyTwoBytes val); +void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The short_channel_ids that are being queried */ -void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *this_ptr, LDKCVec_u64Z val); +void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, LDKCVec_u64Z val); MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, LDKCVec_u64Z short_channel_ids_arg); void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_ptr); -struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *orig); +struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig); /** * The genesis hash of the blockchain that was queried */ -const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *this_ptr))[32]; +const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain that was queried */ -void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *this_ptr, struct LDKThirtyTwoBytes val); +void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * Indicates if the query recipient maintains up-to-date channel * information for the chain_hash */ -bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *this_ptr); +bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr); /** * Indicates if the query recipient maintains up-to-date channel * information for the chain_hash */ -void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *this_ptr, bool val); +void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val); MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg); void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_ptr); -struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *orig); +struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig); /** * The genesis hash of the blockchain for channel and node information */ -const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *this_ptr))[32]; +const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32]; /** * The genesis hash of the blockchain for channel and node information */ -void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *this_ptr, struct LDKThirtyTwoBytes val); +void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The starting unix timestamp */ -uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *this_ptr); +uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); /** * The starting unix timestamp */ -void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *this_ptr, uint32_t val); +void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); /** * The range of information in seconds */ -uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *this_ptr); +uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); /** * The range of information in seconds */ -void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *this_ptr, uint32_t val); +void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg); void ErrorAction_free(struct LDKErrorAction this_ptr); -struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *orig); +struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig); void LightningError_free(struct LDKLightningError this_ptr); /** * A human-readable message describing the error */ -struct LDKStr LightningError_get_err(const struct LDKLightningError *this_ptr); +struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr); /** * A human-readable message describing the error */ -void LightningError_set_err(struct LDKLightningError *this_ptr, LDKCVec_u8Z val); +void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, LDKCVec_u8Z val); /** * The action which should be taken against the offending peer. */ -struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *this_ptr); +struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr); /** * The action which should be taken against the offending peer. */ -void LightningError_set_action(struct LDKLightningError *this_ptr, struct LDKErrorAction val); +void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val); MUST_USE_RES struct LDKLightningError LightningError_new(LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg); void CommitmentUpdate_free(struct LDKCommitmentUpdate this_ptr); -struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *orig); +struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig); /** * update_add_htlc messages which should be sent */ -void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateAddHTLCZ val); +void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateAddHTLCZ val); /** * update_fulfill_htlc messages which should be sent */ -void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFulfillHTLCZ val); +void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFulfillHTLCZ val); /** * update_fail_htlc messages which should be sent */ -void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFailHTLCZ val); +void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFailHTLCZ val); /** * update_fail_malformed_htlc messages which should be sent */ -void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *this_ptr, LDKCVec_UpdateFailMalformedHTLCZ val); +void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, LDKCVec_UpdateFailMalformedHTLCZ val); /** * An update_fee message which should be sent */ -struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *this_ptr); +struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** * An update_fee message which should be sent */ -void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *this_ptr, struct LDKUpdateFee val); +void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val); /** * Finally, the commitment_signed message which should be sent */ -struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *this_ptr); +struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** * Finally, the commitment_signed message which should be sent */ -void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *this_ptr, struct LDKCommitmentSigned val); +void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val); MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg); void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr); -struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *orig); +struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig); /** * Calls the free function if one is set @@ -6291,129 +6781,129 @@ void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr); */ void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr); -LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *obj); +LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj); struct LDKAcceptChannel AcceptChannel_read(struct LDKu8slice ser); -LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *obj); +LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj); struct LDKAnnouncementSignatures AnnouncementSignatures_read(struct LDKu8slice ser); -LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *obj); +LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj); -struct LDKChannelReestablish ChannelReestablish_read(struct LDKu8slice ser); +LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser); -LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *obj); +LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj); struct LDKClosingSigned ClosingSigned_read(struct LDKu8slice ser); -LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *obj); +LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj); struct LDKCommitmentSigned CommitmentSigned_read(struct LDKu8slice ser); -LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *obj); +LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj); struct LDKFundingCreated FundingCreated_read(struct LDKu8slice ser); -LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *obj); +LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj); struct LDKFundingSigned FundingSigned_read(struct LDKu8slice ser); -LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *obj); +LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj); struct LDKFundingLocked FundingLocked_read(struct LDKu8slice ser); -LDKCVec_u8Z Init_write(const struct LDKInit *obj); +LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj); -struct LDKInit Init_read(struct LDKu8slice ser); +LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser); -LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *obj); +LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj); struct LDKOpenChannel OpenChannel_read(struct LDKu8slice ser); -LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *obj); +LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj); struct LDKRevokeAndACK RevokeAndACK_read(struct LDKu8slice ser); -LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *obj); +LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj); struct LDKShutdown Shutdown_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *obj); +LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj); struct LDKUpdateFailHTLC UpdateFailHTLC_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *obj); +LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj); struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *obj); +LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj); struct LDKUpdateFee UpdateFee_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *obj); +LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj); struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_read(struct LDKu8slice ser); -LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *obj); +LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj); struct LDKUpdateAddHTLC UpdateAddHTLC_read(struct LDKu8slice ser); -LDKCVec_u8Z Ping_write(const struct LDKPing *obj); +LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj); -struct LDKPing Ping_read(struct LDKu8slice ser); +LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser); -LDKCVec_u8Z Pong_write(const struct LDKPong *obj); +LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj); -struct LDKPong Pong_read(struct LDKu8slice ser); +LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser); -LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *obj); +LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj); -struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_read(struct LDKu8slice ser); +LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser); -LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *obj); +LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj); struct LDKChannelAnnouncement ChannelAnnouncement_read(struct LDKu8slice ser); -LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *obj); +LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj); -struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_read(struct LDKu8slice ser); +LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser); -LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *obj); +LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj); struct LDKChannelUpdate ChannelUpdate_read(struct LDKu8slice ser); -LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *obj); +LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj); -struct LDKErrorMessage ErrorMessage_read(struct LDKu8slice ser); +LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser); -LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *obj); +LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj); -struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_read(struct LDKu8slice ser); +LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser); -LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *obj); +LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj); struct LDKNodeAnnouncement NodeAnnouncement_read(struct LDKu8slice ser); -struct LDKQueryShortChannelIds QueryShortChannelIds_read(struct LDKu8slice ser); +LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser); -LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *obj); +LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj); -struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); +LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); -LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *obj); +LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj); -struct LDKQueryChannelRange QueryChannelRange_read(struct LDKu8slice ser); +LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); -LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *obj); +LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj); -struct LDKReplyChannelRange ReplyChannelRange_read(struct LDKu8slice ser); +LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser); -LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *obj); +LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj); -struct LDKGossipTimestampFilter GossipTimestampFilter_read(struct LDKu8slice ser); +LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser); -LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *obj); +LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj); void MessageHandler_free(struct LDKMessageHandler this_ptr); @@ -6421,29 +6911,29 @@ void MessageHandler_free(struct LDKMessageHandler this_ptr); * A message handler which handles messages specific to channels. Usually this is just a * ChannelManager object. */ -const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *this_ptr); +const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** * A message handler which handles messages specific to channels. Usually this is just a * ChannelManager object. */ -void MessageHandler_set_chan_handler(struct LDKMessageHandler *this_ptr, struct LDKChannelMessageHandler val); +void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val); /** * A message handler which handles messages updating our knowledge of the network channel * graph. Usually this is just a NetGraphMsgHandlerMonitor object. */ -const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *this_ptr); +const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** * A message handler which handles messages updating our knowledge of the network channel * graph. Usually this is just a NetGraphMsgHandlerMonitor object. */ -void MessageHandler_set_route_handler(struct LDKMessageHandler *this_ptr, struct LDKRoutingMessageHandler val); +void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val); MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg); -struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *orig); +struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig); /** * Calls the free function if one is set @@ -6456,13 +6946,13 @@ void PeerHandleError_free(struct LDKPeerHandleError this_ptr); * Used to indicate that we probably can't make any future connections to this peer, implying * we should go ahead and force-close any channels we have with it. */ -bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *this_ptr); +bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr); /** * Used to indicate that we probably can't make any future connections to this peer, implying * we should go ahead and force-close any channels we have with it. */ -void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *this_ptr, bool val); +void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val); MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg); @@ -6482,7 +6972,7 @@ MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler mess * new_outbound_connection, however entries will only appear once the initial handshake has * completed and we are sure the remote peer has the private key for the given node_id. */ -MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *this_arg); +MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); /** * Indicates a new outbound connection has been established to a node with the given node_id. @@ -6494,7 +6984,7 @@ MUST_USE_RES LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPe * Panics if descriptor is duplicative with some other descriptor which has not yet had a * socket_disconnected(). */ -MUST_USE_RES LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor); +MUST_USE_RES LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor); /** * Indicates a new inbound connection has been established. @@ -6507,7 +6997,7 @@ MUST_USE_RES LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connec * Panics if descriptor is duplicative with some other descriptor which has not yet had * socket_disconnected called. */ -MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *this_arg, struct LDKSocketDescriptor descriptor); +MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor); /** * Indicates that there is room to write data to the given socket descriptor. @@ -6521,7 +7011,7 @@ MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection( * here isn't sufficient! Panics if the descriptor was not previously registered in a * new_\\*_connection event. */ -MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *this_arg, struct LDKSocketDescriptor *descriptor); +MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor); /** * Indicates that data was read from the given socket descriptor. @@ -6537,14 +7027,14 @@ MUST_USE_RES LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avai * * Panics if the descriptor was not previously registered in a new_*_connection event. */ -MUST_USE_RES LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *this_arg, struct LDKSocketDescriptor *peer_descriptor, struct LDKu8slice data); +MUST_USE_RES LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data); /** * Checks for any events generated by our handlers and processes them. Includes sending most * response messages as well as messages generated by calls to handler functions directly (eg * functions like ChannelManager::process_pending_htlc_forward or send_payment). */ -void PeerManager_process_events(const struct LDKPeerManager *this_arg); +void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg); /** * Indicates that the given socket descriptor's connection is now closed. @@ -6556,7 +7046,7 @@ void PeerManager_process_events(const struct LDKPeerManager *this_arg); * * Panics if the descriptor was not previously registered in a successful new_*_connection event. */ -void PeerManager_socket_disconnected(const struct LDKPeerManager *this_arg, const struct LDKSocketDescriptor *descriptor); +void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor); /** * Disconnect a peer given its node id. @@ -6567,14 +7057,14 @@ void PeerManager_socket_disconnected(const struct LDKPeerManager *this_arg, cons * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer, * so be careful about reentrancy issues. */ -void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *this_arg, struct LDKPublicKey node_id, bool no_connection_possible); +void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible); /** * This function should be called roughly once every 30 seconds. * It will send pings to each peer and disconnect those which did not respond to the last round of pings. * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues! */ -void PeerManager_timer_tick_occured(const struct LDKPeerManager *this_arg); +void PeerManager_timer_tick_occured(const struct LDKPeerManager *NONNULL_PTR this_arg); /** * Build the commitment secret from the seed and the commitment number @@ -6630,83 +7120,83 @@ LDKCResult_PublicKeySecpErrorZ derive_public_revocation_key(struct LDKPublicKey void TxCreationKeys_free(struct LDKTxCreationKeys this_ptr); -struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *orig); +struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig); /** * The broadcaster's per-commitment public key which was used to derive the other keys. */ -struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *this_ptr); +struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * The broadcaster's per-commitment public key which was used to derive the other keys. */ -void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *this_ptr, struct LDKPublicKey val); +void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The revocation key which is used to allow the broadcaster of the commitment * transaction to provide their counterparty the ability to punish them if they broadcast * an old state. */ -struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *this_ptr); +struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * The revocation key which is used to allow the broadcaster of the commitment * transaction to provide their counterparty the ability to punish them if they broadcast * an old state. */ -void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *this_ptr, struct LDKPublicKey val); +void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Broadcaster's HTLC Key */ -struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *this_ptr); +struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * Broadcaster's HTLC Key */ -void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *this_ptr, struct LDKPublicKey val); +void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Countersignatory's HTLC Key */ -struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *this_ptr); +struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * Countersignatory's HTLC Key */ -void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *this_ptr, struct LDKPublicKey val); +void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *this_ptr); +struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *this_ptr, struct LDKPublicKey val); +void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKPublicKey revocation_key_arg, struct LDKPublicKey broadcaster_htlc_key_arg, struct LDKPublicKey countersignatory_htlc_key_arg, struct LDKPublicKey broadcaster_delayed_payment_key_arg); -LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *obj); +LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj); struct LDKTxCreationKeys TxCreationKeys_read(struct LDKu8slice ser); void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_ptr); -struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *orig); +struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); /** * The public key which is used to sign all commitment transactions, as it appears in the * on-chain channel lock-in 2-of-2 multisig output. */ -struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *this_ptr); +struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** * The public key which is used to sign all commitment transactions, as it appears in the * on-chain channel lock-in 2-of-2 multisig output. */ -void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *this_ptr, struct LDKPublicKey val); +void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The base point which is used (with derive_public_revocation_key) to derive per-commitment @@ -6714,7 +7204,7 @@ void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *this_ptr, * counterparty to create a secret which the counterparty can reveal to revoke previous * states. */ -struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *this_ptr); +struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** * The base point which is used (with derive_public_revocation_key) to derive per-commitment @@ -6722,51 +7212,51 @@ struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKC * counterparty to create a secret which the counterparty can reveal to revoke previous * states. */ -void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *this_ptr, struct LDKPublicKey val); +void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately * spendable primary channel balance on the broadcaster's commitment transaction. This key is * static across every commitment transaction. */ -struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *this_ptr); +struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately * spendable primary channel balance on the broadcaster's commitment transaction. This key is * static across every commitment transaction. */ -void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *this_ptr, struct LDKPublicKey val); +void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The base point which is used (with derive_public_key) to derive a per-commitment payment * public key which receives non-HTLC-encumbered funds which are only available for spending * after some delay (or can be claimed via the revocation path). */ -struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *this_ptr); +struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** * The base point which is used (with derive_public_key) to derive a per-commitment payment * public key which receives non-HTLC-encumbered funds which are only available for spending * after some delay (or can be claimed via the revocation path). */ -void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *this_ptr, struct LDKPublicKey val); +void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The base point which is used (with derive_public_key) to derive a per-commitment public key * which is used to encumber HTLC-in-flight outputs. */ -struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *this_ptr); +struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** * The base point which is used (with derive_public_key) to derive a per-commitment public key * which is used to encumber HTLC-in-flight outputs. */ -void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *this_ptr, struct LDKPublicKey val); +void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg); -LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *obj); +LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj); struct LDKChannelPublicKeys ChannelPublicKeys_read(struct LDKu8slice ser); @@ -6780,7 +7270,7 @@ MUST_USE_RES LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_derive_new(struc * Generate per-state keys from channel static keys. * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. */ -MUST_USE_RES LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *broadcaster_keys, const struct LDKChannelPublicKeys *countersignatory_keys); +MUST_USE_RES LDKCResult_TxCreationKeysSecpErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); /** * A script either spendable by the revocation @@ -6791,7 +7281,7 @@ LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_ptr); -struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *orig); +struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig); /** * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). @@ -6799,7 +7289,7 @@ struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHT * need to compare this value to whether the commitment transaction in question is that of * the counterparty or our own. */ -bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *this_ptr); +bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). @@ -6807,41 +7297,41 @@ bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment * * need to compare this value to whether the commitment transaction in question is that of * the counterparty or our own. */ -void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *this_ptr, bool val); +void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val); /** * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is * this divided by 1000. */ -uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *this_ptr); +uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is * this divided by 1000. */ -void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *this_ptr, uint64_t val); +void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val); /** * The CLTV lock-time at which this HTLC expires. */ -uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *this_ptr); +uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** * The CLTV lock-time at which this HTLC expires. */ -void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *this_ptr, uint32_t val); +void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val); /** * The hash of the preimage which unlocks this HTLC. */ -const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *this_ptr))[32]; +const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32]; /** * The hash of the preimage which unlocks this HTLC. */ -void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *this_ptr, struct LDKThirtyTwoBytes val); +void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); -LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *obj); +LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj); struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(struct LDKu8slice ser); @@ -6849,7 +7339,7 @@ struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_read(struct LDKu8slice s * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc * does not need to have its previous_output_index filled. */ -LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *htlc, const struct LDKTxCreationKeys *keys); +LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys); /** * Gets the redeemscript for a funding output from the two funding public keys. @@ -6860,98 +7350,98 @@ LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LD /** * panics if htlc.transaction_output_index.is_none()! */ -struct LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); +struct LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_ptr); -struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *orig); +struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); /** * Holder public keys */ -struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *this_ptr); +struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** * Holder public keys */ -void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *this_ptr, struct LDKChannelPublicKeys val); +void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); /** * The contest delay selected by the holder, which applies to counterparty-broadcast transactions */ -uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *this_ptr); +uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** * The contest delay selected by the holder, which applies to counterparty-broadcast transactions */ -void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *this_ptr, uint16_t val); +void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); /** * Whether the holder is the initiator of this channel. * This is an input to the commitment number obscure factor computation. */ -bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *this_ptr); +bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** * Whether the holder is the initiator of this channel. * This is an input to the commitment number obscure factor computation. */ -void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *this_ptr, bool val); +void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val); /** * The late-bound counterparty channel transaction parameters. * These parameters are populated at the point in the protocol where the counterparty provides them. */ -struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *this_ptr); +struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** * The late-bound counterparty channel transaction parameters. * These parameters are populated at the point in the protocol where the counterparty provides them. */ -void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *this_ptr, struct LDKCounterpartyChannelTransactionParameters val); +void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val); /** * The late-bound funding outpoint */ -struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *this_ptr); +struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** * The late-bound funding outpoint */ -void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *this_ptr, struct LDKOutPoint val); +void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val); MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg); void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_ptr); -struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *orig); +struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig); /** * Counter-party public keys */ -struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *this_ptr); +struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); /** * Counter-party public keys */ -void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *this_ptr, struct LDKChannelPublicKeys val); +void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); /** * The contest delay selected by the counterparty, which applies to holder-broadcast transactions */ -uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *this_ptr); +uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); /** * The contest delay selected by the counterparty, which applies to holder-broadcast transactions */ -void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *this_ptr, uint16_t val); +void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg); /** * Whether the late bound parameters are populated. */ -MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *this_arg); +MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, @@ -6959,7 +7449,7 @@ MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChan * * self.is_populated() must be true before calling this function. */ -MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *this_arg); +MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, @@ -6967,13 +7457,13 @@ MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionPa * * self.is_populated() must be true before calling this function. */ -MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *this_arg); +MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); -LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *obj); +LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj); struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser); -LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *obj); +LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj); struct LDKChannelTransactionParameters ChannelTransactionParameters_read(struct LDKu8slice ser); @@ -6982,18 +7472,18 @@ void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransact /** * Get the channel pubkeys for the broadcaster */ -MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *this_arg); +MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** * Get the channel pubkeys for the countersignatory */ -MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *this_arg); +MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** * Get the contest delay applicable to the transactions. * Note that the contest delay was selected by the countersignatory. */ -MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *this_arg); +MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** * Whether the channel is outbound from the broadcaster. @@ -7001,33 +7491,33 @@ MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const s * The boolean representing the side that initiated the channel is * an input to the commitment number obscure factor computation. */ -MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *this_arg); +MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** * The funding outpoint */ -MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *this_arg); +MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_ptr); -struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *orig); +struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig); /** * Our counterparty's signature for the transaction */ -struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *this_ptr); +struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); /** * Our counterparty's signature for the transaction */ -void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *this_ptr, struct LDKSignature val); +void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val); /** * All non-dust counterparty HTLC signatures, in the order they appear in the transaction */ -void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *this_ptr, LDKCVec_SignatureZ val); +void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, LDKCVec_SignatureZ val); -LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *obj); +LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj); struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_read(struct LDKu8slice ser); @@ -7039,17 +7529,17 @@ MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_n void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_ptr); -struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *orig); +struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig); /** * The commitment transaction */ -struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *this_ptr); +struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr); /** * The commitment transaction */ -void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *this_ptr, struct LDKTransaction val); +void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val); /** * The txid for the commitment transaction. @@ -7057,7 +7547,7 @@ void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransac * This is provided as a performance optimization, instead of calling transaction.txid() * multiple times. */ -const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *this_ptr))[32]; +const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32]; /** * The txid for the commitment transaction. @@ -7065,11 +7555,11 @@ const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitm * This is provided as a performance optimization, instead of calling transaction.txid() * multiple times. */ -void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *this_ptr, struct LDKThirtyTwoBytes val); +void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg); -LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *obj); +LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj); struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_read(struct LDKu8slice ser); @@ -7078,41 +7568,41 @@ struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_read(struct LDKu * * This can be used to verify a signature. */ -MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** * Sign a transaction, either because we are counter-signing the counterparty's transaction or * because we are about to broadcast a holder transaction. */ -MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LDKBuiltCommitmentTransaction *this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); void CommitmentTransaction_free(struct LDKCommitmentTransaction this_ptr); -struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *orig); +struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig); -LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *obj); +LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj); struct LDKCommitmentTransaction CommitmentTransaction_read(struct LDKu8slice ser); /** * The backwards-counting commitment number */ -MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *this_arg); +MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** * The value to be sent to the broadcaster */ -MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *this_arg); +MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** * The value to be sent to the counterparty */ -MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *this_arg); +MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** * The feerate paid per 1000-weight-unit in this commitment transaction. */ -MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *this_arg); +MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** * Trust our pre-built transaction and derived transaction creation public keys. @@ -7122,7 +7612,7 @@ MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommi * This should only be used if you fully trust the builder of this object. It should not *\tbe used by an external signer - instead use the verify function. */ -MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *this_arg); +MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** * Verify our pre-built transaction and derived transaction creation public keys. @@ -7132,24 +7622,24 @@ MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust( * An external validating signer must call this method before signing * or using the built transaction. */ -MUST_USE_RES LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *this_arg, const struct LDKDirectedChannelTransactionParameters *channel_parameters, const struct LDKChannelPublicKeys *broadcaster_keys, const struct LDKChannelPublicKeys *countersignatory_keys); +MUST_USE_RES LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_ptr); /** * The transaction ID of the built Bitcoin transaction */ -MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *this_arg); +MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** * The pre-built Bitcoin commitment transaction */ -MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *this_arg); +MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** * The pre-calculated transaction creation public keys. */ -MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *this_arg); +MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** * Get a signature for each HTLC which was included in the commitment transaction (ie for @@ -7157,7 +7647,7 @@ MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const st * * The returned Vec has one entry for each HTLC, and in the same order. */ -MUST_USE_RES LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *channel_parameters); +MUST_USE_RES LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters); /** * Get the transaction number obscure factor @@ -7172,79 +7662,79 @@ void ChannelFeatures_free(struct LDKChannelFeatures this_ptr); void RouteHop_free(struct LDKRouteHop this_ptr); -struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *orig); +struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); /** * The node_id of the node at this hop. */ -struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *this_ptr); +struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** * The node_id of the node at this hop. */ -void RouteHop_set_pubkey(struct LDKRouteHop *this_ptr, struct LDKPublicKey val); +void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The node_announcement features of the node at this hop. For the last hop, these may be * amended to match the features present in the invoice this node generated. */ -struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *this_ptr); +struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** * The node_announcement features of the node at this hop. For the last hop, these may be * amended to match the features present in the invoice this node generated. */ -void RouteHop_set_node_features(struct LDKRouteHop *this_ptr, struct LDKNodeFeatures val); +void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** * The channel that should be used from the previous hop to reach this node. */ -uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *this_ptr); +uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** * The channel that should be used from the previous hop to reach this node. */ -void RouteHop_set_short_channel_id(struct LDKRouteHop *this_ptr, uint64_t val); +void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); /** * The channel_announcement features of the channel that should be used from the previous hop * to reach this node. */ -struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *this_ptr); +struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** * The channel_announcement features of the channel that should be used from the previous hop * to reach this node. */ -void RouteHop_set_channel_features(struct LDKRouteHop *this_ptr, struct LDKChannelFeatures val); +void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** * The fee taken on this hop. For the last hop, this should be the full value of the payment. */ -uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *this_ptr); +uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** * The fee taken on this hop. For the last hop, this should be the full value of the payment. */ -void RouteHop_set_fee_msat(struct LDKRouteHop *this_ptr, uint64_t val); +void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); /** * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value * expected at the destination, in excess of the current block height. */ -uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *this_ptr); +uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value * expected at the destination, in excess of the current block height. */ -void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *this_ptr, uint32_t val); +void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg); void Route_free(struct LDKRoute this_ptr); -struct LDKRoute Route_clone(const struct LDKRoute *orig); +struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); /** * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the @@ -7254,67 +7744,67 @@ struct LDKRoute Route_clone(const struct LDKRoute *orig); * given path is variable, keeping the length of any path to less than 20 should currently * ensure it is viable. */ -void Route_set_paths(struct LDKRoute *this_ptr, LDKCVec_CVec_RouteHopZZ val); +void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, LDKCVec_CVec_RouteHopZZ val); MUST_USE_RES struct LDKRoute Route_new(LDKCVec_CVec_RouteHopZZ paths_arg); -LDKCVec_u8Z Route_write(const struct LDKRoute *obj); +LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); -struct LDKRoute Route_read(struct LDKu8slice ser); +LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); void RouteHint_free(struct LDKRouteHint this_ptr); -struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *orig); +struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); /** * The node_id of the non-target end of the route */ -struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *this_ptr); +struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr); /** * The node_id of the non-target end of the route */ -void RouteHint_set_src_node_id(struct LDKRouteHint *this_ptr, struct LDKPublicKey val); +void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The short_channel_id of this channel */ -uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *this_ptr); +uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr); /** * The short_channel_id of this channel */ -void RouteHint_set_short_channel_id(struct LDKRouteHint *this_ptr, uint64_t val); +void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val); /** * The fees which must be paid to use this channel */ -struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *this_ptr); +struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr); /** * The fees which must be paid to use this channel */ -void RouteHint_set_fees(struct LDKRouteHint *this_ptr, struct LDKRoutingFees val); +void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** * The difference in CLTV values between this node and the next node. */ -uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *this_ptr); +uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr); /** * The difference in CLTV values between this node and the next node. */ -void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *this_ptr, uint16_t val); +void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val); /** * The minimum value, in msat, which must be relayed to the next hop. */ -uint64_t RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *this_ptr); +uint64_t RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr); /** * The minimum value, in msat, which must be relayed to the next hop. */ -void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *this_ptr, uint64_t val); +void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val); MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg); @@ -7336,7 +7826,7 @@ MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKPublicKey src_node_id_a * equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat * *is* checked as they may change based on the receiving node. */ -LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *network, struct LDKPublicKey target, LDKCVec_ChannelDetailsZ *first_hops, LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger); +LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey target, LDKCVec_ChannelDetailsZ *first_hops, LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger); void NetworkGraph_free(struct LDKNetworkGraph this_ptr); @@ -7365,16 +7855,16 @@ MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(stru * bindings as you can call `self.network_graph.read().unwrap()` in Rust * yourself. */ -MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *this_arg); +MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); /** * Get a reference to the NetworkGraph which this read-lock contains. */ -MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *this_arg); +MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg); -struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *this_arg); +struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); -struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *this_arg); +struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_ptr); @@ -7382,53 +7872,53 @@ void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_ptr); * When the last update to the channel direction was issued. * Value is opaque, as set in the announcement. */ -uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *this_ptr); +uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** * When the last update to the channel direction was issued. * Value is opaque, as set in the announcement. */ -void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *this_ptr, uint32_t val); +void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val); /** * Whether the channel can be currently used for payments (in this one direction). */ -bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *this_ptr); +bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** * Whether the channel can be currently used for payments (in this one direction). */ -void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *this_ptr, bool val); +void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val); /** * The difference in CLTV values that you must have when routing through this channel. */ -uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *this_ptr); +uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** * The difference in CLTV values that you must have when routing through this channel. */ -void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *this_ptr, uint16_t val); +void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val); /** * The minimum value, which must be relayed to the next hop via the channel */ -uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *this_ptr); +uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** * The minimum value, which must be relayed to the next hop via the channel */ -void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *this_ptr, uint64_t val); +void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val); /** * Fees charged when the channel is used for routing */ -struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *this_ptr); +struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** * Fees charged when the channel is used for routing */ -void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *this_ptr, struct LDKRoutingFees val); +void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** * Most recent update for the channel received from the network @@ -7436,7 +7926,7 @@ void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *this_ptr, * Everything else is useful only for sending out for initial routing sync. * Not stored if contains excess data to prevent DoS. */ -struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *this_ptr); +struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** * Most recent update for the channel received from the network @@ -7444,9 +7934,9 @@ struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const str * Everything else is useful only for sending out for initial routing sync. * Not stored if contains excess data to prevent DoS. */ -void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *this_ptr, struct LDKChannelUpdate val); +void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); -LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *obj); +LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj); struct LDKDirectionalChannelInfo DirectionalChannelInfo_read(struct LDKu8slice ser); @@ -7455,52 +7945,52 @@ void ChannelInfo_free(struct LDKChannelInfo this_ptr); /** * Protocol features of a channel communicated during its announcement */ -struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *this_ptr); +struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** * Protocol features of a channel communicated during its announcement */ -void ChannelInfo_set_features(struct LDKChannelInfo *this_ptr, struct LDKChannelFeatures val); +void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** * Source node of the first direction of a channel */ -struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *this_ptr); +struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** * Source node of the first direction of a channel */ -void ChannelInfo_set_node_one(struct LDKChannelInfo *this_ptr, struct LDKPublicKey val); +void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Details about the first direction of a channel */ -struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *this_ptr); +struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** * Details about the first direction of a channel */ -void ChannelInfo_set_one_to_two(struct LDKChannelInfo *this_ptr, struct LDKDirectionalChannelInfo val); +void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); /** * Source node of the second direction of a channel */ -struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *this_ptr); +struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** * Source node of the second direction of a channel */ -void ChannelInfo_set_node_two(struct LDKChannelInfo *this_ptr, struct LDKPublicKey val); +void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * Details about the second direction of a channel */ -struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *this_ptr); +struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** * Details about the second direction of a channel */ -void ChannelInfo_set_two_to_one(struct LDKChannelInfo *this_ptr, struct LDKDirectionalChannelInfo val); +void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); /** * An initial announcement of the channel @@ -7508,7 +7998,7 @@ void ChannelInfo_set_two_to_one(struct LDKChannelInfo *this_ptr, struct LDKDirec * Everything else is useful only for sending out for initial routing sync. * Not stored if contains excess data to prevent DoS. */ -struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *this_ptr); +struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** * An initial announcement of the channel @@ -7516,96 +8006,96 @@ struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct * Everything else is useful only for sending out for initial routing sync. * Not stored if contains excess data to prevent DoS. */ -void ChannelInfo_set_announcement_message(struct LDKChannelInfo *this_ptr, struct LDKChannelAnnouncement val); +void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); -LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *obj); +LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); struct LDKChannelInfo ChannelInfo_read(struct LDKu8slice ser); void RoutingFees_free(struct LDKRoutingFees this_ptr); -struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *orig); +struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); /** * Flat routing fee in satoshis */ -uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *this_ptr); +uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); /** * Flat routing fee in satoshis */ -void RoutingFees_set_base_msat(struct LDKRoutingFees *this_ptr, uint32_t val); +void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); /** * Liquidity-based routing fee in millionths of a routed amount. * In other words, 10000 is 1%. */ -uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *this_ptr); +uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr); /** * Liquidity-based routing fee in millionths of a routed amount. * In other words, 10000 is 1%. */ -void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *this_ptr, uint32_t val); +void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); -struct LDKRoutingFees RoutingFees_read(struct LDKu8slice ser); +LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); -LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *obj); +LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_ptr); /** * Protocol features the node announced support for */ -struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *this_ptr); +struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** * Protocol features the node announced support for */ -void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *this_ptr, struct LDKNodeFeatures val); +void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** * When the last known update to the node state was issued. * Value is opaque, as set in the announcement. */ -uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *this_ptr); +uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** * When the last known update to the node state was issued. * Value is opaque, as set in the announcement. */ -void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *this_ptr, uint32_t val); +void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val); /** * Color assigned to the node */ -const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *this_ptr))[3]; +const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3]; /** * Color assigned to the node */ -void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *this_ptr, struct LDKThreeBytes val); +void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val); /** * Moniker assigned to the node. * May be invalid or malicious (eg control chars), * should not be exposed to the user. */ -const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *this_ptr))[32]; +const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32]; /** * Moniker assigned to the node. * May be invalid or malicious (eg control chars), * should not be exposed to the user. */ -void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *this_ptr, struct LDKThirtyTwoBytes val); +void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * Internet-level addresses via which one can connect to the node */ -void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *this_ptr, LDKCVec_NetAddressZ val); +void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, LDKCVec_NetAddressZ val); /** * An initial announcement of the node @@ -7613,7 +8103,7 @@ void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *this_ptr * Everything else is useful only for sending out for initial routing sync. * Not stored if contains excess data to prevent DoS. */ -struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *this_ptr); +struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** * An initial announcement of the node @@ -7621,58 +8111,58 @@ struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const s * Everything else is useful only for sending out for initial routing sync. * Not stored if contains excess data to prevent DoS. */ -void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *this_ptr, struct LDKNodeAnnouncement val); +void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val); MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg); -LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *obj); +LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); -struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_read(struct LDKu8slice ser); +LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); void NodeInfo_free(struct LDKNodeInfo this_ptr); /** * All valid channels a node has announced */ -void NodeInfo_set_channels(struct LDKNodeInfo *this_ptr, LDKCVec_u64Z val); +void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, LDKCVec_u64Z val); /** * Lowest fees enabling routing via any of the enabled, known channels to a node. * The two fields (flat and proportional fee) are independent, * meaning they don't have to refer to the same channel. */ -struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *this_ptr); +struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr); /** * Lowest fees enabling routing via any of the enabled, known channels to a node. * The two fields (flat and proportional fee) are independent, * meaning they don't have to refer to the same channel. */ -void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *this_ptr, struct LDKRoutingFees val); +void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** * More information about a node from node_announcement. * Optional because we store a Node entry after learning about it from * a channel announcement, but before receiving a node announcement. */ -struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *this_ptr); +struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr); /** * More information about a node from node_announcement. * Optional because we store a Node entry after learning about it from * a channel announcement, but before receiving a node announcement. */ -void NodeInfo_set_announcement_info(struct LDKNodeInfo *this_ptr, struct LDKNodeAnnouncementInfo val); +void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val); MUST_USE_RES struct LDKNodeInfo NodeInfo_new(LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); -LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *obj); +LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); -struct LDKNodeInfo NodeInfo_read(struct LDKu8slice ser); +LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); -LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *obj); +LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); -struct LDKNetworkGraph NetworkGraph_read(struct LDKu8slice ser); +LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser); /** * Creates a new, empty, network graph. @@ -7687,7 +8177,7 @@ MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes ge * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept * routing messages from a source using a protocol other than the lightning P2P protocol. */ -MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *this_arg, const struct LDKNodeAnnouncement *msg); +MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); /** * For an already known node (from channel announcements), update its stored properties from a @@ -7695,7 +8185,7 @@ MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announ * given the associated signatures here we cannot relay the node announcement to any of our * peers. */ -MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *this_arg, const struct LDKUnsignedNodeAnnouncement *msg); +MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg); /** * Store or update channel info from a channel announcement. @@ -7707,7 +8197,7 @@ MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsign * If a `chain::Access` object is provided via `chain_access`, it will be called to verify * the corresponding UTXO exists on chain and is correctly-formatted. */ -MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *this_arg, const struct LDKChannelAnnouncement *msg, struct LDKAccess *chain_access); +MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access); /** * Store or update channel info from a channel announcement without verifying the associated @@ -7717,7 +8207,7 @@ MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_ann * If a `chain::Access` object is provided via `chain_access`, it will be called to verify * the corresponding UTXO exists on chain and is correctly-formatted. */ -MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *this_arg, const struct LDKUnsignedChannelAnnouncement *msg, struct LDKAccess *chain_access); +MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access); /** * Close a channel if a corresponding HTLC fail was sent. @@ -7725,7 +8215,7 @@ MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_uns * May cause the removal of nodes too, if this was their last channel. * If not permanent, makes channels unavailable for routing. */ -void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *this_arg, uint64_t short_channel_id, bool is_permanent); +void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent); /** * For an already known (from announcement) channel, update info about one of the directions @@ -7735,13 +8225,13 @@ void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *this_arg, ui * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept * routing messages from a source using a protocol other than the lightning P2P protocol. */ -MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *this_arg, const struct LDKChannelUpdate *msg); +MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); /** * For an already known (from announcement) channel, update info about one of the directions * of the channel without verifying the associated signatures. Because we aren't given the * associated signatures here we cannot relay the channel update to any of our peers. */ -MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *this_arg, const struct LDKUnsignedChannelUpdate *msg); +MUST_USE_RES LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); /* Text to put at the end of the generated file */ diff --git a/lightning-c-bindings/include/lightningpp.hpp b/lightning-c-bindings/include/lightningpp.hpp index b313d1fd3c7..4e4fbb46a7a 100644 --- a/lightning-c-bindings/include/lightningpp.hpp +++ b/lightning-c-bindings/include/lightningpp.hpp @@ -5,10 +5,11 @@ class Event { LDKEvent self; public: Event(const Event&) = delete; - ~Event() { Event_free(self); } Event(Event&& o) : self(o.self) { memset(&o, 0, sizeof(Event)); } Event(LDKEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKEvent)); } - operator LDKEvent() { LDKEvent res = self; memset(&self, 0, sizeof(LDKEvent)); return res; } + operator LDKEvent() && { LDKEvent res = self; memset(&self, 0, sizeof(LDKEvent)); return res; } + ~Event() { Event_free(self); } + Event& operator=(Event&& o) { Event_free(self); self = o.self; memset(&o, 0, sizeof(Event)); return *this; } LDKEvent* operator &() { return &self; } LDKEvent* operator ->() { return &self; } const LDKEvent* operator &() const { return &self; } @@ -19,10 +20,11 @@ class MessageSendEvent { LDKMessageSendEvent self; public: MessageSendEvent(const MessageSendEvent&) = delete; - ~MessageSendEvent() { MessageSendEvent_free(self); } MessageSendEvent(MessageSendEvent&& o) : self(o.self) { memset(&o, 0, sizeof(MessageSendEvent)); } MessageSendEvent(LDKMessageSendEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageSendEvent)); } - operator LDKMessageSendEvent() { LDKMessageSendEvent res = self; memset(&self, 0, sizeof(LDKMessageSendEvent)); return res; } + operator LDKMessageSendEvent() && { LDKMessageSendEvent res = self; memset(&self, 0, sizeof(LDKMessageSendEvent)); return res; } + ~MessageSendEvent() { MessageSendEvent_free(self); } + MessageSendEvent& operator=(MessageSendEvent&& o) { MessageSendEvent_free(self); self = o.self; memset(&o, 0, sizeof(MessageSendEvent)); return *this; } LDKMessageSendEvent* operator &() { return &self; } LDKMessageSendEvent* operator ->() { return &self; } const LDKMessageSendEvent* operator &() const { return &self; } @@ -33,10 +35,11 @@ class MessageSendEventsProvider { LDKMessageSendEventsProvider self; public: MessageSendEventsProvider(const MessageSendEventsProvider&) = delete; - ~MessageSendEventsProvider() { MessageSendEventsProvider_free(self); } MessageSendEventsProvider(MessageSendEventsProvider&& o) : self(o.self) { memset(&o, 0, sizeof(MessageSendEventsProvider)); } MessageSendEventsProvider(LDKMessageSendEventsProvider&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageSendEventsProvider)); } - operator LDKMessageSendEventsProvider() { LDKMessageSendEventsProvider res = self; memset(&self, 0, sizeof(LDKMessageSendEventsProvider)); return res; } + operator LDKMessageSendEventsProvider() && { LDKMessageSendEventsProvider res = self; memset(&self, 0, sizeof(LDKMessageSendEventsProvider)); return res; } + ~MessageSendEventsProvider() { MessageSendEventsProvider_free(self); } + MessageSendEventsProvider& operator=(MessageSendEventsProvider&& o) { MessageSendEventsProvider_free(self); self = o.self; memset(&o, 0, sizeof(MessageSendEventsProvider)); return *this; } LDKMessageSendEventsProvider* operator &() { return &self; } LDKMessageSendEventsProvider* operator ->() { return &self; } const LDKMessageSendEventsProvider* operator &() const { return &self; } @@ -47,10 +50,11 @@ class EventsProvider { LDKEventsProvider self; public: EventsProvider(const EventsProvider&) = delete; - ~EventsProvider() { EventsProvider_free(self); } EventsProvider(EventsProvider&& o) : self(o.self) { memset(&o, 0, sizeof(EventsProvider)); } EventsProvider(LDKEventsProvider&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKEventsProvider)); } - operator LDKEventsProvider() { LDKEventsProvider res = self; memset(&self, 0, sizeof(LDKEventsProvider)); return res; } + operator LDKEventsProvider() && { LDKEventsProvider res = self; memset(&self, 0, sizeof(LDKEventsProvider)); return res; } + ~EventsProvider() { EventsProvider_free(self); } + EventsProvider& operator=(EventsProvider&& o) { EventsProvider_free(self); self = o.self; memset(&o, 0, sizeof(EventsProvider)); return *this; } LDKEventsProvider* operator &() { return &self; } LDKEventsProvider* operator ->() { return &self; } const LDKEventsProvider* operator &() const { return &self; } @@ -61,10 +65,11 @@ class APIError { LDKAPIError self; public: APIError(const APIError&) = delete; - ~APIError() { APIError_free(self); } APIError(APIError&& o) : self(o.self) { memset(&o, 0, sizeof(APIError)); } APIError(LDKAPIError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAPIError)); } - operator LDKAPIError() { LDKAPIError res = self; memset(&self, 0, sizeof(LDKAPIError)); return res; } + operator LDKAPIError() && { LDKAPIError res = self; memset(&self, 0, sizeof(LDKAPIError)); return res; } + ~APIError() { APIError_free(self); } + APIError& operator=(APIError&& o) { APIError_free(self); self = o.self; memset(&o, 0, sizeof(APIError)); return *this; } LDKAPIError* operator &() { return &self; } LDKAPIError* operator ->() { return &self; } const LDKAPIError* operator &() const { return &self; } @@ -77,7 +82,8 @@ class Level { Level(const Level&) = delete; Level(Level&& o) : self(o.self) { memset(&o, 0, sizeof(Level)); } Level(LDKLevel&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLevel)); } - operator LDKLevel() { LDKLevel res = self; memset(&self, 0, sizeof(LDKLevel)); return res; } + operator LDKLevel() && { LDKLevel res = self; memset(&self, 0, sizeof(LDKLevel)); return res; } + Level& operator=(Level&& o) { self = o.self; memset(&o, 0, sizeof(Level)); return *this; } LDKLevel* operator &() { return &self; } LDKLevel* operator ->() { return &self; } const LDKLevel* operator &() const { return &self; } @@ -88,10 +94,11 @@ class Logger { LDKLogger self; public: Logger(const Logger&) = delete; - ~Logger() { Logger_free(self); } Logger(Logger&& o) : self(o.self) { memset(&o, 0, sizeof(Logger)); } Logger(LDKLogger&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLogger)); } - operator LDKLogger() { LDKLogger res = self; memset(&self, 0, sizeof(LDKLogger)); return res; } + operator LDKLogger() && { LDKLogger res = self; memset(&self, 0, sizeof(LDKLogger)); return res; } + ~Logger() { Logger_free(self); } + Logger& operator=(Logger&& o) { Logger_free(self); self = o.self; memset(&o, 0, sizeof(Logger)); return *this; } LDKLogger* operator &() { return &self; } LDKLogger* operator ->() { return &self; } const LDKLogger* operator &() const { return &self; } @@ -102,10 +109,11 @@ class ChannelHandshakeConfig { LDKChannelHandshakeConfig self; public: ChannelHandshakeConfig(const ChannelHandshakeConfig&) = delete; - ~ChannelHandshakeConfig() { ChannelHandshakeConfig_free(self); } ChannelHandshakeConfig(ChannelHandshakeConfig&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelHandshakeConfig)); } ChannelHandshakeConfig(LDKChannelHandshakeConfig&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelHandshakeConfig)); } - operator LDKChannelHandshakeConfig() { LDKChannelHandshakeConfig res = self; memset(&self, 0, sizeof(LDKChannelHandshakeConfig)); return res; } + operator LDKChannelHandshakeConfig() && { LDKChannelHandshakeConfig res = self; memset(&self, 0, sizeof(LDKChannelHandshakeConfig)); return res; } + ~ChannelHandshakeConfig() { ChannelHandshakeConfig_free(self); } + ChannelHandshakeConfig& operator=(ChannelHandshakeConfig&& o) { ChannelHandshakeConfig_free(self); self = o.self; memset(&o, 0, sizeof(ChannelHandshakeConfig)); return *this; } LDKChannelHandshakeConfig* operator &() { return &self; } LDKChannelHandshakeConfig* operator ->() { return &self; } const LDKChannelHandshakeConfig* operator &() const { return &self; } @@ -116,10 +124,11 @@ class ChannelHandshakeLimits { LDKChannelHandshakeLimits self; public: ChannelHandshakeLimits(const ChannelHandshakeLimits&) = delete; - ~ChannelHandshakeLimits() { ChannelHandshakeLimits_free(self); } ChannelHandshakeLimits(ChannelHandshakeLimits&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelHandshakeLimits)); } ChannelHandshakeLimits(LDKChannelHandshakeLimits&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelHandshakeLimits)); } - operator LDKChannelHandshakeLimits() { LDKChannelHandshakeLimits res = self; memset(&self, 0, sizeof(LDKChannelHandshakeLimits)); return res; } + operator LDKChannelHandshakeLimits() && { LDKChannelHandshakeLimits res = self; memset(&self, 0, sizeof(LDKChannelHandshakeLimits)); return res; } + ~ChannelHandshakeLimits() { ChannelHandshakeLimits_free(self); } + ChannelHandshakeLimits& operator=(ChannelHandshakeLimits&& o) { ChannelHandshakeLimits_free(self); self = o.self; memset(&o, 0, sizeof(ChannelHandshakeLimits)); return *this; } LDKChannelHandshakeLimits* operator &() { return &self; } LDKChannelHandshakeLimits* operator ->() { return &self; } const LDKChannelHandshakeLimits* operator &() const { return &self; } @@ -130,10 +139,11 @@ class ChannelConfig { LDKChannelConfig self; public: ChannelConfig(const ChannelConfig&) = delete; - ~ChannelConfig() { ChannelConfig_free(self); } ChannelConfig(ChannelConfig&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelConfig)); } ChannelConfig(LDKChannelConfig&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelConfig)); } - operator LDKChannelConfig() { LDKChannelConfig res = self; memset(&self, 0, sizeof(LDKChannelConfig)); return res; } + operator LDKChannelConfig() && { LDKChannelConfig res = self; memset(&self, 0, sizeof(LDKChannelConfig)); return res; } + ~ChannelConfig() { ChannelConfig_free(self); } + ChannelConfig& operator=(ChannelConfig&& o) { ChannelConfig_free(self); self = o.self; memset(&o, 0, sizeof(ChannelConfig)); return *this; } LDKChannelConfig* operator &() { return &self; } LDKChannelConfig* operator ->() { return &self; } const LDKChannelConfig* operator &() const { return &self; } @@ -144,10 +154,11 @@ class UserConfig { LDKUserConfig self; public: UserConfig(const UserConfig&) = delete; - ~UserConfig() { UserConfig_free(self); } UserConfig(UserConfig&& o) : self(o.self) { memset(&o, 0, sizeof(UserConfig)); } UserConfig(LDKUserConfig&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUserConfig)); } - operator LDKUserConfig() { LDKUserConfig res = self; memset(&self, 0, sizeof(LDKUserConfig)); return res; } + operator LDKUserConfig() && { LDKUserConfig res = self; memset(&self, 0, sizeof(LDKUserConfig)); return res; } + ~UserConfig() { UserConfig_free(self); } + UserConfig& operator=(UserConfig&& o) { UserConfig_free(self); self = o.self; memset(&o, 0, sizeof(UserConfig)); return *this; } LDKUserConfig* operator &() { return &self; } LDKUserConfig* operator ->() { return &self; } const LDKUserConfig* operator &() const { return &self; } @@ -158,10 +169,11 @@ class BroadcasterInterface { LDKBroadcasterInterface self; public: BroadcasterInterface(const BroadcasterInterface&) = delete; - ~BroadcasterInterface() { BroadcasterInterface_free(self); } BroadcasterInterface(BroadcasterInterface&& o) : self(o.self) { memset(&o, 0, sizeof(BroadcasterInterface)); } BroadcasterInterface(LDKBroadcasterInterface&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBroadcasterInterface)); } - operator LDKBroadcasterInterface() { LDKBroadcasterInterface res = self; memset(&self, 0, sizeof(LDKBroadcasterInterface)); return res; } + operator LDKBroadcasterInterface() && { LDKBroadcasterInterface res = self; memset(&self, 0, sizeof(LDKBroadcasterInterface)); return res; } + ~BroadcasterInterface() { BroadcasterInterface_free(self); } + BroadcasterInterface& operator=(BroadcasterInterface&& o) { BroadcasterInterface_free(self); self = o.self; memset(&o, 0, sizeof(BroadcasterInterface)); return *this; } LDKBroadcasterInterface* operator &() { return &self; } LDKBroadcasterInterface* operator ->() { return &self; } const LDKBroadcasterInterface* operator &() const { return &self; } @@ -174,7 +186,8 @@ class ConfirmationTarget { ConfirmationTarget(const ConfirmationTarget&) = delete; ConfirmationTarget(ConfirmationTarget&& o) : self(o.self) { memset(&o, 0, sizeof(ConfirmationTarget)); } ConfirmationTarget(LDKConfirmationTarget&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKConfirmationTarget)); } - operator LDKConfirmationTarget() { LDKConfirmationTarget res = self; memset(&self, 0, sizeof(LDKConfirmationTarget)); return res; } + operator LDKConfirmationTarget() && { LDKConfirmationTarget res = self; memset(&self, 0, sizeof(LDKConfirmationTarget)); return res; } + ConfirmationTarget& operator=(ConfirmationTarget&& o) { self = o.self; memset(&o, 0, sizeof(ConfirmationTarget)); return *this; } LDKConfirmationTarget* operator &() { return &self; } LDKConfirmationTarget* operator ->() { return &self; } const LDKConfirmationTarget* operator &() const { return &self; } @@ -185,10 +198,11 @@ class FeeEstimator { LDKFeeEstimator self; public: FeeEstimator(const FeeEstimator&) = delete; - ~FeeEstimator() { FeeEstimator_free(self); } FeeEstimator(FeeEstimator&& o) : self(o.self) { memset(&o, 0, sizeof(FeeEstimator)); } FeeEstimator(LDKFeeEstimator&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFeeEstimator)); } - operator LDKFeeEstimator() { LDKFeeEstimator res = self; memset(&self, 0, sizeof(LDKFeeEstimator)); return res; } + operator LDKFeeEstimator() && { LDKFeeEstimator res = self; memset(&self, 0, sizeof(LDKFeeEstimator)); return res; } + ~FeeEstimator() { FeeEstimator_free(self); } + FeeEstimator& operator=(FeeEstimator&& o) { FeeEstimator_free(self); self = o.self; memset(&o, 0, sizeof(FeeEstimator)); return *this; } LDKFeeEstimator* operator &() { return &self; } LDKFeeEstimator* operator ->() { return &self; } const LDKFeeEstimator* operator &() const { return &self; } @@ -199,10 +213,11 @@ class ChainMonitor { LDKChainMonitor self; public: ChainMonitor(const ChainMonitor&) = delete; - ~ChainMonitor() { ChainMonitor_free(self); } ChainMonitor(ChainMonitor&& o) : self(o.self) { memset(&o, 0, sizeof(ChainMonitor)); } ChainMonitor(LDKChainMonitor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChainMonitor)); } - operator LDKChainMonitor() { LDKChainMonitor res = self; memset(&self, 0, sizeof(LDKChainMonitor)); return res; } + operator LDKChainMonitor() && { LDKChainMonitor res = self; memset(&self, 0, sizeof(LDKChainMonitor)); return res; } + ~ChainMonitor() { ChainMonitor_free(self); } + ChainMonitor& operator=(ChainMonitor&& o) { ChainMonitor_free(self); self = o.self; memset(&o, 0, sizeof(ChainMonitor)); return *this; } LDKChainMonitor* operator &() { return &self; } LDKChainMonitor* operator ->() { return &self; } const LDKChainMonitor* operator &() const { return &self; } @@ -213,10 +228,11 @@ class ChannelMonitorUpdate { LDKChannelMonitorUpdate self; public: ChannelMonitorUpdate(const ChannelMonitorUpdate&) = delete; - ~ChannelMonitorUpdate() { ChannelMonitorUpdate_free(self); } ChannelMonitorUpdate(ChannelMonitorUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitorUpdate)); } ChannelMonitorUpdate(LDKChannelMonitorUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitorUpdate)); } - operator LDKChannelMonitorUpdate() { LDKChannelMonitorUpdate res = self; memset(&self, 0, sizeof(LDKChannelMonitorUpdate)); return res; } + operator LDKChannelMonitorUpdate() && { LDKChannelMonitorUpdate res = self; memset(&self, 0, sizeof(LDKChannelMonitorUpdate)); return res; } + ~ChannelMonitorUpdate() { ChannelMonitorUpdate_free(self); } + ChannelMonitorUpdate& operator=(ChannelMonitorUpdate&& o) { ChannelMonitorUpdate_free(self); self = o.self; memset(&o, 0, sizeof(ChannelMonitorUpdate)); return *this; } LDKChannelMonitorUpdate* operator &() { return &self; } LDKChannelMonitorUpdate* operator ->() { return &self; } const LDKChannelMonitorUpdate* operator &() const { return &self; } @@ -229,7 +245,8 @@ class ChannelMonitorUpdateErr { ChannelMonitorUpdateErr(const ChannelMonitorUpdateErr&) = delete; ChannelMonitorUpdateErr(ChannelMonitorUpdateErr&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitorUpdateErr)); } ChannelMonitorUpdateErr(LDKChannelMonitorUpdateErr&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitorUpdateErr)); } - operator LDKChannelMonitorUpdateErr() { LDKChannelMonitorUpdateErr res = self; memset(&self, 0, sizeof(LDKChannelMonitorUpdateErr)); return res; } + operator LDKChannelMonitorUpdateErr() && { LDKChannelMonitorUpdateErr res = self; memset(&self, 0, sizeof(LDKChannelMonitorUpdateErr)); return res; } + ChannelMonitorUpdateErr& operator=(ChannelMonitorUpdateErr&& o) { self = o.self; memset(&o, 0, sizeof(ChannelMonitorUpdateErr)); return *this; } LDKChannelMonitorUpdateErr* operator &() { return &self; } LDKChannelMonitorUpdateErr* operator ->() { return &self; } const LDKChannelMonitorUpdateErr* operator &() const { return &self; } @@ -240,10 +257,11 @@ class MonitorUpdateError { LDKMonitorUpdateError self; public: MonitorUpdateError(const MonitorUpdateError&) = delete; - ~MonitorUpdateError() { MonitorUpdateError_free(self); } MonitorUpdateError(MonitorUpdateError&& o) : self(o.self) { memset(&o, 0, sizeof(MonitorUpdateError)); } MonitorUpdateError(LDKMonitorUpdateError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMonitorUpdateError)); } - operator LDKMonitorUpdateError() { LDKMonitorUpdateError res = self; memset(&self, 0, sizeof(LDKMonitorUpdateError)); return res; } + operator LDKMonitorUpdateError() && { LDKMonitorUpdateError res = self; memset(&self, 0, sizeof(LDKMonitorUpdateError)); return res; } + ~MonitorUpdateError() { MonitorUpdateError_free(self); } + MonitorUpdateError& operator=(MonitorUpdateError&& o) { MonitorUpdateError_free(self); self = o.self; memset(&o, 0, sizeof(MonitorUpdateError)); return *this; } LDKMonitorUpdateError* operator &() { return &self; } LDKMonitorUpdateError* operator ->() { return &self; } const LDKMonitorUpdateError* operator &() const { return &self; } @@ -254,10 +272,11 @@ class MonitorEvent { LDKMonitorEvent self; public: MonitorEvent(const MonitorEvent&) = delete; - ~MonitorEvent() { MonitorEvent_free(self); } MonitorEvent(MonitorEvent&& o) : self(o.self) { memset(&o, 0, sizeof(MonitorEvent)); } MonitorEvent(LDKMonitorEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMonitorEvent)); } - operator LDKMonitorEvent() { LDKMonitorEvent res = self; memset(&self, 0, sizeof(LDKMonitorEvent)); return res; } + operator LDKMonitorEvent() && { LDKMonitorEvent res = self; memset(&self, 0, sizeof(LDKMonitorEvent)); return res; } + ~MonitorEvent() { MonitorEvent_free(self); } + MonitorEvent& operator=(MonitorEvent&& o) { MonitorEvent_free(self); self = o.self; memset(&o, 0, sizeof(MonitorEvent)); return *this; } LDKMonitorEvent* operator &() { return &self; } LDKMonitorEvent* operator ->() { return &self; } const LDKMonitorEvent* operator &() const { return &self; } @@ -268,10 +287,11 @@ class HTLCUpdate { LDKHTLCUpdate self; public: HTLCUpdate(const HTLCUpdate&) = delete; - ~HTLCUpdate() { HTLCUpdate_free(self); } HTLCUpdate(HTLCUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(HTLCUpdate)); } HTLCUpdate(LDKHTLCUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHTLCUpdate)); } - operator LDKHTLCUpdate() { LDKHTLCUpdate res = self; memset(&self, 0, sizeof(LDKHTLCUpdate)); return res; } + operator LDKHTLCUpdate() && { LDKHTLCUpdate res = self; memset(&self, 0, sizeof(LDKHTLCUpdate)); return res; } + ~HTLCUpdate() { HTLCUpdate_free(self); } + HTLCUpdate& operator=(HTLCUpdate&& o) { HTLCUpdate_free(self); self = o.self; memset(&o, 0, sizeof(HTLCUpdate)); return *this; } LDKHTLCUpdate* operator &() { return &self; } LDKHTLCUpdate* operator ->() { return &self; } const LDKHTLCUpdate* operator &() const { return &self; } @@ -282,10 +302,11 @@ class ChannelMonitor { LDKChannelMonitor self; public: ChannelMonitor(const ChannelMonitor&) = delete; - ~ChannelMonitor() { ChannelMonitor_free(self); } ChannelMonitor(ChannelMonitor&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitor)); } ChannelMonitor(LDKChannelMonitor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitor)); } - operator LDKChannelMonitor() { LDKChannelMonitor res = self; memset(&self, 0, sizeof(LDKChannelMonitor)); return res; } + operator LDKChannelMonitor() && { LDKChannelMonitor res = self; memset(&self, 0, sizeof(LDKChannelMonitor)); return res; } + ~ChannelMonitor() { ChannelMonitor_free(self); } + ChannelMonitor& operator=(ChannelMonitor&& o) { ChannelMonitor_free(self); self = o.self; memset(&o, 0, sizeof(ChannelMonitor)); return *this; } LDKChannelMonitor* operator &() { return &self; } LDKChannelMonitor* operator ->() { return &self; } const LDKChannelMonitor* operator &() const { return &self; } @@ -296,10 +317,11 @@ class Persist { LDKPersist self; public: Persist(const Persist&) = delete; - ~Persist() { Persist_free(self); } Persist(Persist&& o) : self(o.self) { memset(&o, 0, sizeof(Persist)); } Persist(LDKPersist&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPersist)); } - operator LDKPersist() { LDKPersist res = self; memset(&self, 0, sizeof(LDKPersist)); return res; } + operator LDKPersist() && { LDKPersist res = self; memset(&self, 0, sizeof(LDKPersist)); return res; } + ~Persist() { Persist_free(self); } + Persist& operator=(Persist&& o) { Persist_free(self); self = o.self; memset(&o, 0, sizeof(Persist)); return *this; } LDKPersist* operator &() { return &self; } LDKPersist* operator ->() { return &self; } const LDKPersist* operator &() const { return &self; } @@ -310,10 +332,11 @@ class OutPoint { LDKOutPoint self; public: OutPoint(const OutPoint&) = delete; - ~OutPoint() { OutPoint_free(self); } OutPoint(OutPoint&& o) : self(o.self) { memset(&o, 0, sizeof(OutPoint)); } OutPoint(LDKOutPoint&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOutPoint)); } - operator LDKOutPoint() { LDKOutPoint res = self; memset(&self, 0, sizeof(LDKOutPoint)); return res; } + operator LDKOutPoint() && { LDKOutPoint res = self; memset(&self, 0, sizeof(LDKOutPoint)); return res; } + ~OutPoint() { OutPoint_free(self); } + OutPoint& operator=(OutPoint&& o) { OutPoint_free(self); self = o.self; memset(&o, 0, sizeof(OutPoint)); return *this; } LDKOutPoint* operator &() { return &self; } LDKOutPoint* operator ->() { return &self; } const LDKOutPoint* operator &() const { return &self; } @@ -324,10 +347,11 @@ class SpendableOutputDescriptor { LDKSpendableOutputDescriptor self; public: SpendableOutputDescriptor(const SpendableOutputDescriptor&) = delete; - ~SpendableOutputDescriptor() { SpendableOutputDescriptor_free(self); } SpendableOutputDescriptor(SpendableOutputDescriptor&& o) : self(o.self) { memset(&o, 0, sizeof(SpendableOutputDescriptor)); } SpendableOutputDescriptor(LDKSpendableOutputDescriptor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSpendableOutputDescriptor)); } - operator LDKSpendableOutputDescriptor() { LDKSpendableOutputDescriptor res = self; memset(&self, 0, sizeof(LDKSpendableOutputDescriptor)); return res; } + operator LDKSpendableOutputDescriptor() && { LDKSpendableOutputDescriptor res = self; memset(&self, 0, sizeof(LDKSpendableOutputDescriptor)); return res; } + ~SpendableOutputDescriptor() { SpendableOutputDescriptor_free(self); } + SpendableOutputDescriptor& operator=(SpendableOutputDescriptor&& o) { SpendableOutputDescriptor_free(self); self = o.self; memset(&o, 0, sizeof(SpendableOutputDescriptor)); return *this; } LDKSpendableOutputDescriptor* operator &() { return &self; } LDKSpendableOutputDescriptor* operator ->() { return &self; } const LDKSpendableOutputDescriptor* operator &() const { return &self; } @@ -338,10 +362,11 @@ class ChannelKeys { LDKChannelKeys self; public: ChannelKeys(const ChannelKeys&) = delete; - ~ChannelKeys() { ChannelKeys_free(self); } ChannelKeys(ChannelKeys&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelKeys)); } ChannelKeys(LDKChannelKeys&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelKeys)); } - operator LDKChannelKeys() { LDKChannelKeys res = self; memset(&self, 0, sizeof(LDKChannelKeys)); return res; } + operator LDKChannelKeys() && { LDKChannelKeys res = self; memset(&self, 0, sizeof(LDKChannelKeys)); return res; } + ~ChannelKeys() { ChannelKeys_free(self); } + ChannelKeys& operator=(ChannelKeys&& o) { ChannelKeys_free(self); self = o.self; memset(&o, 0, sizeof(ChannelKeys)); return *this; } LDKChannelKeys* operator &() { return &self; } LDKChannelKeys* operator ->() { return &self; } const LDKChannelKeys* operator &() const { return &self; } @@ -352,10 +377,11 @@ class KeysInterface { LDKKeysInterface self; public: KeysInterface(const KeysInterface&) = delete; - ~KeysInterface() { KeysInterface_free(self); } KeysInterface(KeysInterface&& o) : self(o.self) { memset(&o, 0, sizeof(KeysInterface)); } KeysInterface(LDKKeysInterface&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKKeysInterface)); } - operator LDKKeysInterface() { LDKKeysInterface res = self; memset(&self, 0, sizeof(LDKKeysInterface)); return res; } + operator LDKKeysInterface() && { LDKKeysInterface res = self; memset(&self, 0, sizeof(LDKKeysInterface)); return res; } + ~KeysInterface() { KeysInterface_free(self); } + KeysInterface& operator=(KeysInterface&& o) { KeysInterface_free(self); self = o.self; memset(&o, 0, sizeof(KeysInterface)); return *this; } LDKKeysInterface* operator &() { return &self; } LDKKeysInterface* operator ->() { return &self; } const LDKKeysInterface* operator &() const { return &self; } @@ -366,10 +392,11 @@ class InMemoryChannelKeys { LDKInMemoryChannelKeys self; public: InMemoryChannelKeys(const InMemoryChannelKeys&) = delete; - ~InMemoryChannelKeys() { InMemoryChannelKeys_free(self); } InMemoryChannelKeys(InMemoryChannelKeys&& o) : self(o.self) { memset(&o, 0, sizeof(InMemoryChannelKeys)); } InMemoryChannelKeys(LDKInMemoryChannelKeys&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInMemoryChannelKeys)); } - operator LDKInMemoryChannelKeys() { LDKInMemoryChannelKeys res = self; memset(&self, 0, sizeof(LDKInMemoryChannelKeys)); return res; } + operator LDKInMemoryChannelKeys() && { LDKInMemoryChannelKeys res = self; memset(&self, 0, sizeof(LDKInMemoryChannelKeys)); return res; } + ~InMemoryChannelKeys() { InMemoryChannelKeys_free(self); } + InMemoryChannelKeys& operator=(InMemoryChannelKeys&& o) { InMemoryChannelKeys_free(self); self = o.self; memset(&o, 0, sizeof(InMemoryChannelKeys)); return *this; } LDKInMemoryChannelKeys* operator &() { return &self; } LDKInMemoryChannelKeys* operator ->() { return &self; } const LDKInMemoryChannelKeys* operator &() const { return &self; } @@ -380,10 +407,11 @@ class KeysManager { LDKKeysManager self; public: KeysManager(const KeysManager&) = delete; - ~KeysManager() { KeysManager_free(self); } KeysManager(KeysManager&& o) : self(o.self) { memset(&o, 0, sizeof(KeysManager)); } KeysManager(LDKKeysManager&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKKeysManager)); } - operator LDKKeysManager() { LDKKeysManager res = self; memset(&self, 0, sizeof(LDKKeysManager)); return res; } + operator LDKKeysManager() && { LDKKeysManager res = self; memset(&self, 0, sizeof(LDKKeysManager)); return res; } + ~KeysManager() { KeysManager_free(self); } + KeysManager& operator=(KeysManager&& o) { KeysManager_free(self); self = o.self; memset(&o, 0, sizeof(KeysManager)); return *this; } LDKKeysManager* operator &() { return &self; } LDKKeysManager* operator ->() { return &self; } const LDKKeysManager* operator &() const { return &self; } @@ -396,7 +424,8 @@ class AccessError { AccessError(const AccessError&) = delete; AccessError(AccessError&& o) : self(o.self) { memset(&o, 0, sizeof(AccessError)); } AccessError(LDKAccessError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAccessError)); } - operator LDKAccessError() { LDKAccessError res = self; memset(&self, 0, sizeof(LDKAccessError)); return res; } + operator LDKAccessError() && { LDKAccessError res = self; memset(&self, 0, sizeof(LDKAccessError)); return res; } + AccessError& operator=(AccessError&& o) { self = o.self; memset(&o, 0, sizeof(AccessError)); return *this; } LDKAccessError* operator &() { return &self; } LDKAccessError* operator ->() { return &self; } const LDKAccessError* operator &() const { return &self; } @@ -407,10 +436,11 @@ class Access { LDKAccess self; public: Access(const Access&) = delete; - ~Access() { Access_free(self); } Access(Access&& o) : self(o.self) { memset(&o, 0, sizeof(Access)); } Access(LDKAccess&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAccess)); } - operator LDKAccess() { LDKAccess res = self; memset(&self, 0, sizeof(LDKAccess)); return res; } + operator LDKAccess() && { LDKAccess res = self; memset(&self, 0, sizeof(LDKAccess)); return res; } + ~Access() { Access_free(self); } + Access& operator=(Access&& o) { Access_free(self); self = o.self; memset(&o, 0, sizeof(Access)); return *this; } LDKAccess* operator &() { return &self; } LDKAccess* operator ->() { return &self; } const LDKAccess* operator &() const { return &self; } @@ -421,10 +451,11 @@ class Watch { LDKWatch self; public: Watch(const Watch&) = delete; - ~Watch() { Watch_free(self); } Watch(Watch&& o) : self(o.self) { memset(&o, 0, sizeof(Watch)); } Watch(LDKWatch&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKWatch)); } - operator LDKWatch() { LDKWatch res = self; memset(&self, 0, sizeof(LDKWatch)); return res; } + operator LDKWatch() && { LDKWatch res = self; memset(&self, 0, sizeof(LDKWatch)); return res; } + ~Watch() { Watch_free(self); } + Watch& operator=(Watch&& o) { Watch_free(self); self = o.self; memset(&o, 0, sizeof(Watch)); return *this; } LDKWatch* operator &() { return &self; } LDKWatch* operator ->() { return &self; } const LDKWatch* operator &() const { return &self; } @@ -435,10 +466,11 @@ class Filter { LDKFilter self; public: Filter(const Filter&) = delete; - ~Filter() { Filter_free(self); } Filter(Filter&& o) : self(o.self) { memset(&o, 0, sizeof(Filter)); } Filter(LDKFilter&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFilter)); } - operator LDKFilter() { LDKFilter res = self; memset(&self, 0, sizeof(LDKFilter)); return res; } + operator LDKFilter() && { LDKFilter res = self; memset(&self, 0, sizeof(LDKFilter)); return res; } + ~Filter() { Filter_free(self); } + Filter& operator=(Filter&& o) { Filter_free(self); self = o.self; memset(&o, 0, sizeof(Filter)); return *this; } LDKFilter* operator &() { return &self; } LDKFilter* operator ->() { return &self; } const LDKFilter* operator &() const { return &self; } @@ -449,10 +481,11 @@ class ChannelManager { LDKChannelManager self; public: ChannelManager(const ChannelManager&) = delete; - ~ChannelManager() { ChannelManager_free(self); } ChannelManager(ChannelManager&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelManager)); } ChannelManager(LDKChannelManager&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelManager)); } - operator LDKChannelManager() { LDKChannelManager res = self; memset(&self, 0, sizeof(LDKChannelManager)); return res; } + operator LDKChannelManager() && { LDKChannelManager res = self; memset(&self, 0, sizeof(LDKChannelManager)); return res; } + ~ChannelManager() { ChannelManager_free(self); } + ChannelManager& operator=(ChannelManager&& o) { ChannelManager_free(self); self = o.self; memset(&o, 0, sizeof(ChannelManager)); return *this; } LDKChannelManager* operator &() { return &self; } LDKChannelManager* operator ->() { return &self; } const LDKChannelManager* operator &() const { return &self; } @@ -463,10 +496,11 @@ class ChannelDetails { LDKChannelDetails self; public: ChannelDetails(const ChannelDetails&) = delete; - ~ChannelDetails() { ChannelDetails_free(self); } ChannelDetails(ChannelDetails&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelDetails)); } ChannelDetails(LDKChannelDetails&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelDetails)); } - operator LDKChannelDetails() { LDKChannelDetails res = self; memset(&self, 0, sizeof(LDKChannelDetails)); return res; } + operator LDKChannelDetails() && { LDKChannelDetails res = self; memset(&self, 0, sizeof(LDKChannelDetails)); return res; } + ~ChannelDetails() { ChannelDetails_free(self); } + ChannelDetails& operator=(ChannelDetails&& o) { ChannelDetails_free(self); self = o.self; memset(&o, 0, sizeof(ChannelDetails)); return *this; } LDKChannelDetails* operator &() { return &self; } LDKChannelDetails* operator ->() { return &self; } const LDKChannelDetails* operator &() const { return &self; } @@ -477,10 +511,11 @@ class PaymentSendFailure { LDKPaymentSendFailure self; public: PaymentSendFailure(const PaymentSendFailure&) = delete; - ~PaymentSendFailure() { PaymentSendFailure_free(self); } PaymentSendFailure(PaymentSendFailure&& o) : self(o.self) { memset(&o, 0, sizeof(PaymentSendFailure)); } PaymentSendFailure(LDKPaymentSendFailure&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPaymentSendFailure)); } - operator LDKPaymentSendFailure() { LDKPaymentSendFailure res = self; memset(&self, 0, sizeof(LDKPaymentSendFailure)); return res; } + operator LDKPaymentSendFailure() && { LDKPaymentSendFailure res = self; memset(&self, 0, sizeof(LDKPaymentSendFailure)); return res; } + ~PaymentSendFailure() { PaymentSendFailure_free(self); } + PaymentSendFailure& operator=(PaymentSendFailure&& o) { PaymentSendFailure_free(self); self = o.self; memset(&o, 0, sizeof(PaymentSendFailure)); return *this; } LDKPaymentSendFailure* operator &() { return &self; } LDKPaymentSendFailure* operator ->() { return &self; } const LDKPaymentSendFailure* operator &() const { return &self; } @@ -491,10 +526,11 @@ class ChannelManagerReadArgs { LDKChannelManagerReadArgs self; public: ChannelManagerReadArgs(const ChannelManagerReadArgs&) = delete; - ~ChannelManagerReadArgs() { ChannelManagerReadArgs_free(self); } ChannelManagerReadArgs(ChannelManagerReadArgs&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelManagerReadArgs)); } ChannelManagerReadArgs(LDKChannelManagerReadArgs&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelManagerReadArgs)); } - operator LDKChannelManagerReadArgs() { LDKChannelManagerReadArgs res = self; memset(&self, 0, sizeof(LDKChannelManagerReadArgs)); return res; } + operator LDKChannelManagerReadArgs() && { LDKChannelManagerReadArgs res = self; memset(&self, 0, sizeof(LDKChannelManagerReadArgs)); return res; } + ~ChannelManagerReadArgs() { ChannelManagerReadArgs_free(self); } + ChannelManagerReadArgs& operator=(ChannelManagerReadArgs&& o) { ChannelManagerReadArgs_free(self); self = o.self; memset(&o, 0, sizeof(ChannelManagerReadArgs)); return *this; } LDKChannelManagerReadArgs* operator &() { return &self; } LDKChannelManagerReadArgs* operator ->() { return &self; } const LDKChannelManagerReadArgs* operator &() const { return &self; } @@ -505,10 +541,11 @@ class DecodeError { LDKDecodeError self; public: DecodeError(const DecodeError&) = delete; - ~DecodeError() { DecodeError_free(self); } DecodeError(DecodeError&& o) : self(o.self) { memset(&o, 0, sizeof(DecodeError)); } DecodeError(LDKDecodeError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDecodeError)); } - operator LDKDecodeError() { LDKDecodeError res = self; memset(&self, 0, sizeof(LDKDecodeError)); return res; } + operator LDKDecodeError() && { LDKDecodeError res = self; memset(&self, 0, sizeof(LDKDecodeError)); return res; } + ~DecodeError() { DecodeError_free(self); } + DecodeError& operator=(DecodeError&& o) { DecodeError_free(self); self = o.self; memset(&o, 0, sizeof(DecodeError)); return *this; } LDKDecodeError* operator &() { return &self; } LDKDecodeError* operator ->() { return &self; } const LDKDecodeError* operator &() const { return &self; } @@ -519,10 +556,11 @@ class Init { LDKInit self; public: Init(const Init&) = delete; - ~Init() { Init_free(self); } Init(Init&& o) : self(o.self) { memset(&o, 0, sizeof(Init)); } Init(LDKInit&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInit)); } - operator LDKInit() { LDKInit res = self; memset(&self, 0, sizeof(LDKInit)); return res; } + operator LDKInit() && { LDKInit res = self; memset(&self, 0, sizeof(LDKInit)); return res; } + ~Init() { Init_free(self); } + Init& operator=(Init&& o) { Init_free(self); self = o.self; memset(&o, 0, sizeof(Init)); return *this; } LDKInit* operator &() { return &self; } LDKInit* operator ->() { return &self; } const LDKInit* operator &() const { return &self; } @@ -533,10 +571,11 @@ class ErrorMessage { LDKErrorMessage self; public: ErrorMessage(const ErrorMessage&) = delete; - ~ErrorMessage() { ErrorMessage_free(self); } ErrorMessage(ErrorMessage&& o) : self(o.self) { memset(&o, 0, sizeof(ErrorMessage)); } ErrorMessage(LDKErrorMessage&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKErrorMessage)); } - operator LDKErrorMessage() { LDKErrorMessage res = self; memset(&self, 0, sizeof(LDKErrorMessage)); return res; } + operator LDKErrorMessage() && { LDKErrorMessage res = self; memset(&self, 0, sizeof(LDKErrorMessage)); return res; } + ~ErrorMessage() { ErrorMessage_free(self); } + ErrorMessage& operator=(ErrorMessage&& o) { ErrorMessage_free(self); self = o.self; memset(&o, 0, sizeof(ErrorMessage)); return *this; } LDKErrorMessage* operator &() { return &self; } LDKErrorMessage* operator ->() { return &self; } const LDKErrorMessage* operator &() const { return &self; } @@ -547,10 +586,11 @@ class Ping { LDKPing self; public: Ping(const Ping&) = delete; - ~Ping() { Ping_free(self); } Ping(Ping&& o) : self(o.self) { memset(&o, 0, sizeof(Ping)); } Ping(LDKPing&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPing)); } - operator LDKPing() { LDKPing res = self; memset(&self, 0, sizeof(LDKPing)); return res; } + operator LDKPing() && { LDKPing res = self; memset(&self, 0, sizeof(LDKPing)); return res; } + ~Ping() { Ping_free(self); } + Ping& operator=(Ping&& o) { Ping_free(self); self = o.self; memset(&o, 0, sizeof(Ping)); return *this; } LDKPing* operator &() { return &self; } LDKPing* operator ->() { return &self; } const LDKPing* operator &() const { return &self; } @@ -561,10 +601,11 @@ class Pong { LDKPong self; public: Pong(const Pong&) = delete; - ~Pong() { Pong_free(self); } Pong(Pong&& o) : self(o.self) { memset(&o, 0, sizeof(Pong)); } Pong(LDKPong&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPong)); } - operator LDKPong() { LDKPong res = self; memset(&self, 0, sizeof(LDKPong)); return res; } + operator LDKPong() && { LDKPong res = self; memset(&self, 0, sizeof(LDKPong)); return res; } + ~Pong() { Pong_free(self); } + Pong& operator=(Pong&& o) { Pong_free(self); self = o.self; memset(&o, 0, sizeof(Pong)); return *this; } LDKPong* operator &() { return &self; } LDKPong* operator ->() { return &self; } const LDKPong* operator &() const { return &self; } @@ -575,10 +616,11 @@ class OpenChannel { LDKOpenChannel self; public: OpenChannel(const OpenChannel&) = delete; - ~OpenChannel() { OpenChannel_free(self); } OpenChannel(OpenChannel&& o) : self(o.self) { memset(&o, 0, sizeof(OpenChannel)); } OpenChannel(LDKOpenChannel&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOpenChannel)); } - operator LDKOpenChannel() { LDKOpenChannel res = self; memset(&self, 0, sizeof(LDKOpenChannel)); return res; } + operator LDKOpenChannel() && { LDKOpenChannel res = self; memset(&self, 0, sizeof(LDKOpenChannel)); return res; } + ~OpenChannel() { OpenChannel_free(self); } + OpenChannel& operator=(OpenChannel&& o) { OpenChannel_free(self); self = o.self; memset(&o, 0, sizeof(OpenChannel)); return *this; } LDKOpenChannel* operator &() { return &self; } LDKOpenChannel* operator ->() { return &self; } const LDKOpenChannel* operator &() const { return &self; } @@ -589,10 +631,11 @@ class AcceptChannel { LDKAcceptChannel self; public: AcceptChannel(const AcceptChannel&) = delete; - ~AcceptChannel() { AcceptChannel_free(self); } AcceptChannel(AcceptChannel&& o) : self(o.self) { memset(&o, 0, sizeof(AcceptChannel)); } AcceptChannel(LDKAcceptChannel&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAcceptChannel)); } - operator LDKAcceptChannel() { LDKAcceptChannel res = self; memset(&self, 0, sizeof(LDKAcceptChannel)); return res; } + operator LDKAcceptChannel() && { LDKAcceptChannel res = self; memset(&self, 0, sizeof(LDKAcceptChannel)); return res; } + ~AcceptChannel() { AcceptChannel_free(self); } + AcceptChannel& operator=(AcceptChannel&& o) { AcceptChannel_free(self); self = o.self; memset(&o, 0, sizeof(AcceptChannel)); return *this; } LDKAcceptChannel* operator &() { return &self; } LDKAcceptChannel* operator ->() { return &self; } const LDKAcceptChannel* operator &() const { return &self; } @@ -603,10 +646,11 @@ class FundingCreated { LDKFundingCreated self; public: FundingCreated(const FundingCreated&) = delete; - ~FundingCreated() { FundingCreated_free(self); } FundingCreated(FundingCreated&& o) : self(o.self) { memset(&o, 0, sizeof(FundingCreated)); } FundingCreated(LDKFundingCreated&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFundingCreated)); } - operator LDKFundingCreated() { LDKFundingCreated res = self; memset(&self, 0, sizeof(LDKFundingCreated)); return res; } + operator LDKFundingCreated() && { LDKFundingCreated res = self; memset(&self, 0, sizeof(LDKFundingCreated)); return res; } + ~FundingCreated() { FundingCreated_free(self); } + FundingCreated& operator=(FundingCreated&& o) { FundingCreated_free(self); self = o.self; memset(&o, 0, sizeof(FundingCreated)); return *this; } LDKFundingCreated* operator &() { return &self; } LDKFundingCreated* operator ->() { return &self; } const LDKFundingCreated* operator &() const { return &self; } @@ -617,10 +661,11 @@ class FundingSigned { LDKFundingSigned self; public: FundingSigned(const FundingSigned&) = delete; - ~FundingSigned() { FundingSigned_free(self); } FundingSigned(FundingSigned&& o) : self(o.self) { memset(&o, 0, sizeof(FundingSigned)); } FundingSigned(LDKFundingSigned&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFundingSigned)); } - operator LDKFundingSigned() { LDKFundingSigned res = self; memset(&self, 0, sizeof(LDKFundingSigned)); return res; } + operator LDKFundingSigned() && { LDKFundingSigned res = self; memset(&self, 0, sizeof(LDKFundingSigned)); return res; } + ~FundingSigned() { FundingSigned_free(self); } + FundingSigned& operator=(FundingSigned&& o) { FundingSigned_free(self); self = o.self; memset(&o, 0, sizeof(FundingSigned)); return *this; } LDKFundingSigned* operator &() { return &self; } LDKFundingSigned* operator ->() { return &self; } const LDKFundingSigned* operator &() const { return &self; } @@ -631,10 +676,11 @@ class FundingLocked { LDKFundingLocked self; public: FundingLocked(const FundingLocked&) = delete; - ~FundingLocked() { FundingLocked_free(self); } FundingLocked(FundingLocked&& o) : self(o.self) { memset(&o, 0, sizeof(FundingLocked)); } FundingLocked(LDKFundingLocked&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFundingLocked)); } - operator LDKFundingLocked() { LDKFundingLocked res = self; memset(&self, 0, sizeof(LDKFundingLocked)); return res; } + operator LDKFundingLocked() && { LDKFundingLocked res = self; memset(&self, 0, sizeof(LDKFundingLocked)); return res; } + ~FundingLocked() { FundingLocked_free(self); } + FundingLocked& operator=(FundingLocked&& o) { FundingLocked_free(self); self = o.self; memset(&o, 0, sizeof(FundingLocked)); return *this; } LDKFundingLocked* operator &() { return &self; } LDKFundingLocked* operator ->() { return &self; } const LDKFundingLocked* operator &() const { return &self; } @@ -645,10 +691,11 @@ class Shutdown { LDKShutdown self; public: Shutdown(const Shutdown&) = delete; - ~Shutdown() { Shutdown_free(self); } Shutdown(Shutdown&& o) : self(o.self) { memset(&o, 0, sizeof(Shutdown)); } Shutdown(LDKShutdown&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKShutdown)); } - operator LDKShutdown() { LDKShutdown res = self; memset(&self, 0, sizeof(LDKShutdown)); return res; } + operator LDKShutdown() && { LDKShutdown res = self; memset(&self, 0, sizeof(LDKShutdown)); return res; } + ~Shutdown() { Shutdown_free(self); } + Shutdown& operator=(Shutdown&& o) { Shutdown_free(self); self = o.self; memset(&o, 0, sizeof(Shutdown)); return *this; } LDKShutdown* operator &() { return &self; } LDKShutdown* operator ->() { return &self; } const LDKShutdown* operator &() const { return &self; } @@ -659,10 +706,11 @@ class ClosingSigned { LDKClosingSigned self; public: ClosingSigned(const ClosingSigned&) = delete; - ~ClosingSigned() { ClosingSigned_free(self); } ClosingSigned(ClosingSigned&& o) : self(o.self) { memset(&o, 0, sizeof(ClosingSigned)); } ClosingSigned(LDKClosingSigned&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKClosingSigned)); } - operator LDKClosingSigned() { LDKClosingSigned res = self; memset(&self, 0, sizeof(LDKClosingSigned)); return res; } + operator LDKClosingSigned() && { LDKClosingSigned res = self; memset(&self, 0, sizeof(LDKClosingSigned)); return res; } + ~ClosingSigned() { ClosingSigned_free(self); } + ClosingSigned& operator=(ClosingSigned&& o) { ClosingSigned_free(self); self = o.self; memset(&o, 0, sizeof(ClosingSigned)); return *this; } LDKClosingSigned* operator &() { return &self; } LDKClosingSigned* operator ->() { return &self; } const LDKClosingSigned* operator &() const { return &self; } @@ -673,10 +721,11 @@ class UpdateAddHTLC { LDKUpdateAddHTLC self; public: UpdateAddHTLC(const UpdateAddHTLC&) = delete; - ~UpdateAddHTLC() { UpdateAddHTLC_free(self); } UpdateAddHTLC(UpdateAddHTLC&& o) : self(o.self) { memset(&o, 0, sizeof(UpdateAddHTLC)); } UpdateAddHTLC(LDKUpdateAddHTLC&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUpdateAddHTLC)); } - operator LDKUpdateAddHTLC() { LDKUpdateAddHTLC res = self; memset(&self, 0, sizeof(LDKUpdateAddHTLC)); return res; } + operator LDKUpdateAddHTLC() && { LDKUpdateAddHTLC res = self; memset(&self, 0, sizeof(LDKUpdateAddHTLC)); return res; } + ~UpdateAddHTLC() { UpdateAddHTLC_free(self); } + UpdateAddHTLC& operator=(UpdateAddHTLC&& o) { UpdateAddHTLC_free(self); self = o.self; memset(&o, 0, sizeof(UpdateAddHTLC)); return *this; } LDKUpdateAddHTLC* operator &() { return &self; } LDKUpdateAddHTLC* operator ->() { return &self; } const LDKUpdateAddHTLC* operator &() const { return &self; } @@ -687,10 +736,11 @@ class UpdateFulfillHTLC { LDKUpdateFulfillHTLC self; public: UpdateFulfillHTLC(const UpdateFulfillHTLC&) = delete; - ~UpdateFulfillHTLC() { UpdateFulfillHTLC_free(self); } UpdateFulfillHTLC(UpdateFulfillHTLC&& o) : self(o.self) { memset(&o, 0, sizeof(UpdateFulfillHTLC)); } UpdateFulfillHTLC(LDKUpdateFulfillHTLC&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUpdateFulfillHTLC)); } - operator LDKUpdateFulfillHTLC() { LDKUpdateFulfillHTLC res = self; memset(&self, 0, sizeof(LDKUpdateFulfillHTLC)); return res; } + operator LDKUpdateFulfillHTLC() && { LDKUpdateFulfillHTLC res = self; memset(&self, 0, sizeof(LDKUpdateFulfillHTLC)); return res; } + ~UpdateFulfillHTLC() { UpdateFulfillHTLC_free(self); } + UpdateFulfillHTLC& operator=(UpdateFulfillHTLC&& o) { UpdateFulfillHTLC_free(self); self = o.self; memset(&o, 0, sizeof(UpdateFulfillHTLC)); return *this; } LDKUpdateFulfillHTLC* operator &() { return &self; } LDKUpdateFulfillHTLC* operator ->() { return &self; } const LDKUpdateFulfillHTLC* operator &() const { return &self; } @@ -701,10 +751,11 @@ class UpdateFailHTLC { LDKUpdateFailHTLC self; public: UpdateFailHTLC(const UpdateFailHTLC&) = delete; - ~UpdateFailHTLC() { UpdateFailHTLC_free(self); } UpdateFailHTLC(UpdateFailHTLC&& o) : self(o.self) { memset(&o, 0, sizeof(UpdateFailHTLC)); } UpdateFailHTLC(LDKUpdateFailHTLC&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUpdateFailHTLC)); } - operator LDKUpdateFailHTLC() { LDKUpdateFailHTLC res = self; memset(&self, 0, sizeof(LDKUpdateFailHTLC)); return res; } + operator LDKUpdateFailHTLC() && { LDKUpdateFailHTLC res = self; memset(&self, 0, sizeof(LDKUpdateFailHTLC)); return res; } + ~UpdateFailHTLC() { UpdateFailHTLC_free(self); } + UpdateFailHTLC& operator=(UpdateFailHTLC&& o) { UpdateFailHTLC_free(self); self = o.self; memset(&o, 0, sizeof(UpdateFailHTLC)); return *this; } LDKUpdateFailHTLC* operator &() { return &self; } LDKUpdateFailHTLC* operator ->() { return &self; } const LDKUpdateFailHTLC* operator &() const { return &self; } @@ -715,10 +766,11 @@ class UpdateFailMalformedHTLC { LDKUpdateFailMalformedHTLC self; public: UpdateFailMalformedHTLC(const UpdateFailMalformedHTLC&) = delete; - ~UpdateFailMalformedHTLC() { UpdateFailMalformedHTLC_free(self); } UpdateFailMalformedHTLC(UpdateFailMalformedHTLC&& o) : self(o.self) { memset(&o, 0, sizeof(UpdateFailMalformedHTLC)); } UpdateFailMalformedHTLC(LDKUpdateFailMalformedHTLC&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUpdateFailMalformedHTLC)); } - operator LDKUpdateFailMalformedHTLC() { LDKUpdateFailMalformedHTLC res = self; memset(&self, 0, sizeof(LDKUpdateFailMalformedHTLC)); return res; } + operator LDKUpdateFailMalformedHTLC() && { LDKUpdateFailMalformedHTLC res = self; memset(&self, 0, sizeof(LDKUpdateFailMalformedHTLC)); return res; } + ~UpdateFailMalformedHTLC() { UpdateFailMalformedHTLC_free(self); } + UpdateFailMalformedHTLC& operator=(UpdateFailMalformedHTLC&& o) { UpdateFailMalformedHTLC_free(self); self = o.self; memset(&o, 0, sizeof(UpdateFailMalformedHTLC)); return *this; } LDKUpdateFailMalformedHTLC* operator &() { return &self; } LDKUpdateFailMalformedHTLC* operator ->() { return &self; } const LDKUpdateFailMalformedHTLC* operator &() const { return &self; } @@ -729,10 +781,11 @@ class CommitmentSigned { LDKCommitmentSigned self; public: CommitmentSigned(const CommitmentSigned&) = delete; - ~CommitmentSigned() { CommitmentSigned_free(self); } CommitmentSigned(CommitmentSigned&& o) : self(o.self) { memset(&o, 0, sizeof(CommitmentSigned)); } CommitmentSigned(LDKCommitmentSigned&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCommitmentSigned)); } - operator LDKCommitmentSigned() { LDKCommitmentSigned res = self; memset(&self, 0, sizeof(LDKCommitmentSigned)); return res; } + operator LDKCommitmentSigned() && { LDKCommitmentSigned res = self; memset(&self, 0, sizeof(LDKCommitmentSigned)); return res; } + ~CommitmentSigned() { CommitmentSigned_free(self); } + CommitmentSigned& operator=(CommitmentSigned&& o) { CommitmentSigned_free(self); self = o.self; memset(&o, 0, sizeof(CommitmentSigned)); return *this; } LDKCommitmentSigned* operator &() { return &self; } LDKCommitmentSigned* operator ->() { return &self; } const LDKCommitmentSigned* operator &() const { return &self; } @@ -743,10 +796,11 @@ class RevokeAndACK { LDKRevokeAndACK self; public: RevokeAndACK(const RevokeAndACK&) = delete; - ~RevokeAndACK() { RevokeAndACK_free(self); } RevokeAndACK(RevokeAndACK&& o) : self(o.self) { memset(&o, 0, sizeof(RevokeAndACK)); } RevokeAndACK(LDKRevokeAndACK&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRevokeAndACK)); } - operator LDKRevokeAndACK() { LDKRevokeAndACK res = self; memset(&self, 0, sizeof(LDKRevokeAndACK)); return res; } + operator LDKRevokeAndACK() && { LDKRevokeAndACK res = self; memset(&self, 0, sizeof(LDKRevokeAndACK)); return res; } + ~RevokeAndACK() { RevokeAndACK_free(self); } + RevokeAndACK& operator=(RevokeAndACK&& o) { RevokeAndACK_free(self); self = o.self; memset(&o, 0, sizeof(RevokeAndACK)); return *this; } LDKRevokeAndACK* operator &() { return &self; } LDKRevokeAndACK* operator ->() { return &self; } const LDKRevokeAndACK* operator &() const { return &self; } @@ -757,10 +811,11 @@ class UpdateFee { LDKUpdateFee self; public: UpdateFee(const UpdateFee&) = delete; - ~UpdateFee() { UpdateFee_free(self); } UpdateFee(UpdateFee&& o) : self(o.self) { memset(&o, 0, sizeof(UpdateFee)); } UpdateFee(LDKUpdateFee&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUpdateFee)); } - operator LDKUpdateFee() { LDKUpdateFee res = self; memset(&self, 0, sizeof(LDKUpdateFee)); return res; } + operator LDKUpdateFee() && { LDKUpdateFee res = self; memset(&self, 0, sizeof(LDKUpdateFee)); return res; } + ~UpdateFee() { UpdateFee_free(self); } + UpdateFee& operator=(UpdateFee&& o) { UpdateFee_free(self); self = o.self; memset(&o, 0, sizeof(UpdateFee)); return *this; } LDKUpdateFee* operator &() { return &self; } LDKUpdateFee* operator ->() { return &self; } const LDKUpdateFee* operator &() const { return &self; } @@ -771,10 +826,11 @@ class DataLossProtect { LDKDataLossProtect self; public: DataLossProtect(const DataLossProtect&) = delete; - ~DataLossProtect() { DataLossProtect_free(self); } DataLossProtect(DataLossProtect&& o) : self(o.self) { memset(&o, 0, sizeof(DataLossProtect)); } DataLossProtect(LDKDataLossProtect&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDataLossProtect)); } - operator LDKDataLossProtect() { LDKDataLossProtect res = self; memset(&self, 0, sizeof(LDKDataLossProtect)); return res; } + operator LDKDataLossProtect() && { LDKDataLossProtect res = self; memset(&self, 0, sizeof(LDKDataLossProtect)); return res; } + ~DataLossProtect() { DataLossProtect_free(self); } + DataLossProtect& operator=(DataLossProtect&& o) { DataLossProtect_free(self); self = o.self; memset(&o, 0, sizeof(DataLossProtect)); return *this; } LDKDataLossProtect* operator &() { return &self; } LDKDataLossProtect* operator ->() { return &self; } const LDKDataLossProtect* operator &() const { return &self; } @@ -785,10 +841,11 @@ class ChannelReestablish { LDKChannelReestablish self; public: ChannelReestablish(const ChannelReestablish&) = delete; - ~ChannelReestablish() { ChannelReestablish_free(self); } ChannelReestablish(ChannelReestablish&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelReestablish)); } ChannelReestablish(LDKChannelReestablish&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelReestablish)); } - operator LDKChannelReestablish() { LDKChannelReestablish res = self; memset(&self, 0, sizeof(LDKChannelReestablish)); return res; } + operator LDKChannelReestablish() && { LDKChannelReestablish res = self; memset(&self, 0, sizeof(LDKChannelReestablish)); return res; } + ~ChannelReestablish() { ChannelReestablish_free(self); } + ChannelReestablish& operator=(ChannelReestablish&& o) { ChannelReestablish_free(self); self = o.self; memset(&o, 0, sizeof(ChannelReestablish)); return *this; } LDKChannelReestablish* operator &() { return &self; } LDKChannelReestablish* operator ->() { return &self; } const LDKChannelReestablish* operator &() const { return &self; } @@ -799,10 +856,11 @@ class AnnouncementSignatures { LDKAnnouncementSignatures self; public: AnnouncementSignatures(const AnnouncementSignatures&) = delete; - ~AnnouncementSignatures() { AnnouncementSignatures_free(self); } AnnouncementSignatures(AnnouncementSignatures&& o) : self(o.self) { memset(&o, 0, sizeof(AnnouncementSignatures)); } AnnouncementSignatures(LDKAnnouncementSignatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAnnouncementSignatures)); } - operator LDKAnnouncementSignatures() { LDKAnnouncementSignatures res = self; memset(&self, 0, sizeof(LDKAnnouncementSignatures)); return res; } + operator LDKAnnouncementSignatures() && { LDKAnnouncementSignatures res = self; memset(&self, 0, sizeof(LDKAnnouncementSignatures)); return res; } + ~AnnouncementSignatures() { AnnouncementSignatures_free(self); } + AnnouncementSignatures& operator=(AnnouncementSignatures&& o) { AnnouncementSignatures_free(self); self = o.self; memset(&o, 0, sizeof(AnnouncementSignatures)); return *this; } LDKAnnouncementSignatures* operator &() { return &self; } LDKAnnouncementSignatures* operator ->() { return &self; } const LDKAnnouncementSignatures* operator &() const { return &self; } @@ -813,10 +871,11 @@ class NetAddress { LDKNetAddress self; public: NetAddress(const NetAddress&) = delete; - ~NetAddress() { NetAddress_free(self); } NetAddress(NetAddress&& o) : self(o.self) { memset(&o, 0, sizeof(NetAddress)); } NetAddress(LDKNetAddress&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNetAddress)); } - operator LDKNetAddress() { LDKNetAddress res = self; memset(&self, 0, sizeof(LDKNetAddress)); return res; } + operator LDKNetAddress() && { LDKNetAddress res = self; memset(&self, 0, sizeof(LDKNetAddress)); return res; } + ~NetAddress() { NetAddress_free(self); } + NetAddress& operator=(NetAddress&& o) { NetAddress_free(self); self = o.self; memset(&o, 0, sizeof(NetAddress)); return *this; } LDKNetAddress* operator &() { return &self; } LDKNetAddress* operator ->() { return &self; } const LDKNetAddress* operator &() const { return &self; } @@ -827,10 +886,11 @@ class UnsignedNodeAnnouncement { LDKUnsignedNodeAnnouncement self; public: UnsignedNodeAnnouncement(const UnsignedNodeAnnouncement&) = delete; - ~UnsignedNodeAnnouncement() { UnsignedNodeAnnouncement_free(self); } UnsignedNodeAnnouncement(UnsignedNodeAnnouncement&& o) : self(o.self) { memset(&o, 0, sizeof(UnsignedNodeAnnouncement)); } UnsignedNodeAnnouncement(LDKUnsignedNodeAnnouncement&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUnsignedNodeAnnouncement)); } - operator LDKUnsignedNodeAnnouncement() { LDKUnsignedNodeAnnouncement res = self; memset(&self, 0, sizeof(LDKUnsignedNodeAnnouncement)); return res; } + operator LDKUnsignedNodeAnnouncement() && { LDKUnsignedNodeAnnouncement res = self; memset(&self, 0, sizeof(LDKUnsignedNodeAnnouncement)); return res; } + ~UnsignedNodeAnnouncement() { UnsignedNodeAnnouncement_free(self); } + UnsignedNodeAnnouncement& operator=(UnsignedNodeAnnouncement&& o) { UnsignedNodeAnnouncement_free(self); self = o.self; memset(&o, 0, sizeof(UnsignedNodeAnnouncement)); return *this; } LDKUnsignedNodeAnnouncement* operator &() { return &self; } LDKUnsignedNodeAnnouncement* operator ->() { return &self; } const LDKUnsignedNodeAnnouncement* operator &() const { return &self; } @@ -841,10 +901,11 @@ class NodeAnnouncement { LDKNodeAnnouncement self; public: NodeAnnouncement(const NodeAnnouncement&) = delete; - ~NodeAnnouncement() { NodeAnnouncement_free(self); } NodeAnnouncement(NodeAnnouncement&& o) : self(o.self) { memset(&o, 0, sizeof(NodeAnnouncement)); } NodeAnnouncement(LDKNodeAnnouncement&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNodeAnnouncement)); } - operator LDKNodeAnnouncement() { LDKNodeAnnouncement res = self; memset(&self, 0, sizeof(LDKNodeAnnouncement)); return res; } + operator LDKNodeAnnouncement() && { LDKNodeAnnouncement res = self; memset(&self, 0, sizeof(LDKNodeAnnouncement)); return res; } + ~NodeAnnouncement() { NodeAnnouncement_free(self); } + NodeAnnouncement& operator=(NodeAnnouncement&& o) { NodeAnnouncement_free(self); self = o.self; memset(&o, 0, sizeof(NodeAnnouncement)); return *this; } LDKNodeAnnouncement* operator &() { return &self; } LDKNodeAnnouncement* operator ->() { return &self; } const LDKNodeAnnouncement* operator &() const { return &self; } @@ -855,10 +916,11 @@ class UnsignedChannelAnnouncement { LDKUnsignedChannelAnnouncement self; public: UnsignedChannelAnnouncement(const UnsignedChannelAnnouncement&) = delete; - ~UnsignedChannelAnnouncement() { UnsignedChannelAnnouncement_free(self); } UnsignedChannelAnnouncement(UnsignedChannelAnnouncement&& o) : self(o.self) { memset(&o, 0, sizeof(UnsignedChannelAnnouncement)); } UnsignedChannelAnnouncement(LDKUnsignedChannelAnnouncement&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUnsignedChannelAnnouncement)); } - operator LDKUnsignedChannelAnnouncement() { LDKUnsignedChannelAnnouncement res = self; memset(&self, 0, sizeof(LDKUnsignedChannelAnnouncement)); return res; } + operator LDKUnsignedChannelAnnouncement() && { LDKUnsignedChannelAnnouncement res = self; memset(&self, 0, sizeof(LDKUnsignedChannelAnnouncement)); return res; } + ~UnsignedChannelAnnouncement() { UnsignedChannelAnnouncement_free(self); } + UnsignedChannelAnnouncement& operator=(UnsignedChannelAnnouncement&& o) { UnsignedChannelAnnouncement_free(self); self = o.self; memset(&o, 0, sizeof(UnsignedChannelAnnouncement)); return *this; } LDKUnsignedChannelAnnouncement* operator &() { return &self; } LDKUnsignedChannelAnnouncement* operator ->() { return &self; } const LDKUnsignedChannelAnnouncement* operator &() const { return &self; } @@ -869,10 +931,11 @@ class ChannelAnnouncement { LDKChannelAnnouncement self; public: ChannelAnnouncement(const ChannelAnnouncement&) = delete; - ~ChannelAnnouncement() { ChannelAnnouncement_free(self); } ChannelAnnouncement(ChannelAnnouncement&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelAnnouncement)); } ChannelAnnouncement(LDKChannelAnnouncement&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelAnnouncement)); } - operator LDKChannelAnnouncement() { LDKChannelAnnouncement res = self; memset(&self, 0, sizeof(LDKChannelAnnouncement)); return res; } + operator LDKChannelAnnouncement() && { LDKChannelAnnouncement res = self; memset(&self, 0, sizeof(LDKChannelAnnouncement)); return res; } + ~ChannelAnnouncement() { ChannelAnnouncement_free(self); } + ChannelAnnouncement& operator=(ChannelAnnouncement&& o) { ChannelAnnouncement_free(self); self = o.self; memset(&o, 0, sizeof(ChannelAnnouncement)); return *this; } LDKChannelAnnouncement* operator &() { return &self; } LDKChannelAnnouncement* operator ->() { return &self; } const LDKChannelAnnouncement* operator &() const { return &self; } @@ -883,10 +946,11 @@ class UnsignedChannelUpdate { LDKUnsignedChannelUpdate self; public: UnsignedChannelUpdate(const UnsignedChannelUpdate&) = delete; - ~UnsignedChannelUpdate() { UnsignedChannelUpdate_free(self); } UnsignedChannelUpdate(UnsignedChannelUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(UnsignedChannelUpdate)); } UnsignedChannelUpdate(LDKUnsignedChannelUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUnsignedChannelUpdate)); } - operator LDKUnsignedChannelUpdate() { LDKUnsignedChannelUpdate res = self; memset(&self, 0, sizeof(LDKUnsignedChannelUpdate)); return res; } + operator LDKUnsignedChannelUpdate() && { LDKUnsignedChannelUpdate res = self; memset(&self, 0, sizeof(LDKUnsignedChannelUpdate)); return res; } + ~UnsignedChannelUpdate() { UnsignedChannelUpdate_free(self); } + UnsignedChannelUpdate& operator=(UnsignedChannelUpdate&& o) { UnsignedChannelUpdate_free(self); self = o.self; memset(&o, 0, sizeof(UnsignedChannelUpdate)); return *this; } LDKUnsignedChannelUpdate* operator &() { return &self; } LDKUnsignedChannelUpdate* operator ->() { return &self; } const LDKUnsignedChannelUpdate* operator &() const { return &self; } @@ -897,10 +961,11 @@ class ChannelUpdate { LDKChannelUpdate self; public: ChannelUpdate(const ChannelUpdate&) = delete; - ~ChannelUpdate() { ChannelUpdate_free(self); } ChannelUpdate(ChannelUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelUpdate)); } ChannelUpdate(LDKChannelUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelUpdate)); } - operator LDKChannelUpdate() { LDKChannelUpdate res = self; memset(&self, 0, sizeof(LDKChannelUpdate)); return res; } + operator LDKChannelUpdate() && { LDKChannelUpdate res = self; memset(&self, 0, sizeof(LDKChannelUpdate)); return res; } + ~ChannelUpdate() { ChannelUpdate_free(self); } + ChannelUpdate& operator=(ChannelUpdate&& o) { ChannelUpdate_free(self); self = o.self; memset(&o, 0, sizeof(ChannelUpdate)); return *this; } LDKChannelUpdate* operator &() { return &self; } LDKChannelUpdate* operator ->() { return &self; } const LDKChannelUpdate* operator &() const { return &self; } @@ -911,10 +976,11 @@ class QueryChannelRange { LDKQueryChannelRange self; public: QueryChannelRange(const QueryChannelRange&) = delete; - ~QueryChannelRange() { QueryChannelRange_free(self); } QueryChannelRange(QueryChannelRange&& o) : self(o.self) { memset(&o, 0, sizeof(QueryChannelRange)); } QueryChannelRange(LDKQueryChannelRange&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKQueryChannelRange)); } - operator LDKQueryChannelRange() { LDKQueryChannelRange res = self; memset(&self, 0, sizeof(LDKQueryChannelRange)); return res; } + operator LDKQueryChannelRange() && { LDKQueryChannelRange res = self; memset(&self, 0, sizeof(LDKQueryChannelRange)); return res; } + ~QueryChannelRange() { QueryChannelRange_free(self); } + QueryChannelRange& operator=(QueryChannelRange&& o) { QueryChannelRange_free(self); self = o.self; memset(&o, 0, sizeof(QueryChannelRange)); return *this; } LDKQueryChannelRange* operator &() { return &self; } LDKQueryChannelRange* operator ->() { return &self; } const LDKQueryChannelRange* operator &() const { return &self; } @@ -925,10 +991,11 @@ class ReplyChannelRange { LDKReplyChannelRange self; public: ReplyChannelRange(const ReplyChannelRange&) = delete; - ~ReplyChannelRange() { ReplyChannelRange_free(self); } ReplyChannelRange(ReplyChannelRange&& o) : self(o.self) { memset(&o, 0, sizeof(ReplyChannelRange)); } ReplyChannelRange(LDKReplyChannelRange&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKReplyChannelRange)); } - operator LDKReplyChannelRange() { LDKReplyChannelRange res = self; memset(&self, 0, sizeof(LDKReplyChannelRange)); return res; } + operator LDKReplyChannelRange() && { LDKReplyChannelRange res = self; memset(&self, 0, sizeof(LDKReplyChannelRange)); return res; } + ~ReplyChannelRange() { ReplyChannelRange_free(self); } + ReplyChannelRange& operator=(ReplyChannelRange&& o) { ReplyChannelRange_free(self); self = o.self; memset(&o, 0, sizeof(ReplyChannelRange)); return *this; } LDKReplyChannelRange* operator &() { return &self; } LDKReplyChannelRange* operator ->() { return &self; } const LDKReplyChannelRange* operator &() const { return &self; } @@ -939,10 +1006,11 @@ class QueryShortChannelIds { LDKQueryShortChannelIds self; public: QueryShortChannelIds(const QueryShortChannelIds&) = delete; - ~QueryShortChannelIds() { QueryShortChannelIds_free(self); } QueryShortChannelIds(QueryShortChannelIds&& o) : self(o.self) { memset(&o, 0, sizeof(QueryShortChannelIds)); } QueryShortChannelIds(LDKQueryShortChannelIds&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKQueryShortChannelIds)); } - operator LDKQueryShortChannelIds() { LDKQueryShortChannelIds res = self; memset(&self, 0, sizeof(LDKQueryShortChannelIds)); return res; } + operator LDKQueryShortChannelIds() && { LDKQueryShortChannelIds res = self; memset(&self, 0, sizeof(LDKQueryShortChannelIds)); return res; } + ~QueryShortChannelIds() { QueryShortChannelIds_free(self); } + QueryShortChannelIds& operator=(QueryShortChannelIds&& o) { QueryShortChannelIds_free(self); self = o.self; memset(&o, 0, sizeof(QueryShortChannelIds)); return *this; } LDKQueryShortChannelIds* operator &() { return &self; } LDKQueryShortChannelIds* operator ->() { return &self; } const LDKQueryShortChannelIds* operator &() const { return &self; } @@ -953,10 +1021,11 @@ class ReplyShortChannelIdsEnd { LDKReplyShortChannelIdsEnd self; public: ReplyShortChannelIdsEnd(const ReplyShortChannelIdsEnd&) = delete; - ~ReplyShortChannelIdsEnd() { ReplyShortChannelIdsEnd_free(self); } ReplyShortChannelIdsEnd(ReplyShortChannelIdsEnd&& o) : self(o.self) { memset(&o, 0, sizeof(ReplyShortChannelIdsEnd)); } ReplyShortChannelIdsEnd(LDKReplyShortChannelIdsEnd&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKReplyShortChannelIdsEnd)); } - operator LDKReplyShortChannelIdsEnd() { LDKReplyShortChannelIdsEnd res = self; memset(&self, 0, sizeof(LDKReplyShortChannelIdsEnd)); return res; } + operator LDKReplyShortChannelIdsEnd() && { LDKReplyShortChannelIdsEnd res = self; memset(&self, 0, sizeof(LDKReplyShortChannelIdsEnd)); return res; } + ~ReplyShortChannelIdsEnd() { ReplyShortChannelIdsEnd_free(self); } + ReplyShortChannelIdsEnd& operator=(ReplyShortChannelIdsEnd&& o) { ReplyShortChannelIdsEnd_free(self); self = o.self; memset(&o, 0, sizeof(ReplyShortChannelIdsEnd)); return *this; } LDKReplyShortChannelIdsEnd* operator &() { return &self; } LDKReplyShortChannelIdsEnd* operator ->() { return &self; } const LDKReplyShortChannelIdsEnd* operator &() const { return &self; } @@ -967,10 +1036,11 @@ class GossipTimestampFilter { LDKGossipTimestampFilter self; public: GossipTimestampFilter(const GossipTimestampFilter&) = delete; - ~GossipTimestampFilter() { GossipTimestampFilter_free(self); } GossipTimestampFilter(GossipTimestampFilter&& o) : self(o.self) { memset(&o, 0, sizeof(GossipTimestampFilter)); } GossipTimestampFilter(LDKGossipTimestampFilter&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKGossipTimestampFilter)); } - operator LDKGossipTimestampFilter() { LDKGossipTimestampFilter res = self; memset(&self, 0, sizeof(LDKGossipTimestampFilter)); return res; } + operator LDKGossipTimestampFilter() && { LDKGossipTimestampFilter res = self; memset(&self, 0, sizeof(LDKGossipTimestampFilter)); return res; } + ~GossipTimestampFilter() { GossipTimestampFilter_free(self); } + GossipTimestampFilter& operator=(GossipTimestampFilter&& o) { GossipTimestampFilter_free(self); self = o.self; memset(&o, 0, sizeof(GossipTimestampFilter)); return *this; } LDKGossipTimestampFilter* operator &() { return &self; } LDKGossipTimestampFilter* operator ->() { return &self; } const LDKGossipTimestampFilter* operator &() const { return &self; } @@ -981,10 +1051,11 @@ class ErrorAction { LDKErrorAction self; public: ErrorAction(const ErrorAction&) = delete; - ~ErrorAction() { ErrorAction_free(self); } ErrorAction(ErrorAction&& o) : self(o.self) { memset(&o, 0, sizeof(ErrorAction)); } ErrorAction(LDKErrorAction&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKErrorAction)); } - operator LDKErrorAction() { LDKErrorAction res = self; memset(&self, 0, sizeof(LDKErrorAction)); return res; } + operator LDKErrorAction() && { LDKErrorAction res = self; memset(&self, 0, sizeof(LDKErrorAction)); return res; } + ~ErrorAction() { ErrorAction_free(self); } + ErrorAction& operator=(ErrorAction&& o) { ErrorAction_free(self); self = o.self; memset(&o, 0, sizeof(ErrorAction)); return *this; } LDKErrorAction* operator &() { return &self; } LDKErrorAction* operator ->() { return &self; } const LDKErrorAction* operator &() const { return &self; } @@ -995,10 +1066,11 @@ class LightningError { LDKLightningError self; public: LightningError(const LightningError&) = delete; - ~LightningError() { LightningError_free(self); } LightningError(LightningError&& o) : self(o.self) { memset(&o, 0, sizeof(LightningError)); } LightningError(LDKLightningError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLightningError)); } - operator LDKLightningError() { LDKLightningError res = self; memset(&self, 0, sizeof(LDKLightningError)); return res; } + operator LDKLightningError() && { LDKLightningError res = self; memset(&self, 0, sizeof(LDKLightningError)); return res; } + ~LightningError() { LightningError_free(self); } + LightningError& operator=(LightningError&& o) { LightningError_free(self); self = o.self; memset(&o, 0, sizeof(LightningError)); return *this; } LDKLightningError* operator &() { return &self; } LDKLightningError* operator ->() { return &self; } const LDKLightningError* operator &() const { return &self; } @@ -1009,10 +1081,11 @@ class CommitmentUpdate { LDKCommitmentUpdate self; public: CommitmentUpdate(const CommitmentUpdate&) = delete; - ~CommitmentUpdate() { CommitmentUpdate_free(self); } CommitmentUpdate(CommitmentUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(CommitmentUpdate)); } CommitmentUpdate(LDKCommitmentUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCommitmentUpdate)); } - operator LDKCommitmentUpdate() { LDKCommitmentUpdate res = self; memset(&self, 0, sizeof(LDKCommitmentUpdate)); return res; } + operator LDKCommitmentUpdate() && { LDKCommitmentUpdate res = self; memset(&self, 0, sizeof(LDKCommitmentUpdate)); return res; } + ~CommitmentUpdate() { CommitmentUpdate_free(self); } + CommitmentUpdate& operator=(CommitmentUpdate&& o) { CommitmentUpdate_free(self); self = o.self; memset(&o, 0, sizeof(CommitmentUpdate)); return *this; } LDKCommitmentUpdate* operator &() { return &self; } LDKCommitmentUpdate* operator ->() { return &self; } const LDKCommitmentUpdate* operator &() const { return &self; } @@ -1023,10 +1096,11 @@ class HTLCFailChannelUpdate { LDKHTLCFailChannelUpdate self; public: HTLCFailChannelUpdate(const HTLCFailChannelUpdate&) = delete; - ~HTLCFailChannelUpdate() { HTLCFailChannelUpdate_free(self); } HTLCFailChannelUpdate(HTLCFailChannelUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(HTLCFailChannelUpdate)); } HTLCFailChannelUpdate(LDKHTLCFailChannelUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHTLCFailChannelUpdate)); } - operator LDKHTLCFailChannelUpdate() { LDKHTLCFailChannelUpdate res = self; memset(&self, 0, sizeof(LDKHTLCFailChannelUpdate)); return res; } + operator LDKHTLCFailChannelUpdate() && { LDKHTLCFailChannelUpdate res = self; memset(&self, 0, sizeof(LDKHTLCFailChannelUpdate)); return res; } + ~HTLCFailChannelUpdate() { HTLCFailChannelUpdate_free(self); } + HTLCFailChannelUpdate& operator=(HTLCFailChannelUpdate&& o) { HTLCFailChannelUpdate_free(self); self = o.self; memset(&o, 0, sizeof(HTLCFailChannelUpdate)); return *this; } LDKHTLCFailChannelUpdate* operator &() { return &self; } LDKHTLCFailChannelUpdate* operator ->() { return &self; } const LDKHTLCFailChannelUpdate* operator &() const { return &self; } @@ -1037,10 +1111,11 @@ class ChannelMessageHandler { LDKChannelMessageHandler self; public: ChannelMessageHandler(const ChannelMessageHandler&) = delete; - ~ChannelMessageHandler() { ChannelMessageHandler_free(self); } ChannelMessageHandler(ChannelMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMessageHandler)); } ChannelMessageHandler(LDKChannelMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMessageHandler)); } - operator LDKChannelMessageHandler() { LDKChannelMessageHandler res = self; memset(&self, 0, sizeof(LDKChannelMessageHandler)); return res; } + operator LDKChannelMessageHandler() && { LDKChannelMessageHandler res = self; memset(&self, 0, sizeof(LDKChannelMessageHandler)); return res; } + ~ChannelMessageHandler() { ChannelMessageHandler_free(self); } + ChannelMessageHandler& operator=(ChannelMessageHandler&& o) { ChannelMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(ChannelMessageHandler)); return *this; } LDKChannelMessageHandler* operator &() { return &self; } LDKChannelMessageHandler* operator ->() { return &self; } const LDKChannelMessageHandler* operator &() const { return &self; } @@ -1051,10 +1126,11 @@ class RoutingMessageHandler { LDKRoutingMessageHandler self; public: RoutingMessageHandler(const RoutingMessageHandler&) = delete; - ~RoutingMessageHandler() { RoutingMessageHandler_free(self); } RoutingMessageHandler(RoutingMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(RoutingMessageHandler)); } RoutingMessageHandler(LDKRoutingMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRoutingMessageHandler)); } - operator LDKRoutingMessageHandler() { LDKRoutingMessageHandler res = self; memset(&self, 0, sizeof(LDKRoutingMessageHandler)); return res; } + operator LDKRoutingMessageHandler() && { LDKRoutingMessageHandler res = self; memset(&self, 0, sizeof(LDKRoutingMessageHandler)); return res; } + ~RoutingMessageHandler() { RoutingMessageHandler_free(self); } + RoutingMessageHandler& operator=(RoutingMessageHandler&& o) { RoutingMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(RoutingMessageHandler)); return *this; } LDKRoutingMessageHandler* operator &() { return &self; } LDKRoutingMessageHandler* operator ->() { return &self; } const LDKRoutingMessageHandler* operator &() const { return &self; } @@ -1065,10 +1141,11 @@ class MessageHandler { LDKMessageHandler self; public: MessageHandler(const MessageHandler&) = delete; - ~MessageHandler() { MessageHandler_free(self); } MessageHandler(MessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(MessageHandler)); } MessageHandler(LDKMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageHandler)); } - operator LDKMessageHandler() { LDKMessageHandler res = self; memset(&self, 0, sizeof(LDKMessageHandler)); return res; } + operator LDKMessageHandler() && { LDKMessageHandler res = self; memset(&self, 0, sizeof(LDKMessageHandler)); return res; } + ~MessageHandler() { MessageHandler_free(self); } + MessageHandler& operator=(MessageHandler&& o) { MessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(MessageHandler)); return *this; } LDKMessageHandler* operator &() { return &self; } LDKMessageHandler* operator ->() { return &self; } const LDKMessageHandler* operator &() const { return &self; } @@ -1079,10 +1156,11 @@ class SocketDescriptor { LDKSocketDescriptor self; public: SocketDescriptor(const SocketDescriptor&) = delete; - ~SocketDescriptor() { SocketDescriptor_free(self); } SocketDescriptor(SocketDescriptor&& o) : self(o.self) { memset(&o, 0, sizeof(SocketDescriptor)); } SocketDescriptor(LDKSocketDescriptor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSocketDescriptor)); } - operator LDKSocketDescriptor() { LDKSocketDescriptor res = self; memset(&self, 0, sizeof(LDKSocketDescriptor)); return res; } + operator LDKSocketDescriptor() && { LDKSocketDescriptor res = self; memset(&self, 0, sizeof(LDKSocketDescriptor)); return res; } + ~SocketDescriptor() { SocketDescriptor_free(self); } + SocketDescriptor& operator=(SocketDescriptor&& o) { SocketDescriptor_free(self); self = o.self; memset(&o, 0, sizeof(SocketDescriptor)); return *this; } LDKSocketDescriptor* operator &() { return &self; } LDKSocketDescriptor* operator ->() { return &self; } const LDKSocketDescriptor* operator &() const { return &self; } @@ -1093,10 +1171,11 @@ class PeerHandleError { LDKPeerHandleError self; public: PeerHandleError(const PeerHandleError&) = delete; - ~PeerHandleError() { PeerHandleError_free(self); } PeerHandleError(PeerHandleError&& o) : self(o.self) { memset(&o, 0, sizeof(PeerHandleError)); } PeerHandleError(LDKPeerHandleError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPeerHandleError)); } - operator LDKPeerHandleError() { LDKPeerHandleError res = self; memset(&self, 0, sizeof(LDKPeerHandleError)); return res; } + operator LDKPeerHandleError() && { LDKPeerHandleError res = self; memset(&self, 0, sizeof(LDKPeerHandleError)); return res; } + ~PeerHandleError() { PeerHandleError_free(self); } + PeerHandleError& operator=(PeerHandleError&& o) { PeerHandleError_free(self); self = o.self; memset(&o, 0, sizeof(PeerHandleError)); return *this; } LDKPeerHandleError* operator &() { return &self; } LDKPeerHandleError* operator ->() { return &self; } const LDKPeerHandleError* operator &() const { return &self; } @@ -1107,10 +1186,11 @@ class PeerManager { LDKPeerManager self; public: PeerManager(const PeerManager&) = delete; - ~PeerManager() { PeerManager_free(self); } PeerManager(PeerManager&& o) : self(o.self) { memset(&o, 0, sizeof(PeerManager)); } PeerManager(LDKPeerManager&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPeerManager)); } - operator LDKPeerManager() { LDKPeerManager res = self; memset(&self, 0, sizeof(LDKPeerManager)); return res; } + operator LDKPeerManager() && { LDKPeerManager res = self; memset(&self, 0, sizeof(LDKPeerManager)); return res; } + ~PeerManager() { PeerManager_free(self); } + PeerManager& operator=(PeerManager&& o) { PeerManager_free(self); self = o.self; memset(&o, 0, sizeof(PeerManager)); return *this; } LDKPeerManager* operator &() { return &self; } LDKPeerManager* operator ->() { return &self; } const LDKPeerManager* operator &() const { return &self; } @@ -1121,10 +1201,11 @@ class TxCreationKeys { LDKTxCreationKeys self; public: TxCreationKeys(const TxCreationKeys&) = delete; - ~TxCreationKeys() { TxCreationKeys_free(self); } TxCreationKeys(TxCreationKeys&& o) : self(o.self) { memset(&o, 0, sizeof(TxCreationKeys)); } TxCreationKeys(LDKTxCreationKeys&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKTxCreationKeys)); } - operator LDKTxCreationKeys() { LDKTxCreationKeys res = self; memset(&self, 0, sizeof(LDKTxCreationKeys)); return res; } + operator LDKTxCreationKeys() && { LDKTxCreationKeys res = self; memset(&self, 0, sizeof(LDKTxCreationKeys)); return res; } + ~TxCreationKeys() { TxCreationKeys_free(self); } + TxCreationKeys& operator=(TxCreationKeys&& o) { TxCreationKeys_free(self); self = o.self; memset(&o, 0, sizeof(TxCreationKeys)); return *this; } LDKTxCreationKeys* operator &() { return &self; } LDKTxCreationKeys* operator ->() { return &self; } const LDKTxCreationKeys* operator &() const { return &self; } @@ -1135,10 +1216,11 @@ class ChannelPublicKeys { LDKChannelPublicKeys self; public: ChannelPublicKeys(const ChannelPublicKeys&) = delete; - ~ChannelPublicKeys() { ChannelPublicKeys_free(self); } ChannelPublicKeys(ChannelPublicKeys&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelPublicKeys)); } ChannelPublicKeys(LDKChannelPublicKeys&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelPublicKeys)); } - operator LDKChannelPublicKeys() { LDKChannelPublicKeys res = self; memset(&self, 0, sizeof(LDKChannelPublicKeys)); return res; } + operator LDKChannelPublicKeys() && { LDKChannelPublicKeys res = self; memset(&self, 0, sizeof(LDKChannelPublicKeys)); return res; } + ~ChannelPublicKeys() { ChannelPublicKeys_free(self); } + ChannelPublicKeys& operator=(ChannelPublicKeys&& o) { ChannelPublicKeys_free(self); self = o.self; memset(&o, 0, sizeof(ChannelPublicKeys)); return *this; } LDKChannelPublicKeys* operator &() { return &self; } LDKChannelPublicKeys* operator ->() { return &self; } const LDKChannelPublicKeys* operator &() const { return &self; } @@ -1149,10 +1231,11 @@ class HTLCOutputInCommitment { LDKHTLCOutputInCommitment self; public: HTLCOutputInCommitment(const HTLCOutputInCommitment&) = delete; - ~HTLCOutputInCommitment() { HTLCOutputInCommitment_free(self); } HTLCOutputInCommitment(HTLCOutputInCommitment&& o) : self(o.self) { memset(&o, 0, sizeof(HTLCOutputInCommitment)); } HTLCOutputInCommitment(LDKHTLCOutputInCommitment&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHTLCOutputInCommitment)); } - operator LDKHTLCOutputInCommitment() { LDKHTLCOutputInCommitment res = self; memset(&self, 0, sizeof(LDKHTLCOutputInCommitment)); return res; } + operator LDKHTLCOutputInCommitment() && { LDKHTLCOutputInCommitment res = self; memset(&self, 0, sizeof(LDKHTLCOutputInCommitment)); return res; } + ~HTLCOutputInCommitment() { HTLCOutputInCommitment_free(self); } + HTLCOutputInCommitment& operator=(HTLCOutputInCommitment&& o) { HTLCOutputInCommitment_free(self); self = o.self; memset(&o, 0, sizeof(HTLCOutputInCommitment)); return *this; } LDKHTLCOutputInCommitment* operator &() { return &self; } LDKHTLCOutputInCommitment* operator ->() { return &self; } const LDKHTLCOutputInCommitment* operator &() const { return &self; } @@ -1163,10 +1246,11 @@ class ChannelTransactionParameters { LDKChannelTransactionParameters self; public: ChannelTransactionParameters(const ChannelTransactionParameters&) = delete; - ~ChannelTransactionParameters() { ChannelTransactionParameters_free(self); } ChannelTransactionParameters(ChannelTransactionParameters&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelTransactionParameters)); } ChannelTransactionParameters(LDKChannelTransactionParameters&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelTransactionParameters)); } - operator LDKChannelTransactionParameters() { LDKChannelTransactionParameters res = self; memset(&self, 0, sizeof(LDKChannelTransactionParameters)); return res; } + operator LDKChannelTransactionParameters() && { LDKChannelTransactionParameters res = self; memset(&self, 0, sizeof(LDKChannelTransactionParameters)); return res; } + ~ChannelTransactionParameters() { ChannelTransactionParameters_free(self); } + ChannelTransactionParameters& operator=(ChannelTransactionParameters&& o) { ChannelTransactionParameters_free(self); self = o.self; memset(&o, 0, sizeof(ChannelTransactionParameters)); return *this; } LDKChannelTransactionParameters* operator &() { return &self; } LDKChannelTransactionParameters* operator ->() { return &self; } const LDKChannelTransactionParameters* operator &() const { return &self; } @@ -1177,10 +1261,11 @@ class CounterpartyChannelTransactionParameters { LDKCounterpartyChannelTransactionParameters self; public: CounterpartyChannelTransactionParameters(const CounterpartyChannelTransactionParameters&) = delete; - ~CounterpartyChannelTransactionParameters() { CounterpartyChannelTransactionParameters_free(self); } CounterpartyChannelTransactionParameters(CounterpartyChannelTransactionParameters&& o) : self(o.self) { memset(&o, 0, sizeof(CounterpartyChannelTransactionParameters)); } CounterpartyChannelTransactionParameters(LDKCounterpartyChannelTransactionParameters&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCounterpartyChannelTransactionParameters)); } - operator LDKCounterpartyChannelTransactionParameters() { LDKCounterpartyChannelTransactionParameters res = self; memset(&self, 0, sizeof(LDKCounterpartyChannelTransactionParameters)); return res; } + operator LDKCounterpartyChannelTransactionParameters() && { LDKCounterpartyChannelTransactionParameters res = self; memset(&self, 0, sizeof(LDKCounterpartyChannelTransactionParameters)); return res; } + ~CounterpartyChannelTransactionParameters() { CounterpartyChannelTransactionParameters_free(self); } + CounterpartyChannelTransactionParameters& operator=(CounterpartyChannelTransactionParameters&& o) { CounterpartyChannelTransactionParameters_free(self); self = o.self; memset(&o, 0, sizeof(CounterpartyChannelTransactionParameters)); return *this; } LDKCounterpartyChannelTransactionParameters* operator &() { return &self; } LDKCounterpartyChannelTransactionParameters* operator ->() { return &self; } const LDKCounterpartyChannelTransactionParameters* operator &() const { return &self; } @@ -1191,10 +1276,11 @@ class DirectedChannelTransactionParameters { LDKDirectedChannelTransactionParameters self; public: DirectedChannelTransactionParameters(const DirectedChannelTransactionParameters&) = delete; - ~DirectedChannelTransactionParameters() { DirectedChannelTransactionParameters_free(self); } DirectedChannelTransactionParameters(DirectedChannelTransactionParameters&& o) : self(o.self) { memset(&o, 0, sizeof(DirectedChannelTransactionParameters)); } DirectedChannelTransactionParameters(LDKDirectedChannelTransactionParameters&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDirectedChannelTransactionParameters)); } - operator LDKDirectedChannelTransactionParameters() { LDKDirectedChannelTransactionParameters res = self; memset(&self, 0, sizeof(LDKDirectedChannelTransactionParameters)); return res; } + operator LDKDirectedChannelTransactionParameters() && { LDKDirectedChannelTransactionParameters res = self; memset(&self, 0, sizeof(LDKDirectedChannelTransactionParameters)); return res; } + ~DirectedChannelTransactionParameters() { DirectedChannelTransactionParameters_free(self); } + DirectedChannelTransactionParameters& operator=(DirectedChannelTransactionParameters&& o) { DirectedChannelTransactionParameters_free(self); self = o.self; memset(&o, 0, sizeof(DirectedChannelTransactionParameters)); return *this; } LDKDirectedChannelTransactionParameters* operator &() { return &self; } LDKDirectedChannelTransactionParameters* operator ->() { return &self; } const LDKDirectedChannelTransactionParameters* operator &() const { return &self; } @@ -1205,10 +1291,11 @@ class HolderCommitmentTransaction { LDKHolderCommitmentTransaction self; public: HolderCommitmentTransaction(const HolderCommitmentTransaction&) = delete; - ~HolderCommitmentTransaction() { HolderCommitmentTransaction_free(self); } HolderCommitmentTransaction(HolderCommitmentTransaction&& o) : self(o.self) { memset(&o, 0, sizeof(HolderCommitmentTransaction)); } HolderCommitmentTransaction(LDKHolderCommitmentTransaction&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHolderCommitmentTransaction)); } - operator LDKHolderCommitmentTransaction() { LDKHolderCommitmentTransaction res = self; memset(&self, 0, sizeof(LDKHolderCommitmentTransaction)); return res; } + operator LDKHolderCommitmentTransaction() && { LDKHolderCommitmentTransaction res = self; memset(&self, 0, sizeof(LDKHolderCommitmentTransaction)); return res; } + ~HolderCommitmentTransaction() { HolderCommitmentTransaction_free(self); } + HolderCommitmentTransaction& operator=(HolderCommitmentTransaction&& o) { HolderCommitmentTransaction_free(self); self = o.self; memset(&o, 0, sizeof(HolderCommitmentTransaction)); return *this; } LDKHolderCommitmentTransaction* operator &() { return &self; } LDKHolderCommitmentTransaction* operator ->() { return &self; } const LDKHolderCommitmentTransaction* operator &() const { return &self; } @@ -1219,10 +1306,11 @@ class BuiltCommitmentTransaction { LDKBuiltCommitmentTransaction self; public: BuiltCommitmentTransaction(const BuiltCommitmentTransaction&) = delete; - ~BuiltCommitmentTransaction() { BuiltCommitmentTransaction_free(self); } BuiltCommitmentTransaction(BuiltCommitmentTransaction&& o) : self(o.self) { memset(&o, 0, sizeof(BuiltCommitmentTransaction)); } BuiltCommitmentTransaction(LDKBuiltCommitmentTransaction&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBuiltCommitmentTransaction)); } - operator LDKBuiltCommitmentTransaction() { LDKBuiltCommitmentTransaction res = self; memset(&self, 0, sizeof(LDKBuiltCommitmentTransaction)); return res; } + operator LDKBuiltCommitmentTransaction() && { LDKBuiltCommitmentTransaction res = self; memset(&self, 0, sizeof(LDKBuiltCommitmentTransaction)); return res; } + ~BuiltCommitmentTransaction() { BuiltCommitmentTransaction_free(self); } + BuiltCommitmentTransaction& operator=(BuiltCommitmentTransaction&& o) { BuiltCommitmentTransaction_free(self); self = o.self; memset(&o, 0, sizeof(BuiltCommitmentTransaction)); return *this; } LDKBuiltCommitmentTransaction* operator &() { return &self; } LDKBuiltCommitmentTransaction* operator ->() { return &self; } const LDKBuiltCommitmentTransaction* operator &() const { return &self; } @@ -1233,10 +1321,11 @@ class CommitmentTransaction { LDKCommitmentTransaction self; public: CommitmentTransaction(const CommitmentTransaction&) = delete; - ~CommitmentTransaction() { CommitmentTransaction_free(self); } CommitmentTransaction(CommitmentTransaction&& o) : self(o.self) { memset(&o, 0, sizeof(CommitmentTransaction)); } CommitmentTransaction(LDKCommitmentTransaction&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCommitmentTransaction)); } - operator LDKCommitmentTransaction() { LDKCommitmentTransaction res = self; memset(&self, 0, sizeof(LDKCommitmentTransaction)); return res; } + operator LDKCommitmentTransaction() && { LDKCommitmentTransaction res = self; memset(&self, 0, sizeof(LDKCommitmentTransaction)); return res; } + ~CommitmentTransaction() { CommitmentTransaction_free(self); } + CommitmentTransaction& operator=(CommitmentTransaction&& o) { CommitmentTransaction_free(self); self = o.self; memset(&o, 0, sizeof(CommitmentTransaction)); return *this; } LDKCommitmentTransaction* operator &() { return &self; } LDKCommitmentTransaction* operator ->() { return &self; } const LDKCommitmentTransaction* operator &() const { return &self; } @@ -1247,10 +1336,11 @@ class TrustedCommitmentTransaction { LDKTrustedCommitmentTransaction self; public: TrustedCommitmentTransaction(const TrustedCommitmentTransaction&) = delete; - ~TrustedCommitmentTransaction() { TrustedCommitmentTransaction_free(self); } TrustedCommitmentTransaction(TrustedCommitmentTransaction&& o) : self(o.self) { memset(&o, 0, sizeof(TrustedCommitmentTransaction)); } TrustedCommitmentTransaction(LDKTrustedCommitmentTransaction&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKTrustedCommitmentTransaction)); } - operator LDKTrustedCommitmentTransaction() { LDKTrustedCommitmentTransaction res = self; memset(&self, 0, sizeof(LDKTrustedCommitmentTransaction)); return res; } + operator LDKTrustedCommitmentTransaction() && { LDKTrustedCommitmentTransaction res = self; memset(&self, 0, sizeof(LDKTrustedCommitmentTransaction)); return res; } + ~TrustedCommitmentTransaction() { TrustedCommitmentTransaction_free(self); } + TrustedCommitmentTransaction& operator=(TrustedCommitmentTransaction&& o) { TrustedCommitmentTransaction_free(self); self = o.self; memset(&o, 0, sizeof(TrustedCommitmentTransaction)); return *this; } LDKTrustedCommitmentTransaction* operator &() { return &self; } LDKTrustedCommitmentTransaction* operator ->() { return &self; } const LDKTrustedCommitmentTransaction* operator &() const { return &self; } @@ -1261,10 +1351,11 @@ class InitFeatures { LDKInitFeatures self; public: InitFeatures(const InitFeatures&) = delete; - ~InitFeatures() { InitFeatures_free(self); } InitFeatures(InitFeatures&& o) : self(o.self) { memset(&o, 0, sizeof(InitFeatures)); } InitFeatures(LDKInitFeatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInitFeatures)); } - operator LDKInitFeatures() { LDKInitFeatures res = self; memset(&self, 0, sizeof(LDKInitFeatures)); return res; } + operator LDKInitFeatures() && { LDKInitFeatures res = self; memset(&self, 0, sizeof(LDKInitFeatures)); return res; } + ~InitFeatures() { InitFeatures_free(self); } + InitFeatures& operator=(InitFeatures&& o) { InitFeatures_free(self); self = o.self; memset(&o, 0, sizeof(InitFeatures)); return *this; } LDKInitFeatures* operator &() { return &self; } LDKInitFeatures* operator ->() { return &self; } const LDKInitFeatures* operator &() const { return &self; } @@ -1275,10 +1366,11 @@ class NodeFeatures { LDKNodeFeatures self; public: NodeFeatures(const NodeFeatures&) = delete; - ~NodeFeatures() { NodeFeatures_free(self); } NodeFeatures(NodeFeatures&& o) : self(o.self) { memset(&o, 0, sizeof(NodeFeatures)); } NodeFeatures(LDKNodeFeatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNodeFeatures)); } - operator LDKNodeFeatures() { LDKNodeFeatures res = self; memset(&self, 0, sizeof(LDKNodeFeatures)); return res; } + operator LDKNodeFeatures() && { LDKNodeFeatures res = self; memset(&self, 0, sizeof(LDKNodeFeatures)); return res; } + ~NodeFeatures() { NodeFeatures_free(self); } + NodeFeatures& operator=(NodeFeatures&& o) { NodeFeatures_free(self); self = o.self; memset(&o, 0, sizeof(NodeFeatures)); return *this; } LDKNodeFeatures* operator &() { return &self; } LDKNodeFeatures* operator ->() { return &self; } const LDKNodeFeatures* operator &() const { return &self; } @@ -1289,10 +1381,11 @@ class ChannelFeatures { LDKChannelFeatures self; public: ChannelFeatures(const ChannelFeatures&) = delete; - ~ChannelFeatures() { ChannelFeatures_free(self); } ChannelFeatures(ChannelFeatures&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelFeatures)); } ChannelFeatures(LDKChannelFeatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelFeatures)); } - operator LDKChannelFeatures() { LDKChannelFeatures res = self; memset(&self, 0, sizeof(LDKChannelFeatures)); return res; } + operator LDKChannelFeatures() && { LDKChannelFeatures res = self; memset(&self, 0, sizeof(LDKChannelFeatures)); return res; } + ~ChannelFeatures() { ChannelFeatures_free(self); } + ChannelFeatures& operator=(ChannelFeatures&& o) { ChannelFeatures_free(self); self = o.self; memset(&o, 0, sizeof(ChannelFeatures)); return *this; } LDKChannelFeatures* operator &() { return &self; } LDKChannelFeatures* operator ->() { return &self; } const LDKChannelFeatures* operator &() const { return &self; } @@ -1303,10 +1396,11 @@ class RouteHop { LDKRouteHop self; public: RouteHop(const RouteHop&) = delete; - ~RouteHop() { RouteHop_free(self); } RouteHop(RouteHop&& o) : self(o.self) { memset(&o, 0, sizeof(RouteHop)); } RouteHop(LDKRouteHop&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRouteHop)); } - operator LDKRouteHop() { LDKRouteHop res = self; memset(&self, 0, sizeof(LDKRouteHop)); return res; } + operator LDKRouteHop() && { LDKRouteHop res = self; memset(&self, 0, sizeof(LDKRouteHop)); return res; } + ~RouteHop() { RouteHop_free(self); } + RouteHop& operator=(RouteHop&& o) { RouteHop_free(self); self = o.self; memset(&o, 0, sizeof(RouteHop)); return *this; } LDKRouteHop* operator &() { return &self; } LDKRouteHop* operator ->() { return &self; } const LDKRouteHop* operator &() const { return &self; } @@ -1317,10 +1411,11 @@ class Route { LDKRoute self; public: Route(const Route&) = delete; - ~Route() { Route_free(self); } Route(Route&& o) : self(o.self) { memset(&o, 0, sizeof(Route)); } Route(LDKRoute&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRoute)); } - operator LDKRoute() { LDKRoute res = self; memset(&self, 0, sizeof(LDKRoute)); return res; } + operator LDKRoute() && { LDKRoute res = self; memset(&self, 0, sizeof(LDKRoute)); return res; } + ~Route() { Route_free(self); } + Route& operator=(Route&& o) { Route_free(self); self = o.self; memset(&o, 0, sizeof(Route)); return *this; } LDKRoute* operator &() { return &self; } LDKRoute* operator ->() { return &self; } const LDKRoute* operator &() const { return &self; } @@ -1331,10 +1426,11 @@ class RouteHint { LDKRouteHint self; public: RouteHint(const RouteHint&) = delete; - ~RouteHint() { RouteHint_free(self); } RouteHint(RouteHint&& o) : self(o.self) { memset(&o, 0, sizeof(RouteHint)); } RouteHint(LDKRouteHint&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRouteHint)); } - operator LDKRouteHint() { LDKRouteHint res = self; memset(&self, 0, sizeof(LDKRouteHint)); return res; } + operator LDKRouteHint() && { LDKRouteHint res = self; memset(&self, 0, sizeof(LDKRouteHint)); return res; } + ~RouteHint() { RouteHint_free(self); } + RouteHint& operator=(RouteHint&& o) { RouteHint_free(self); self = o.self; memset(&o, 0, sizeof(RouteHint)); return *this; } LDKRouteHint* operator &() { return &self; } LDKRouteHint* operator ->() { return &self; } const LDKRouteHint* operator &() const { return &self; } @@ -1345,10 +1441,11 @@ class NetworkGraph { LDKNetworkGraph self; public: NetworkGraph(const NetworkGraph&) = delete; - ~NetworkGraph() { NetworkGraph_free(self); } NetworkGraph(NetworkGraph&& o) : self(o.self) { memset(&o, 0, sizeof(NetworkGraph)); } NetworkGraph(LDKNetworkGraph&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNetworkGraph)); } - operator LDKNetworkGraph() { LDKNetworkGraph res = self; memset(&self, 0, sizeof(LDKNetworkGraph)); return res; } + operator LDKNetworkGraph() && { LDKNetworkGraph res = self; memset(&self, 0, sizeof(LDKNetworkGraph)); return res; } + ~NetworkGraph() { NetworkGraph_free(self); } + NetworkGraph& operator=(NetworkGraph&& o) { NetworkGraph_free(self); self = o.self; memset(&o, 0, sizeof(NetworkGraph)); return *this; } LDKNetworkGraph* operator &() { return &self; } LDKNetworkGraph* operator ->() { return &self; } const LDKNetworkGraph* operator &() const { return &self; } @@ -1359,10 +1456,11 @@ class LockedNetworkGraph { LDKLockedNetworkGraph self; public: LockedNetworkGraph(const LockedNetworkGraph&) = delete; - ~LockedNetworkGraph() { LockedNetworkGraph_free(self); } LockedNetworkGraph(LockedNetworkGraph&& o) : self(o.self) { memset(&o, 0, sizeof(LockedNetworkGraph)); } LockedNetworkGraph(LDKLockedNetworkGraph&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLockedNetworkGraph)); } - operator LDKLockedNetworkGraph() { LDKLockedNetworkGraph res = self; memset(&self, 0, sizeof(LDKLockedNetworkGraph)); return res; } + operator LDKLockedNetworkGraph() && { LDKLockedNetworkGraph res = self; memset(&self, 0, sizeof(LDKLockedNetworkGraph)); return res; } + ~LockedNetworkGraph() { LockedNetworkGraph_free(self); } + LockedNetworkGraph& operator=(LockedNetworkGraph&& o) { LockedNetworkGraph_free(self); self = o.self; memset(&o, 0, sizeof(LockedNetworkGraph)); return *this; } LDKLockedNetworkGraph* operator &() { return &self; } LDKLockedNetworkGraph* operator ->() { return &self; } const LDKLockedNetworkGraph* operator &() const { return &self; } @@ -1373,10 +1471,11 @@ class NetGraphMsgHandler { LDKNetGraphMsgHandler self; public: NetGraphMsgHandler(const NetGraphMsgHandler&) = delete; - ~NetGraphMsgHandler() { NetGraphMsgHandler_free(self); } NetGraphMsgHandler(NetGraphMsgHandler&& o) : self(o.self) { memset(&o, 0, sizeof(NetGraphMsgHandler)); } NetGraphMsgHandler(LDKNetGraphMsgHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNetGraphMsgHandler)); } - operator LDKNetGraphMsgHandler() { LDKNetGraphMsgHandler res = self; memset(&self, 0, sizeof(LDKNetGraphMsgHandler)); return res; } + operator LDKNetGraphMsgHandler() && { LDKNetGraphMsgHandler res = self; memset(&self, 0, sizeof(LDKNetGraphMsgHandler)); return res; } + ~NetGraphMsgHandler() { NetGraphMsgHandler_free(self); } + NetGraphMsgHandler& operator=(NetGraphMsgHandler&& o) { NetGraphMsgHandler_free(self); self = o.self; memset(&o, 0, sizeof(NetGraphMsgHandler)); return *this; } LDKNetGraphMsgHandler* operator &() { return &self; } LDKNetGraphMsgHandler* operator ->() { return &self; } const LDKNetGraphMsgHandler* operator &() const { return &self; } @@ -1387,10 +1486,11 @@ class DirectionalChannelInfo { LDKDirectionalChannelInfo self; public: DirectionalChannelInfo(const DirectionalChannelInfo&) = delete; - ~DirectionalChannelInfo() { DirectionalChannelInfo_free(self); } DirectionalChannelInfo(DirectionalChannelInfo&& o) : self(o.self) { memset(&o, 0, sizeof(DirectionalChannelInfo)); } DirectionalChannelInfo(LDKDirectionalChannelInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDirectionalChannelInfo)); } - operator LDKDirectionalChannelInfo() { LDKDirectionalChannelInfo res = self; memset(&self, 0, sizeof(LDKDirectionalChannelInfo)); return res; } + operator LDKDirectionalChannelInfo() && { LDKDirectionalChannelInfo res = self; memset(&self, 0, sizeof(LDKDirectionalChannelInfo)); return res; } + ~DirectionalChannelInfo() { DirectionalChannelInfo_free(self); } + DirectionalChannelInfo& operator=(DirectionalChannelInfo&& o) { DirectionalChannelInfo_free(self); self = o.self; memset(&o, 0, sizeof(DirectionalChannelInfo)); return *this; } LDKDirectionalChannelInfo* operator &() { return &self; } LDKDirectionalChannelInfo* operator ->() { return &self; } const LDKDirectionalChannelInfo* operator &() const { return &self; } @@ -1401,10 +1501,11 @@ class ChannelInfo { LDKChannelInfo self; public: ChannelInfo(const ChannelInfo&) = delete; - ~ChannelInfo() { ChannelInfo_free(self); } ChannelInfo(ChannelInfo&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelInfo)); } ChannelInfo(LDKChannelInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelInfo)); } - operator LDKChannelInfo() { LDKChannelInfo res = self; memset(&self, 0, sizeof(LDKChannelInfo)); return res; } + operator LDKChannelInfo() && { LDKChannelInfo res = self; memset(&self, 0, sizeof(LDKChannelInfo)); return res; } + ~ChannelInfo() { ChannelInfo_free(self); } + ChannelInfo& operator=(ChannelInfo&& o) { ChannelInfo_free(self); self = o.self; memset(&o, 0, sizeof(ChannelInfo)); return *this; } LDKChannelInfo* operator &() { return &self; } LDKChannelInfo* operator ->() { return &self; } const LDKChannelInfo* operator &() const { return &self; } @@ -1415,10 +1516,11 @@ class RoutingFees { LDKRoutingFees self; public: RoutingFees(const RoutingFees&) = delete; - ~RoutingFees() { RoutingFees_free(self); } RoutingFees(RoutingFees&& o) : self(o.self) { memset(&o, 0, sizeof(RoutingFees)); } RoutingFees(LDKRoutingFees&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRoutingFees)); } - operator LDKRoutingFees() { LDKRoutingFees res = self; memset(&self, 0, sizeof(LDKRoutingFees)); return res; } + operator LDKRoutingFees() && { LDKRoutingFees res = self; memset(&self, 0, sizeof(LDKRoutingFees)); return res; } + ~RoutingFees() { RoutingFees_free(self); } + RoutingFees& operator=(RoutingFees&& o) { RoutingFees_free(self); self = o.self; memset(&o, 0, sizeof(RoutingFees)); return *this; } LDKRoutingFees* operator &() { return &self; } LDKRoutingFees* operator ->() { return &self; } const LDKRoutingFees* operator &() const { return &self; } @@ -1429,10 +1531,11 @@ class NodeAnnouncementInfo { LDKNodeAnnouncementInfo self; public: NodeAnnouncementInfo(const NodeAnnouncementInfo&) = delete; - ~NodeAnnouncementInfo() { NodeAnnouncementInfo_free(self); } NodeAnnouncementInfo(NodeAnnouncementInfo&& o) : self(o.self) { memset(&o, 0, sizeof(NodeAnnouncementInfo)); } NodeAnnouncementInfo(LDKNodeAnnouncementInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNodeAnnouncementInfo)); } - operator LDKNodeAnnouncementInfo() { LDKNodeAnnouncementInfo res = self; memset(&self, 0, sizeof(LDKNodeAnnouncementInfo)); return res; } + operator LDKNodeAnnouncementInfo() && { LDKNodeAnnouncementInfo res = self; memset(&self, 0, sizeof(LDKNodeAnnouncementInfo)); return res; } + ~NodeAnnouncementInfo() { NodeAnnouncementInfo_free(self); } + NodeAnnouncementInfo& operator=(NodeAnnouncementInfo&& o) { NodeAnnouncementInfo_free(self); self = o.self; memset(&o, 0, sizeof(NodeAnnouncementInfo)); return *this; } LDKNodeAnnouncementInfo* operator &() { return &self; } LDKNodeAnnouncementInfo* operator ->() { return &self; } const LDKNodeAnnouncementInfo* operator &() const { return &self; } @@ -1443,10 +1546,11 @@ class NodeInfo { LDKNodeInfo self; public: NodeInfo(const NodeInfo&) = delete; - ~NodeInfo() { NodeInfo_free(self); } NodeInfo(NodeInfo&& o) : self(o.self) { memset(&o, 0, sizeof(NodeInfo)); } NodeInfo(LDKNodeInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNodeInfo)); } - operator LDKNodeInfo() { LDKNodeInfo res = self; memset(&self, 0, sizeof(LDKNodeInfo)); return res; } + operator LDKNodeInfo() && { LDKNodeInfo res = self; memset(&self, 0, sizeof(LDKNodeInfo)); return res; } + ~NodeInfo() { NodeInfo_free(self); } + NodeInfo& operator=(NodeInfo&& o) { NodeInfo_free(self); self = o.self; memset(&o, 0, sizeof(NodeInfo)); return *this; } LDKNodeInfo* operator &() { return &self; } LDKNodeInfo* operator ->() { return &self; } const LDKNodeInfo* operator &() const { return &self; } @@ -1457,10 +1561,11 @@ class CVec_SpendableOutputDescriptorZ { LDKCVec_SpendableOutputDescriptorZ self; public: CVec_SpendableOutputDescriptorZ(const CVec_SpendableOutputDescriptorZ&) = delete; - ~CVec_SpendableOutputDescriptorZ() { CVec_SpendableOutputDescriptorZ_free(self); } CVec_SpendableOutputDescriptorZ(CVec_SpendableOutputDescriptorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_SpendableOutputDescriptorZ)); } CVec_SpendableOutputDescriptorZ(LDKCVec_SpendableOutputDescriptorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); } - operator LDKCVec_SpendableOutputDescriptorZ() { LDKCVec_SpendableOutputDescriptorZ res = self; memset(&self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); return res; } + operator LDKCVec_SpendableOutputDescriptorZ() && { LDKCVec_SpendableOutputDescriptorZ res = self; memset(&self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); return res; } + ~CVec_SpendableOutputDescriptorZ() { CVec_SpendableOutputDescriptorZ_free(self); } + CVec_SpendableOutputDescriptorZ& operator=(CVec_SpendableOutputDescriptorZ&& o) { CVec_SpendableOutputDescriptorZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_SpendableOutputDescriptorZ)); return *this; } LDKCVec_SpendableOutputDescriptorZ* operator &() { return &self; } LDKCVec_SpendableOutputDescriptorZ* operator ->() { return &self; } const LDKCVec_SpendableOutputDescriptorZ* operator &() const { return &self; } @@ -1471,80 +1576,71 @@ class CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ self; public: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(const CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&) = delete; - ~CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); } CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); } CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); } - operator LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() { LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return res; } + operator LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() && { LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return res; } + ~CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); } + CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ& operator=(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return *this; } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() { return &self; } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() { return &self; } const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() const { return &self; } const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() const { return &self; } }; -class C2Tuple_u32TxOutZ { +class CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { private: - LDKC2Tuple_u32TxOutZ self; + LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ self; public: - C2Tuple_u32TxOutZ(const C2Tuple_u32TxOutZ&) = delete; - ~C2Tuple_u32TxOutZ() { C2Tuple_u32TxOutZ_free(self); } - C2Tuple_u32TxOutZ(C2Tuple_u32TxOutZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u32TxOutZ)); } - C2Tuple_u32TxOutZ(LDKC2Tuple_u32TxOutZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u32TxOutZ)); } - operator LDKC2Tuple_u32TxOutZ() { LDKC2Tuple_u32TxOutZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_u32TxOutZ)); return res; } - LDKC2Tuple_u32TxOutZ* operator &() { return &self; } - LDKC2Tuple_u32TxOutZ* operator ->() { return &self; } - const LDKC2Tuple_u32TxOutZ* operator &() const { return &self; } - const LDKC2Tuple_u32TxOutZ* operator ->() const { return &self; } + CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&) = delete; + CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); } + CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); } + operator LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); return res; } + ~CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(self); } + CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); return *this; } + LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator &() { return &self; } + LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator ->() const { return &self; } }; class CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { private: LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ self; public: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(const CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&) = delete; - ~CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() { CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(self); } CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); } CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); } - operator LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() { LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = self; memset(&self, 0, sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); return res; } + operator LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() && { LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = self; memset(&self, 0, sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); return res; } + ~CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() { CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(self); } + CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ& operator=(CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& o) { CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); return *this; } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() { return &self; } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() { return &self; } const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() const { return &self; } const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() const { return &self; } }; -class CVec_PublicKeyZ { -private: - LDKCVec_PublicKeyZ self; -public: - CVec_PublicKeyZ(const CVec_PublicKeyZ&) = delete; - ~CVec_PublicKeyZ() { CVec_PublicKeyZ_free(self); } - CVec_PublicKeyZ(CVec_PublicKeyZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PublicKeyZ)); } - CVec_PublicKeyZ(LDKCVec_PublicKeyZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PublicKeyZ)); } - operator LDKCVec_PublicKeyZ() { LDKCVec_PublicKeyZ res = self; memset(&self, 0, sizeof(LDKCVec_PublicKeyZ)); return res; } - LDKCVec_PublicKeyZ* operator &() { return &self; } - LDKCVec_PublicKeyZ* operator ->() { return &self; } - const LDKCVec_PublicKeyZ* operator &() const { return &self; } - const LDKCVec_PublicKeyZ* operator ->() const { return &self; } -}; -class CResult_boolLightningErrorZ { +class C2Tuple_BlockHashChannelManagerZ { private: - LDKCResult_boolLightningErrorZ self; + LDKC2Tuple_BlockHashChannelManagerZ self; public: - CResult_boolLightningErrorZ(const CResult_boolLightningErrorZ&) = delete; - ~CResult_boolLightningErrorZ() { CResult_boolLightningErrorZ_free(self); } - CResult_boolLightningErrorZ(CResult_boolLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolLightningErrorZ)); } - CResult_boolLightningErrorZ(LDKCResult_boolLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolLightningErrorZ)); } - operator LDKCResult_boolLightningErrorZ() { LDKCResult_boolLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolLightningErrorZ)); return res; } - LDKCResult_boolLightningErrorZ* operator &() { return &self; } - LDKCResult_boolLightningErrorZ* operator ->() { return &self; } - const LDKCResult_boolLightningErrorZ* operator &() const { return &self; } - const LDKCResult_boolLightningErrorZ* operator ->() const { return &self; } + C2Tuple_BlockHashChannelManagerZ(const C2Tuple_BlockHashChannelManagerZ&) = delete; + C2Tuple_BlockHashChannelManagerZ(C2Tuple_BlockHashChannelManagerZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_BlockHashChannelManagerZ)); } + C2Tuple_BlockHashChannelManagerZ(LDKC2Tuple_BlockHashChannelManagerZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_BlockHashChannelManagerZ)); } + operator LDKC2Tuple_BlockHashChannelManagerZ() && { LDKC2Tuple_BlockHashChannelManagerZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_BlockHashChannelManagerZ)); return res; } + ~C2Tuple_BlockHashChannelManagerZ() { C2Tuple_BlockHashChannelManagerZ_free(self); } + C2Tuple_BlockHashChannelManagerZ& operator=(C2Tuple_BlockHashChannelManagerZ&& o) { C2Tuple_BlockHashChannelManagerZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_BlockHashChannelManagerZ)); return *this; } + LDKC2Tuple_BlockHashChannelManagerZ* operator &() { return &self; } + LDKC2Tuple_BlockHashChannelManagerZ* operator ->() { return &self; } + const LDKC2Tuple_BlockHashChannelManagerZ* operator &() const { return &self; } + const LDKC2Tuple_BlockHashChannelManagerZ* operator ->() const { return &self; } }; class CVec_C2Tuple_u32TxOutZZ { private: LDKCVec_C2Tuple_u32TxOutZZ self; public: CVec_C2Tuple_u32TxOutZZ(const CVec_C2Tuple_u32TxOutZZ&) = delete; - ~CVec_C2Tuple_u32TxOutZZ() { CVec_C2Tuple_u32TxOutZZ_free(self); } CVec_C2Tuple_u32TxOutZZ(CVec_C2Tuple_u32TxOutZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_u32TxOutZZ)); } CVec_C2Tuple_u32TxOutZZ(LDKCVec_C2Tuple_u32TxOutZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_u32TxOutZZ)); } - operator LDKCVec_C2Tuple_u32TxOutZZ() { LDKCVec_C2Tuple_u32TxOutZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_u32TxOutZZ)); return res; } + operator LDKCVec_C2Tuple_u32TxOutZZ() && { LDKCVec_C2Tuple_u32TxOutZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_u32TxOutZZ)); return res; } + ~CVec_C2Tuple_u32TxOutZZ() { CVec_C2Tuple_u32TxOutZZ_free(self); } + CVec_C2Tuple_u32TxOutZZ& operator=(CVec_C2Tuple_u32TxOutZZ&& o) { CVec_C2Tuple_u32TxOutZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_u32TxOutZZ)); return *this; } LDKCVec_C2Tuple_u32TxOutZZ* operator &() { return &self; } LDKCVec_C2Tuple_u32TxOutZZ* operator ->() { return &self; } const LDKCVec_C2Tuple_u32TxOutZZ* operator &() const { return &self; } @@ -1555,10 +1651,11 @@ class CVec_SignatureZ { LDKCVec_SignatureZ self; public: CVec_SignatureZ(const CVec_SignatureZ&) = delete; - ~CVec_SignatureZ() { CVec_SignatureZ_free(self); } CVec_SignatureZ(CVec_SignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_SignatureZ)); } CVec_SignatureZ(LDKCVec_SignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_SignatureZ)); } - operator LDKCVec_SignatureZ() { LDKCVec_SignatureZ res = self; memset(&self, 0, sizeof(LDKCVec_SignatureZ)); return res; } + operator LDKCVec_SignatureZ() && { LDKCVec_SignatureZ res = self; memset(&self, 0, sizeof(LDKCVec_SignatureZ)); return res; } + ~CVec_SignatureZ() { CVec_SignatureZ_free(self); } + CVec_SignatureZ& operator=(CVec_SignatureZ&& o) { CVec_SignatureZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_SignatureZ)); return *this; } LDKCVec_SignatureZ* operator &() { return &self; } LDKCVec_SignatureZ* operator ->() { return &self; } const LDKCVec_SignatureZ* operator &() const { return &self; } @@ -1569,10 +1666,11 @@ class C2Tuple_SignatureCVec_SignatureZZ { LDKC2Tuple_SignatureCVec_SignatureZZ self; public: C2Tuple_SignatureCVec_SignatureZZ(const C2Tuple_SignatureCVec_SignatureZZ&) = delete; - ~C2Tuple_SignatureCVec_SignatureZZ() { C2Tuple_SignatureCVec_SignatureZZ_free(self); } C2Tuple_SignatureCVec_SignatureZZ(C2Tuple_SignatureCVec_SignatureZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_SignatureCVec_SignatureZZ)); } C2Tuple_SignatureCVec_SignatureZZ(LDKC2Tuple_SignatureCVec_SignatureZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ)); } - operator LDKC2Tuple_SignatureCVec_SignatureZZ() { LDKC2Tuple_SignatureCVec_SignatureZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ)); return res; } + operator LDKC2Tuple_SignatureCVec_SignatureZZ() && { LDKC2Tuple_SignatureCVec_SignatureZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ)); return res; } + ~C2Tuple_SignatureCVec_SignatureZZ() { C2Tuple_SignatureCVec_SignatureZZ_free(self); } + C2Tuple_SignatureCVec_SignatureZZ& operator=(C2Tuple_SignatureCVec_SignatureZZ&& o) { C2Tuple_SignatureCVec_SignatureZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_SignatureCVec_SignatureZZ)); return *this; } LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() { return &self; } LDKC2Tuple_SignatureCVec_SignatureZZ* operator ->() { return &self; } const LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() const { return &self; } @@ -1583,80 +1681,611 @@ class CVec_u64Z { LDKCVec_u64Z self; public: CVec_u64Z(const CVec_u64Z&) = delete; - ~CVec_u64Z() { CVec_u64Z_free(self); } CVec_u64Z(CVec_u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u64Z)); } CVec_u64Z(LDKCVec_u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u64Z)); } - operator LDKCVec_u64Z() { LDKCVec_u64Z res = self; memset(&self, 0, sizeof(LDKCVec_u64Z)); return res; } + operator LDKCVec_u64Z() && { LDKCVec_u64Z res = self; memset(&self, 0, sizeof(LDKCVec_u64Z)); return res; } + ~CVec_u64Z() { CVec_u64Z_free(self); } + CVec_u64Z& operator=(CVec_u64Z&& o) { CVec_u64Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_u64Z)); return *this; } LDKCVec_u64Z* operator &() { return &self; } LDKCVec_u64Z* operator ->() { return &self; } const LDKCVec_u64Z* operator &() const { return &self; } const LDKCVec_u64Z* operator ->() const { return &self; } }; -class CVec_UpdateFailMalformedHTLCZ { +class CResult_GossipTimestampFilterDecodeErrorZ { +private: + LDKCResult_GossipTimestampFilterDecodeErrorZ self; +public: + CResult_GossipTimestampFilterDecodeErrorZ(const CResult_GossipTimestampFilterDecodeErrorZ&) = delete; + CResult_GossipTimestampFilterDecodeErrorZ(CResult_GossipTimestampFilterDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); } + CResult_GossipTimestampFilterDecodeErrorZ(LDKCResult_GossipTimestampFilterDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); } + operator LDKCResult_GossipTimestampFilterDecodeErrorZ() && { LDKCResult_GossipTimestampFilterDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); return res; } + ~CResult_GossipTimestampFilterDecodeErrorZ() { CResult_GossipTimestampFilterDecodeErrorZ_free(self); } + CResult_GossipTimestampFilterDecodeErrorZ& operator=(CResult_GossipTimestampFilterDecodeErrorZ&& o) { CResult_GossipTimestampFilterDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); return *this; } + LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() { return &self; } + LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_ChannelMonitorUpdateDecodeErrorZ { +private: + LDKCResult_ChannelMonitorUpdateDecodeErrorZ self; +public: + CResult_ChannelMonitorUpdateDecodeErrorZ(const CResult_ChannelMonitorUpdateDecodeErrorZ&) = delete; + CResult_ChannelMonitorUpdateDecodeErrorZ(CResult_ChannelMonitorUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelMonitorUpdateDecodeErrorZ)); } + CResult_ChannelMonitorUpdateDecodeErrorZ(LDKCResult_ChannelMonitorUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ)); } + operator LDKCResult_ChannelMonitorUpdateDecodeErrorZ() && { LDKCResult_ChannelMonitorUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ)); return res; } + ~CResult_ChannelMonitorUpdateDecodeErrorZ() { CResult_ChannelMonitorUpdateDecodeErrorZ_free(self); } + CResult_ChannelMonitorUpdateDecodeErrorZ& operator=(CResult_ChannelMonitorUpdateDecodeErrorZ&& o) { CResult_ChannelMonitorUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelMonitorUpdateDecodeErrorZ)); return *this; } + LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_ReplyChannelRangeDecodeErrorZ { +private: + LDKCResult_ReplyChannelRangeDecodeErrorZ self; +public: + CResult_ReplyChannelRangeDecodeErrorZ(const CResult_ReplyChannelRangeDecodeErrorZ&) = delete; + CResult_ReplyChannelRangeDecodeErrorZ(CResult_ReplyChannelRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); } + CResult_ReplyChannelRangeDecodeErrorZ(LDKCResult_ReplyChannelRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); } + operator LDKCResult_ReplyChannelRangeDecodeErrorZ() && { LDKCResult_ReplyChannelRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); return res; } + ~CResult_ReplyChannelRangeDecodeErrorZ() { CResult_ReplyChannelRangeDecodeErrorZ_free(self); } + CResult_ReplyChannelRangeDecodeErrorZ& operator=(CResult_ReplyChannelRangeDecodeErrorZ&& o) { CResult_ReplyChannelRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); return *this; } + LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() { return &self; } + LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_CVec_u8ZPeerHandleErrorZ { private: - LDKCVec_UpdateFailMalformedHTLCZ self; + LDKCResult_CVec_u8ZPeerHandleErrorZ self; public: - CVec_UpdateFailMalformedHTLCZ(const CVec_UpdateFailMalformedHTLCZ&) = delete; - ~CVec_UpdateFailMalformedHTLCZ() { CVec_UpdateFailMalformedHTLCZ_free(self); } - CVec_UpdateFailMalformedHTLCZ(CVec_UpdateFailMalformedHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); } - CVec_UpdateFailMalformedHTLCZ(LDKCVec_UpdateFailMalformedHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); } - operator LDKCVec_UpdateFailMalformedHTLCZ() { LDKCVec_UpdateFailMalformedHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); return res; } - LDKCVec_UpdateFailMalformedHTLCZ* operator &() { return &self; } - LDKCVec_UpdateFailMalformedHTLCZ* operator ->() { return &self; } - const LDKCVec_UpdateFailMalformedHTLCZ* operator &() const { return &self; } - const LDKCVec_UpdateFailMalformedHTLCZ* operator ->() const { return &self; } + CResult_CVec_u8ZPeerHandleErrorZ(const CResult_CVec_u8ZPeerHandleErrorZ&) = delete; + CResult_CVec_u8ZPeerHandleErrorZ(CResult_CVec_u8ZPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_u8ZPeerHandleErrorZ)); } + CResult_CVec_u8ZPeerHandleErrorZ(LDKCResult_CVec_u8ZPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); } + operator LDKCResult_CVec_u8ZPeerHandleErrorZ() && { LDKCResult_CVec_u8ZPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); return res; } + ~CResult_CVec_u8ZPeerHandleErrorZ() { CResult_CVec_u8ZPeerHandleErrorZ_free(self); } + CResult_CVec_u8ZPeerHandleErrorZ& operator=(CResult_CVec_u8ZPeerHandleErrorZ&& o) { CResult_CVec_u8ZPeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_u8ZPeerHandleErrorZ)); return *this; } + LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() { return &self; } + LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() { return &self; } + const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() const { return &self; } + const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() const { return &self; } +}; +class CResult_TxOutAccessErrorZ { +private: + LDKCResult_TxOutAccessErrorZ self; +public: + CResult_TxOutAccessErrorZ(const CResult_TxOutAccessErrorZ&) = delete; + CResult_TxOutAccessErrorZ(CResult_TxOutAccessErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxOutAccessErrorZ)); } + CResult_TxOutAccessErrorZ(LDKCResult_TxOutAccessErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxOutAccessErrorZ)); } + operator LDKCResult_TxOutAccessErrorZ() && { LDKCResult_TxOutAccessErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxOutAccessErrorZ)); return res; } + ~CResult_TxOutAccessErrorZ() { CResult_TxOutAccessErrorZ_free(self); } + CResult_TxOutAccessErrorZ& operator=(CResult_TxOutAccessErrorZ&& o) { CResult_TxOutAccessErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxOutAccessErrorZ)); return *this; } + LDKCResult_TxOutAccessErrorZ* operator &() { return &self; } + LDKCResult_TxOutAccessErrorZ* operator ->() { return &self; } + const LDKCResult_TxOutAccessErrorZ* operator &() const { return &self; } + const LDKCResult_TxOutAccessErrorZ* operator ->() const { return &self; } +}; +class CResult_UnsignedNodeAnnouncementDecodeErrorZ { +private: + LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ self; +public: + CResult_UnsignedNodeAnnouncementDecodeErrorZ(const CResult_UnsignedNodeAnnouncementDecodeErrorZ&) = delete; + CResult_UnsignedNodeAnnouncementDecodeErrorZ(CResult_UnsignedNodeAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedNodeAnnouncementDecodeErrorZ)); } + CResult_UnsignedNodeAnnouncementDecodeErrorZ(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ)); } + operator LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ() && { LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ)); return res; } + ~CResult_UnsignedNodeAnnouncementDecodeErrorZ() { CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(self); } + CResult_UnsignedNodeAnnouncementDecodeErrorZ& operator=(CResult_UnsignedNodeAnnouncementDecodeErrorZ&& o) { CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedNodeAnnouncementDecodeErrorZ)); return *this; } + LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator &() { return &self; } + LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_TxCreationKeysSecpErrorZ { +private: + LDKCResult_TxCreationKeysSecpErrorZ self; +public: + CResult_TxCreationKeysSecpErrorZ(const CResult_TxCreationKeysSecpErrorZ&) = delete; + CResult_TxCreationKeysSecpErrorZ(CResult_TxCreationKeysSecpErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxCreationKeysSecpErrorZ)); } + CResult_TxCreationKeysSecpErrorZ(LDKCResult_TxCreationKeysSecpErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxCreationKeysSecpErrorZ)); } + operator LDKCResult_TxCreationKeysSecpErrorZ() && { LDKCResult_TxCreationKeysSecpErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxCreationKeysSecpErrorZ)); return res; } + ~CResult_TxCreationKeysSecpErrorZ() { CResult_TxCreationKeysSecpErrorZ_free(self); } + CResult_TxCreationKeysSecpErrorZ& operator=(CResult_TxCreationKeysSecpErrorZ&& o) { CResult_TxCreationKeysSecpErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxCreationKeysSecpErrorZ)); return *this; } + LDKCResult_TxCreationKeysSecpErrorZ* operator &() { return &self; } + LDKCResult_TxCreationKeysSecpErrorZ* operator ->() { return &self; } + const LDKCResult_TxCreationKeysSecpErrorZ* operator &() const { return &self; } + const LDKCResult_TxCreationKeysSecpErrorZ* operator ->() const { return &self; } +}; +class CVec_RouteHintZ { +private: + LDKCVec_RouteHintZ self; +public: + CVec_RouteHintZ(const CVec_RouteHintZ&) = delete; + CVec_RouteHintZ(CVec_RouteHintZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHintZ)); } + CVec_RouteHintZ(LDKCVec_RouteHintZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHintZ)); } + operator LDKCVec_RouteHintZ() && { LDKCVec_RouteHintZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHintZ)); return res; } + ~CVec_RouteHintZ() { CVec_RouteHintZ_free(self); } + CVec_RouteHintZ& operator=(CVec_RouteHintZ&& o) { CVec_RouteHintZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHintZ)); return *this; } + LDKCVec_RouteHintZ* operator &() { return &self; } + LDKCVec_RouteHintZ* operator ->() { return &self; } + const LDKCVec_RouteHintZ* operator &() const { return &self; } + const LDKCVec_RouteHintZ* operator ->() const { return &self; } +}; +class CResult_ChannelReestablishDecodeErrorZ { +private: + LDKCResult_ChannelReestablishDecodeErrorZ self; +public: + CResult_ChannelReestablishDecodeErrorZ(const CResult_ChannelReestablishDecodeErrorZ&) = delete; + CResult_ChannelReestablishDecodeErrorZ(CResult_ChannelReestablishDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelReestablishDecodeErrorZ)); } + CResult_ChannelReestablishDecodeErrorZ(LDKCResult_ChannelReestablishDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelReestablishDecodeErrorZ)); } + operator LDKCResult_ChannelReestablishDecodeErrorZ() && { LDKCResult_ChannelReestablishDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelReestablishDecodeErrorZ)); return res; } + ~CResult_ChannelReestablishDecodeErrorZ() { CResult_ChannelReestablishDecodeErrorZ_free(self); } + CResult_ChannelReestablishDecodeErrorZ& operator=(CResult_ChannelReestablishDecodeErrorZ&& o) { CResult_ChannelReestablishDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelReestablishDecodeErrorZ)); return *this; } + LDKCResult_ChannelReestablishDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelReestablishDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelReestablishDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelReestablishDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_CVec_RouteHopZZ { +private: + LDKCVec_CVec_RouteHopZZ self; +public: + CVec_CVec_RouteHopZZ(const CVec_CVec_RouteHopZZ&) = delete; + CVec_CVec_RouteHopZZ(CVec_CVec_RouteHopZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_CVec_RouteHopZZ)); } + CVec_CVec_RouteHopZZ(LDKCVec_CVec_RouteHopZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_CVec_RouteHopZZ)); } + operator LDKCVec_CVec_RouteHopZZ() && { LDKCVec_CVec_RouteHopZZ res = self; memset(&self, 0, sizeof(LDKCVec_CVec_RouteHopZZ)); return res; } + ~CVec_CVec_RouteHopZZ() { CVec_CVec_RouteHopZZ_free(self); } + CVec_CVec_RouteHopZZ& operator=(CVec_CVec_RouteHopZZ&& o) { CVec_CVec_RouteHopZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_CVec_RouteHopZZ)); return *this; } + LDKCVec_CVec_RouteHopZZ* operator &() { return &self; } + LDKCVec_CVec_RouteHopZZ* operator ->() { return &self; } + const LDKCVec_CVec_RouteHopZZ* operator &() const { return &self; } + const LDKCVec_CVec_RouteHopZZ* operator ->() const { return &self; } +}; +class CVec_UpdateAddHTLCZ { +private: + LDKCVec_UpdateAddHTLCZ self; +public: + CVec_UpdateAddHTLCZ(const CVec_UpdateAddHTLCZ&) = delete; + CVec_UpdateAddHTLCZ(CVec_UpdateAddHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateAddHTLCZ)); } + CVec_UpdateAddHTLCZ(LDKCVec_UpdateAddHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); } + operator LDKCVec_UpdateAddHTLCZ() && { LDKCVec_UpdateAddHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); return res; } + ~CVec_UpdateAddHTLCZ() { CVec_UpdateAddHTLCZ_free(self); } + CVec_UpdateAddHTLCZ& operator=(CVec_UpdateAddHTLCZ&& o) { CVec_UpdateAddHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateAddHTLCZ)); return *this; } + LDKCVec_UpdateAddHTLCZ* operator &() { return &self; } + LDKCVec_UpdateAddHTLCZ* operator ->() { return &self; } + const LDKCVec_UpdateAddHTLCZ* operator &() const { return &self; } + const LDKCVec_UpdateAddHTLCZ* operator ->() const { return &self; } +}; +class CResult_NoneLightningErrorZ { +private: + LDKCResult_NoneLightningErrorZ self; +public: + CResult_NoneLightningErrorZ(const CResult_NoneLightningErrorZ&) = delete; + CResult_NoneLightningErrorZ(CResult_NoneLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneLightningErrorZ)); } + CResult_NoneLightningErrorZ(LDKCResult_NoneLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneLightningErrorZ)); } + operator LDKCResult_NoneLightningErrorZ() && { LDKCResult_NoneLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneLightningErrorZ)); return res; } + ~CResult_NoneLightningErrorZ() { CResult_NoneLightningErrorZ_free(self); } + CResult_NoneLightningErrorZ& operator=(CResult_NoneLightningErrorZ&& o) { CResult_NoneLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneLightningErrorZ)); return *this; } + LDKCResult_NoneLightningErrorZ* operator &() { return &self; } + LDKCResult_NoneLightningErrorZ* operator ->() { return &self; } + const LDKCResult_NoneLightningErrorZ* operator &() const { return &self; } + const LDKCResult_NoneLightningErrorZ* operator ->() const { return &self; } +}; +class CResult_NonePeerHandleErrorZ { +private: + LDKCResult_NonePeerHandleErrorZ self; +public: + CResult_NonePeerHandleErrorZ(const CResult_NonePeerHandleErrorZ&) = delete; + CResult_NonePeerHandleErrorZ(CResult_NonePeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); } + CResult_NonePeerHandleErrorZ(LDKCResult_NonePeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); } + operator LDKCResult_NonePeerHandleErrorZ() && { LDKCResult_NonePeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); return res; } + ~CResult_NonePeerHandleErrorZ() { CResult_NonePeerHandleErrorZ_free(self); } + CResult_NonePeerHandleErrorZ& operator=(CResult_NonePeerHandleErrorZ&& o) { CResult_NonePeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); return *this; } + LDKCResult_NonePeerHandleErrorZ* operator &() { return &self; } + LDKCResult_NonePeerHandleErrorZ* operator ->() { return &self; } + const LDKCResult_NonePeerHandleErrorZ* operator &() const { return &self; } + const LDKCResult_NonePeerHandleErrorZ* operator ->() const { return &self; } +}; +class CResult_TrustedCommitmentTransactionNoneZ { +private: + LDKCResult_TrustedCommitmentTransactionNoneZ self; +public: + CResult_TrustedCommitmentTransactionNoneZ(const CResult_TrustedCommitmentTransactionNoneZ&) = delete; + CResult_TrustedCommitmentTransactionNoneZ(CResult_TrustedCommitmentTransactionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TrustedCommitmentTransactionNoneZ)); } + CResult_TrustedCommitmentTransactionNoneZ(LDKCResult_TrustedCommitmentTransactionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ)); } + operator LDKCResult_TrustedCommitmentTransactionNoneZ() && { LDKCResult_TrustedCommitmentTransactionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ)); return res; } + ~CResult_TrustedCommitmentTransactionNoneZ() { CResult_TrustedCommitmentTransactionNoneZ_free(self); } + CResult_TrustedCommitmentTransactionNoneZ& operator=(CResult_TrustedCommitmentTransactionNoneZ&& o) { CResult_TrustedCommitmentTransactionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TrustedCommitmentTransactionNoneZ)); return *this; } + LDKCResult_TrustedCommitmentTransactionNoneZ* operator &() { return &self; } + LDKCResult_TrustedCommitmentTransactionNoneZ* operator ->() { return &self; } + const LDKCResult_TrustedCommitmentTransactionNoneZ* operator &() const { return &self; } + const LDKCResult_TrustedCommitmentTransactionNoneZ* operator ->() const { return &self; } +}; +class CResult_CVec_SignatureZNoneZ { +private: + LDKCResult_CVec_SignatureZNoneZ self; +public: + CResult_CVec_SignatureZNoneZ(const CResult_CVec_SignatureZNoneZ&) = delete; + CResult_CVec_SignatureZNoneZ(CResult_CVec_SignatureZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_SignatureZNoneZ)); } + CResult_CVec_SignatureZNoneZ(LDKCResult_CVec_SignatureZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); } + operator LDKCResult_CVec_SignatureZNoneZ() && { LDKCResult_CVec_SignatureZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); return res; } + ~CResult_CVec_SignatureZNoneZ() { CResult_CVec_SignatureZNoneZ_free(self); } + CResult_CVec_SignatureZNoneZ& operator=(CResult_CVec_SignatureZNoneZ&& o) { CResult_CVec_SignatureZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_SignatureZNoneZ)); return *this; } + LDKCResult_CVec_SignatureZNoneZ* operator &() { return &self; } + LDKCResult_CVec_SignatureZNoneZ* operator ->() { return &self; } + const LDKCResult_CVec_SignatureZNoneZ* operator &() const { return &self; } + const LDKCResult_CVec_SignatureZNoneZ* operator ->() const { return &self; } +}; +class CResult_PingDecodeErrorZ { +private: + LDKCResult_PingDecodeErrorZ self; +public: + CResult_PingDecodeErrorZ(const CResult_PingDecodeErrorZ&) = delete; + CResult_PingDecodeErrorZ(CResult_PingDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PingDecodeErrorZ)); } + CResult_PingDecodeErrorZ(LDKCResult_PingDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PingDecodeErrorZ)); } + operator LDKCResult_PingDecodeErrorZ() && { LDKCResult_PingDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PingDecodeErrorZ)); return res; } + ~CResult_PingDecodeErrorZ() { CResult_PingDecodeErrorZ_free(self); } + CResult_PingDecodeErrorZ& operator=(CResult_PingDecodeErrorZ&& o) { CResult_PingDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PingDecodeErrorZ)); return *this; } + LDKCResult_PingDecodeErrorZ* operator &() { return &self; } + LDKCResult_PingDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PingDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PingDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_RoutingFeesDecodeErrorZ { +private: + LDKCResult_RoutingFeesDecodeErrorZ self; +public: + CResult_RoutingFeesDecodeErrorZ(const CResult_RoutingFeesDecodeErrorZ&) = delete; + CResult_RoutingFeesDecodeErrorZ(CResult_RoutingFeesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); } + CResult_RoutingFeesDecodeErrorZ(LDKCResult_RoutingFeesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); } + operator LDKCResult_RoutingFeesDecodeErrorZ() && { LDKCResult_RoutingFeesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); return res; } + ~CResult_RoutingFeesDecodeErrorZ() { CResult_RoutingFeesDecodeErrorZ_free(self); } + CResult_RoutingFeesDecodeErrorZ& operator=(CResult_RoutingFeesDecodeErrorZ&& o) { CResult_RoutingFeesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); return *this; } + LDKCResult_RoutingFeesDecodeErrorZ* operator &() { return &self; } + LDKCResult_RoutingFeesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RoutingFeesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RoutingFeesDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_ErrorMessageDecodeErrorZ { +private: + LDKCResult_ErrorMessageDecodeErrorZ self; +public: + CResult_ErrorMessageDecodeErrorZ(const CResult_ErrorMessageDecodeErrorZ&) = delete; + CResult_ErrorMessageDecodeErrorZ(CResult_ErrorMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ErrorMessageDecodeErrorZ)); } + CResult_ErrorMessageDecodeErrorZ(LDKCResult_ErrorMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ErrorMessageDecodeErrorZ)); } + operator LDKCResult_ErrorMessageDecodeErrorZ() && { LDKCResult_ErrorMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ErrorMessageDecodeErrorZ)); return res; } + ~CResult_ErrorMessageDecodeErrorZ() { CResult_ErrorMessageDecodeErrorZ_free(self); } + CResult_ErrorMessageDecodeErrorZ& operator=(CResult_ErrorMessageDecodeErrorZ&& o) { CResult_ErrorMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ErrorMessageDecodeErrorZ)); return *this; } + LDKCResult_ErrorMessageDecodeErrorZ* operator &() { return &self; } + LDKCResult_ErrorMessageDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ErrorMessageDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ErrorMessageDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_QueryShortChannelIdsDecodeErrorZ { +private: + LDKCResult_QueryShortChannelIdsDecodeErrorZ self; +public: + CResult_QueryShortChannelIdsDecodeErrorZ(const CResult_QueryShortChannelIdsDecodeErrorZ&) = delete; + CResult_QueryShortChannelIdsDecodeErrorZ(CResult_QueryShortChannelIdsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_QueryShortChannelIdsDecodeErrorZ)); } + CResult_QueryShortChannelIdsDecodeErrorZ(LDKCResult_QueryShortChannelIdsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ)); } + operator LDKCResult_QueryShortChannelIdsDecodeErrorZ() && { LDKCResult_QueryShortChannelIdsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ)); return res; } + ~CResult_QueryShortChannelIdsDecodeErrorZ() { CResult_QueryShortChannelIdsDecodeErrorZ_free(self); } + CResult_QueryShortChannelIdsDecodeErrorZ& operator=(CResult_QueryShortChannelIdsDecodeErrorZ&& o) { CResult_QueryShortChannelIdsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_QueryShortChannelIdsDecodeErrorZ)); return *this; } + LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator &() { return &self; } + LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_NoneAPIErrorZ { +private: + LDKCResult_NoneAPIErrorZ self; +public: + CResult_NoneAPIErrorZ(const CResult_NoneAPIErrorZ&) = delete; + CResult_NoneAPIErrorZ(CResult_NoneAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneAPIErrorZ)); } + CResult_NoneAPIErrorZ(LDKCResult_NoneAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); } + operator LDKCResult_NoneAPIErrorZ() && { LDKCResult_NoneAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); return res; } + ~CResult_NoneAPIErrorZ() { CResult_NoneAPIErrorZ_free(self); } + CResult_NoneAPIErrorZ& operator=(CResult_NoneAPIErrorZ&& o) { CResult_NoneAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneAPIErrorZ)); return *this; } + LDKCResult_NoneAPIErrorZ* operator &() { return &self; } + LDKCResult_NoneAPIErrorZ* operator ->() { return &self; } + const LDKCResult_NoneAPIErrorZ* operator &() const { return &self; } + const LDKCResult_NoneAPIErrorZ* operator ->() const { return &self; } +}; +class CResult_QueryChannelRangeDecodeErrorZ { +private: + LDKCResult_QueryChannelRangeDecodeErrorZ self; +public: + CResult_QueryChannelRangeDecodeErrorZ(const CResult_QueryChannelRangeDecodeErrorZ&) = delete; + CResult_QueryChannelRangeDecodeErrorZ(CResult_QueryChannelRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_QueryChannelRangeDecodeErrorZ)); } + CResult_QueryChannelRangeDecodeErrorZ(LDKCResult_QueryChannelRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ)); } + operator LDKCResult_QueryChannelRangeDecodeErrorZ() && { LDKCResult_QueryChannelRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ)); return res; } + ~CResult_QueryChannelRangeDecodeErrorZ() { CResult_QueryChannelRangeDecodeErrorZ_free(self); } + CResult_QueryChannelRangeDecodeErrorZ& operator=(CResult_QueryChannelRangeDecodeErrorZ&& o) { CResult_QueryChannelRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_QueryChannelRangeDecodeErrorZ)); return *this; } + LDKCResult_QueryChannelRangeDecodeErrorZ* operator &() { return &self; } + LDKCResult_QueryChannelRangeDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_QueryChannelRangeDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_QueryChannelRangeDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_NetAddressZ { +private: + LDKCVec_NetAddressZ self; +public: + CVec_NetAddressZ(const CVec_NetAddressZ&) = delete; + CVec_NetAddressZ(CVec_NetAddressZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_NetAddressZ)); } + CVec_NetAddressZ(LDKCVec_NetAddressZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_NetAddressZ)); } + operator LDKCVec_NetAddressZ() && { LDKCVec_NetAddressZ res = self; memset(&self, 0, sizeof(LDKCVec_NetAddressZ)); return res; } + ~CVec_NetAddressZ() { CVec_NetAddressZ_free(self); } + CVec_NetAddressZ& operator=(CVec_NetAddressZ&& o) { CVec_NetAddressZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_NetAddressZ)); return *this; } + LDKCVec_NetAddressZ* operator &() { return &self; } + LDKCVec_NetAddressZ* operator ->() { return &self; } + const LDKCVec_NetAddressZ* operator &() const { return &self; } + const LDKCVec_NetAddressZ* operator ->() const { return &self; } +}; +class C2Tuple_usizeTransactionZ { +private: + LDKC2Tuple_usizeTransactionZ self; +public: + C2Tuple_usizeTransactionZ(const C2Tuple_usizeTransactionZ&) = delete; + C2Tuple_usizeTransactionZ(C2Tuple_usizeTransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_usizeTransactionZ)); } + C2Tuple_usizeTransactionZ(LDKC2Tuple_usizeTransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); } + operator LDKC2Tuple_usizeTransactionZ() && { LDKC2Tuple_usizeTransactionZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); return res; } + ~C2Tuple_usizeTransactionZ() { C2Tuple_usizeTransactionZ_free(self); } + C2Tuple_usizeTransactionZ& operator=(C2Tuple_usizeTransactionZ&& o) { C2Tuple_usizeTransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_usizeTransactionZ)); return *this; } + LDKC2Tuple_usizeTransactionZ* operator &() { return &self; } + LDKC2Tuple_usizeTransactionZ* operator ->() { return &self; } + const LDKC2Tuple_usizeTransactionZ* operator &() const { return &self; } + const LDKC2Tuple_usizeTransactionZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_usizeTransactionZZ { +private: + LDKCVec_C2Tuple_usizeTransactionZZ self; +public: + CVec_C2Tuple_usizeTransactionZZ(const CVec_C2Tuple_usizeTransactionZZ&) = delete; + CVec_C2Tuple_usizeTransactionZZ(CVec_C2Tuple_usizeTransactionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_usizeTransactionZZ)); } + CVec_C2Tuple_usizeTransactionZZ(LDKCVec_C2Tuple_usizeTransactionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_usizeTransactionZZ)); } + operator LDKCVec_C2Tuple_usizeTransactionZZ() && { LDKCVec_C2Tuple_usizeTransactionZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_usizeTransactionZZ)); return res; } + ~CVec_C2Tuple_usizeTransactionZZ() { CVec_C2Tuple_usizeTransactionZZ_free(self); } + CVec_C2Tuple_usizeTransactionZZ& operator=(CVec_C2Tuple_usizeTransactionZZ&& o) { CVec_C2Tuple_usizeTransactionZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_usizeTransactionZZ)); return *this; } + LDKCVec_C2Tuple_usizeTransactionZZ* operator &() { return &self; } + LDKCVec_C2Tuple_usizeTransactionZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_usizeTransactionZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_usizeTransactionZZ* operator ->() const { return &self; } +}; +class CVec_TransactionZ { +private: + LDKCVec_TransactionZ self; +public: + CVec_TransactionZ(const CVec_TransactionZ&) = delete; + CVec_TransactionZ(CVec_TransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TransactionZ)); } + CVec_TransactionZ(LDKCVec_TransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TransactionZ)); } + operator LDKCVec_TransactionZ() && { LDKCVec_TransactionZ res = self; memset(&self, 0, sizeof(LDKCVec_TransactionZ)); return res; } + ~CVec_TransactionZ() { CVec_TransactionZ_free(self); } + CVec_TransactionZ& operator=(CVec_TransactionZ&& o) { CVec_TransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_TransactionZ)); return *this; } + LDKCVec_TransactionZ* operator &() { return &self; } + LDKCVec_TransactionZ* operator ->() { return &self; } + const LDKCVec_TransactionZ* operator &() const { return &self; } + const LDKCVec_TransactionZ* operator ->() const { return &self; } +}; +class CVec_ChannelMonitorZ { +private: + LDKCVec_ChannelMonitorZ self; +public: + CVec_ChannelMonitorZ(const CVec_ChannelMonitorZ&) = delete; + CVec_ChannelMonitorZ(CVec_ChannelMonitorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelMonitorZ)); } + CVec_ChannelMonitorZ(LDKCVec_ChannelMonitorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelMonitorZ)); } + operator LDKCVec_ChannelMonitorZ() && { LDKCVec_ChannelMonitorZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelMonitorZ)); return res; } + ~CVec_ChannelMonitorZ() { CVec_ChannelMonitorZ_free(self); } + CVec_ChannelMonitorZ& operator=(CVec_ChannelMonitorZ&& o) { CVec_ChannelMonitorZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ChannelMonitorZ)); return *this; } + LDKCVec_ChannelMonitorZ* operator &() { return &self; } + LDKCVec_ChannelMonitorZ* operator ->() { return &self; } + const LDKCVec_ChannelMonitorZ* operator &() const { return &self; } + const LDKCVec_ChannelMonitorZ* operator ->() const { return &self; } +}; +class CVec_PublicKeyZ { +private: + LDKCVec_PublicKeyZ self; +public: + CVec_PublicKeyZ(const CVec_PublicKeyZ&) = delete; + CVec_PublicKeyZ(CVec_PublicKeyZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PublicKeyZ)); } + CVec_PublicKeyZ(LDKCVec_PublicKeyZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PublicKeyZ)); } + operator LDKCVec_PublicKeyZ() && { LDKCVec_PublicKeyZ res = self; memset(&self, 0, sizeof(LDKCVec_PublicKeyZ)); return res; } + ~CVec_PublicKeyZ() { CVec_PublicKeyZ_free(self); } + CVec_PublicKeyZ& operator=(CVec_PublicKeyZ&& o) { CVec_PublicKeyZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PublicKeyZ)); return *this; } + LDKCVec_PublicKeyZ* operator &() { return &self; } + LDKCVec_PublicKeyZ* operator ->() { return &self; } + const LDKCVec_PublicKeyZ* operator &() const { return &self; } + const LDKCVec_PublicKeyZ* operator ->() const { return &self; } +}; +class C2Tuple_u64u64Z { +private: + LDKC2Tuple_u64u64Z self; +public: + C2Tuple_u64u64Z(const C2Tuple_u64u64Z&) = delete; + C2Tuple_u64u64Z(C2Tuple_u64u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u64u64Z)); } + C2Tuple_u64u64Z(LDKC2Tuple_u64u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u64u64Z)); } + operator LDKC2Tuple_u64u64Z() && { LDKC2Tuple_u64u64Z res = self; memset(&self, 0, sizeof(LDKC2Tuple_u64u64Z)); return res; } + ~C2Tuple_u64u64Z() { C2Tuple_u64u64Z_free(self); } + C2Tuple_u64u64Z& operator=(C2Tuple_u64u64Z&& o) { C2Tuple_u64u64Z_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_u64u64Z)); return *this; } + LDKC2Tuple_u64u64Z* operator &() { return &self; } + LDKC2Tuple_u64u64Z* operator ->() { return &self; } + const LDKC2Tuple_u64u64Z* operator &() const { return &self; } + const LDKC2Tuple_u64u64Z* operator ->() const { return &self; } +}; +class C2Tuple_u32TxOutZ { +private: + LDKC2Tuple_u32TxOutZ self; +public: + C2Tuple_u32TxOutZ(const C2Tuple_u32TxOutZ&) = delete; + C2Tuple_u32TxOutZ(C2Tuple_u32TxOutZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u32TxOutZ)); } + C2Tuple_u32TxOutZ(LDKC2Tuple_u32TxOutZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u32TxOutZ)); } + operator LDKC2Tuple_u32TxOutZ() && { LDKC2Tuple_u32TxOutZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_u32TxOutZ)); return res; } + ~C2Tuple_u32TxOutZ() { C2Tuple_u32TxOutZ_free(self); } + C2Tuple_u32TxOutZ& operator=(C2Tuple_u32TxOutZ&& o) { C2Tuple_u32TxOutZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_u32TxOutZ)); return *this; } + LDKC2Tuple_u32TxOutZ* operator &() { return &self; } + LDKC2Tuple_u32TxOutZ* operator ->() { return &self; } + const LDKC2Tuple_u32TxOutZ* operator &() const { return &self; } + const LDKC2Tuple_u32TxOutZ* operator ->() const { return &self; } +}; +class CResult_boolLightningErrorZ { +private: + LDKCResult_boolLightningErrorZ self; +public: + CResult_boolLightningErrorZ(const CResult_boolLightningErrorZ&) = delete; + CResult_boolLightningErrorZ(CResult_boolLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolLightningErrorZ)); } + CResult_boolLightningErrorZ(LDKCResult_boolLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolLightningErrorZ)); } + operator LDKCResult_boolLightningErrorZ() && { LDKCResult_boolLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolLightningErrorZ)); return res; } + ~CResult_boolLightningErrorZ() { CResult_boolLightningErrorZ_free(self); } + CResult_boolLightningErrorZ& operator=(CResult_boolLightningErrorZ&& o) { CResult_boolLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_boolLightningErrorZ)); return *this; } + LDKCResult_boolLightningErrorZ* operator &() { return &self; } + LDKCResult_boolLightningErrorZ* operator ->() { return &self; } + const LDKCResult_boolLightningErrorZ* operator &() const { return &self; } + const LDKCResult_boolLightningErrorZ* operator ->() const { return &self; } +}; +class C2Tuple_BlockHashChannelMonitorZ { +private: + LDKC2Tuple_BlockHashChannelMonitorZ self; +public: + C2Tuple_BlockHashChannelMonitorZ(const C2Tuple_BlockHashChannelMonitorZ&) = delete; + C2Tuple_BlockHashChannelMonitorZ(C2Tuple_BlockHashChannelMonitorZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_BlockHashChannelMonitorZ)); } + C2Tuple_BlockHashChannelMonitorZ(LDKC2Tuple_BlockHashChannelMonitorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_BlockHashChannelMonitorZ)); } + operator LDKC2Tuple_BlockHashChannelMonitorZ() && { LDKC2Tuple_BlockHashChannelMonitorZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_BlockHashChannelMonitorZ)); return res; } + ~C2Tuple_BlockHashChannelMonitorZ() { C2Tuple_BlockHashChannelMonitorZ_free(self); } + C2Tuple_BlockHashChannelMonitorZ& operator=(C2Tuple_BlockHashChannelMonitorZ&& o) { C2Tuple_BlockHashChannelMonitorZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_BlockHashChannelMonitorZ)); return *this; } + LDKC2Tuple_BlockHashChannelMonitorZ* operator &() { return &self; } + LDKC2Tuple_BlockHashChannelMonitorZ* operator ->() { return &self; } + const LDKC2Tuple_BlockHashChannelMonitorZ* operator &() const { return &self; } + const LDKC2Tuple_BlockHashChannelMonitorZ* operator ->() const { return &self; } }; class CResult_SecretKeySecpErrorZ { private: LDKCResult_SecretKeySecpErrorZ self; public: CResult_SecretKeySecpErrorZ(const CResult_SecretKeySecpErrorZ&) = delete; - ~CResult_SecretKeySecpErrorZ() { CResult_SecretKeySecpErrorZ_free(self); } CResult_SecretKeySecpErrorZ(CResult_SecretKeySecpErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SecretKeySecpErrorZ)); } CResult_SecretKeySecpErrorZ(LDKCResult_SecretKeySecpErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SecretKeySecpErrorZ)); } - operator LDKCResult_SecretKeySecpErrorZ() { LDKCResult_SecretKeySecpErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SecretKeySecpErrorZ)); return res; } + operator LDKCResult_SecretKeySecpErrorZ() && { LDKCResult_SecretKeySecpErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SecretKeySecpErrorZ)); return res; } + ~CResult_SecretKeySecpErrorZ() { CResult_SecretKeySecpErrorZ_free(self); } + CResult_SecretKeySecpErrorZ& operator=(CResult_SecretKeySecpErrorZ&& o) { CResult_SecretKeySecpErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SecretKeySecpErrorZ)); return *this; } LDKCResult_SecretKeySecpErrorZ* operator &() { return &self; } LDKCResult_SecretKeySecpErrorZ* operator ->() { return &self; } const LDKCResult_SecretKeySecpErrorZ* operator &() const { return &self; } const LDKCResult_SecretKeySecpErrorZ* operator ->() const { return &self; } }; +class CResult_NodeAnnouncementInfoDecodeErrorZ { +private: + LDKCResult_NodeAnnouncementInfoDecodeErrorZ self; +public: + CResult_NodeAnnouncementInfoDecodeErrorZ(const CResult_NodeAnnouncementInfoDecodeErrorZ&) = delete; + CResult_NodeAnnouncementInfoDecodeErrorZ(CResult_NodeAnnouncementInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAnnouncementInfoDecodeErrorZ)); } + CResult_NodeAnnouncementInfoDecodeErrorZ(LDKCResult_NodeAnnouncementInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ)); } + operator LDKCResult_NodeAnnouncementInfoDecodeErrorZ() && { LDKCResult_NodeAnnouncementInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ)); return res; } + ~CResult_NodeAnnouncementInfoDecodeErrorZ() { CResult_NodeAnnouncementInfoDecodeErrorZ_free(self); } + CResult_NodeAnnouncementInfoDecodeErrorZ& operator=(CResult_NodeAnnouncementInfoDecodeErrorZ&& o) { CResult_NodeAnnouncementInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAnnouncementInfoDecodeErrorZ)); return *this; } + LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() { return &self; } + LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_SpendableOutputDescriptorDecodeErrorZ { +private: + LDKCResult_SpendableOutputDescriptorDecodeErrorZ self; +public: + CResult_SpendableOutputDescriptorDecodeErrorZ(const CResult_SpendableOutputDescriptorDecodeErrorZ&) = delete; + CResult_SpendableOutputDescriptorDecodeErrorZ(CResult_SpendableOutputDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SpendableOutputDescriptorDecodeErrorZ)); } + CResult_SpendableOutputDescriptorDecodeErrorZ(LDKCResult_SpendableOutputDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ)); } + operator LDKCResult_SpendableOutputDescriptorDecodeErrorZ() && { LDKCResult_SpendableOutputDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ)); return res; } + ~CResult_SpendableOutputDescriptorDecodeErrorZ() { CResult_SpendableOutputDescriptorDecodeErrorZ_free(self); } + CResult_SpendableOutputDescriptorDecodeErrorZ& operator=(CResult_SpendableOutputDescriptorDecodeErrorZ&& o) { CResult_SpendableOutputDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SpendableOutputDescriptorDecodeErrorZ)); return *this; } + LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator &() { return &self; } + LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_NetAddressu8Z { +private: + LDKCResult_NetAddressu8Z self; +public: + CResult_NetAddressu8Z(const CResult_NetAddressu8Z&) = delete; + CResult_NetAddressu8Z(CResult_NetAddressu8Z&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NetAddressu8Z)); } + CResult_NetAddressu8Z(LDKCResult_NetAddressu8Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NetAddressu8Z)); } + operator LDKCResult_NetAddressu8Z() && { LDKCResult_NetAddressu8Z res = self; memset(&self, 0, sizeof(LDKCResult_NetAddressu8Z)); return res; } + ~CResult_NetAddressu8Z() { CResult_NetAddressu8Z_free(self); } + CResult_NetAddressu8Z& operator=(CResult_NetAddressu8Z&& o) { CResult_NetAddressu8Z_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NetAddressu8Z)); return *this; } + LDKCResult_NetAddressu8Z* operator &() { return &self; } + LDKCResult_NetAddressu8Z* operator ->() { return &self; } + const LDKCResult_NetAddressu8Z* operator &() const { return &self; } + const LDKCResult_NetAddressu8Z* operator ->() const { return &self; } +}; +class CVec_UpdateFailMalformedHTLCZ { +private: + LDKCVec_UpdateFailMalformedHTLCZ self; +public: + CVec_UpdateFailMalformedHTLCZ(const CVec_UpdateFailMalformedHTLCZ&) = delete; + CVec_UpdateFailMalformedHTLCZ(CVec_UpdateFailMalformedHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); } + CVec_UpdateFailMalformedHTLCZ(LDKCVec_UpdateFailMalformedHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); } + operator LDKCVec_UpdateFailMalformedHTLCZ() && { LDKCVec_UpdateFailMalformedHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); return res; } + ~CVec_UpdateFailMalformedHTLCZ() { CVec_UpdateFailMalformedHTLCZ_free(self); } + CVec_UpdateFailMalformedHTLCZ& operator=(CVec_UpdateFailMalformedHTLCZ&& o) { CVec_UpdateFailMalformedHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); return *this; } + LDKCVec_UpdateFailMalformedHTLCZ* operator &() { return &self; } + LDKCVec_UpdateFailMalformedHTLCZ* operator ->() { return &self; } + const LDKCVec_UpdateFailMalformedHTLCZ* operator &() const { return &self; } + const LDKCVec_UpdateFailMalformedHTLCZ* operator ->() const { return &self; } +}; +class CResult_UnsignedChannelUpdateDecodeErrorZ { +private: + LDKCResult_UnsignedChannelUpdateDecodeErrorZ self; +public: + CResult_UnsignedChannelUpdateDecodeErrorZ(const CResult_UnsignedChannelUpdateDecodeErrorZ&) = delete; + CResult_UnsignedChannelUpdateDecodeErrorZ(CResult_UnsignedChannelUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedChannelUpdateDecodeErrorZ)); } + CResult_UnsignedChannelUpdateDecodeErrorZ(LDKCResult_UnsignedChannelUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ)); } + operator LDKCResult_UnsignedChannelUpdateDecodeErrorZ() && { LDKCResult_UnsignedChannelUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ)); return res; } + ~CResult_UnsignedChannelUpdateDecodeErrorZ() { CResult_UnsignedChannelUpdateDecodeErrorZ_free(self); } + CResult_UnsignedChannelUpdateDecodeErrorZ& operator=(CResult_UnsignedChannelUpdateDecodeErrorZ&& o) { CResult_UnsignedChannelUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedChannelUpdateDecodeErrorZ)); return *this; } + LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator &() { return &self; } + LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator ->() const { return &self; } +}; class CVec_EventZ { private: LDKCVec_EventZ self; public: CVec_EventZ(const CVec_EventZ&) = delete; - ~CVec_EventZ() { CVec_EventZ_free(self); } CVec_EventZ(CVec_EventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_EventZ)); } CVec_EventZ(LDKCVec_EventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_EventZ)); } - operator LDKCVec_EventZ() { LDKCVec_EventZ res = self; memset(&self, 0, sizeof(LDKCVec_EventZ)); return res; } + operator LDKCVec_EventZ() && { LDKCVec_EventZ res = self; memset(&self, 0, sizeof(LDKCVec_EventZ)); return res; } + ~CVec_EventZ() { CVec_EventZ_free(self); } + CVec_EventZ& operator=(CVec_EventZ&& o) { CVec_EventZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_EventZ)); return *this; } LDKCVec_EventZ* operator &() { return &self; } LDKCVec_EventZ* operator ->() { return &self; } const LDKCVec_EventZ* operator &() const { return &self; } const LDKCVec_EventZ* operator ->() const { return &self; } }; -class CResult_CVec_u8ZPeerHandleErrorZ { +class CResult_NetworkGraphDecodeErrorZ { private: - LDKCResult_CVec_u8ZPeerHandleErrorZ self; + LDKCResult_NetworkGraphDecodeErrorZ self; public: - CResult_CVec_u8ZPeerHandleErrorZ(const CResult_CVec_u8ZPeerHandleErrorZ&) = delete; - ~CResult_CVec_u8ZPeerHandleErrorZ() { CResult_CVec_u8ZPeerHandleErrorZ_free(self); } - CResult_CVec_u8ZPeerHandleErrorZ(CResult_CVec_u8ZPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_u8ZPeerHandleErrorZ)); } - CResult_CVec_u8ZPeerHandleErrorZ(LDKCResult_CVec_u8ZPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); } - operator LDKCResult_CVec_u8ZPeerHandleErrorZ() { LDKCResult_CVec_u8ZPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); return res; } - LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() { return &self; } - LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() { return &self; } - const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() const { return &self; } - const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() const { return &self; } + CResult_NetworkGraphDecodeErrorZ(const CResult_NetworkGraphDecodeErrorZ&) = delete; + CResult_NetworkGraphDecodeErrorZ(CResult_NetworkGraphDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NetworkGraphDecodeErrorZ)); } + CResult_NetworkGraphDecodeErrorZ(LDKCResult_NetworkGraphDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NetworkGraphDecodeErrorZ)); } + operator LDKCResult_NetworkGraphDecodeErrorZ() && { LDKCResult_NetworkGraphDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NetworkGraphDecodeErrorZ)); return res; } + ~CResult_NetworkGraphDecodeErrorZ() { CResult_NetworkGraphDecodeErrorZ_free(self); } + CResult_NetworkGraphDecodeErrorZ& operator=(CResult_NetworkGraphDecodeErrorZ&& o) { CResult_NetworkGraphDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NetworkGraphDecodeErrorZ)); return *this; } + LDKCResult_NetworkGraphDecodeErrorZ* operator &() { return &self; } + LDKCResult_NetworkGraphDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NetworkGraphDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NetworkGraphDecodeErrorZ* operator ->() const { return &self; } }; class CVec_MonitorEventZ { private: LDKCVec_MonitorEventZ self; public: CVec_MonitorEventZ(const CVec_MonitorEventZ&) = delete; - ~CVec_MonitorEventZ() { CVec_MonitorEventZ_free(self); } CVec_MonitorEventZ(CVec_MonitorEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_MonitorEventZ)); } CVec_MonitorEventZ(LDKCVec_MonitorEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_MonitorEventZ)); } - operator LDKCVec_MonitorEventZ() { LDKCVec_MonitorEventZ res = self; memset(&self, 0, sizeof(LDKCVec_MonitorEventZ)); return res; } + operator LDKCVec_MonitorEventZ() && { LDKCVec_MonitorEventZ res = self; memset(&self, 0, sizeof(LDKCVec_MonitorEventZ)); return res; } + ~CVec_MonitorEventZ() { CVec_MonitorEventZ_free(self); } + CVec_MonitorEventZ& operator=(CVec_MonitorEventZ&& o) { CVec_MonitorEventZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_MonitorEventZ)); return *this; } LDKCVec_MonitorEventZ* operator &() { return &self; } LDKCVec_MonitorEventZ* operator ->() { return &self; } const LDKCVec_MonitorEventZ* operator &() const { return &self; } @@ -1667,10 +2296,11 @@ class CResult_ChanKeySignerDecodeErrorZ { LDKCResult_ChanKeySignerDecodeErrorZ self; public: CResult_ChanKeySignerDecodeErrorZ(const CResult_ChanKeySignerDecodeErrorZ&) = delete; - ~CResult_ChanKeySignerDecodeErrorZ() { CResult_ChanKeySignerDecodeErrorZ_free(self); } CResult_ChanKeySignerDecodeErrorZ(CResult_ChanKeySignerDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChanKeySignerDecodeErrorZ)); } CResult_ChanKeySignerDecodeErrorZ(LDKCResult_ChanKeySignerDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChanKeySignerDecodeErrorZ)); } - operator LDKCResult_ChanKeySignerDecodeErrorZ() { LDKCResult_ChanKeySignerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChanKeySignerDecodeErrorZ)); return res; } + operator LDKCResult_ChanKeySignerDecodeErrorZ() && { LDKCResult_ChanKeySignerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChanKeySignerDecodeErrorZ)); return res; } + ~CResult_ChanKeySignerDecodeErrorZ() { CResult_ChanKeySignerDecodeErrorZ_free(self); } + CResult_ChanKeySignerDecodeErrorZ& operator=(CResult_ChanKeySignerDecodeErrorZ&& o) { CResult_ChanKeySignerDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChanKeySignerDecodeErrorZ)); return *this; } LDKCResult_ChanKeySignerDecodeErrorZ* operator &() { return &self; } LDKCResult_ChanKeySignerDecodeErrorZ* operator ->() { return &self; } const LDKCResult_ChanKeySignerDecodeErrorZ* operator &() const { return &self; } @@ -1681,38 +2311,26 @@ class CVec_RouteHopZ { LDKCVec_RouteHopZ self; public: CVec_RouteHopZ(const CVec_RouteHopZ&) = delete; - ~CVec_RouteHopZ() { CVec_RouteHopZ_free(self); } CVec_RouteHopZ(CVec_RouteHopZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHopZ)); } CVec_RouteHopZ(LDKCVec_RouteHopZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHopZ)); } - operator LDKCVec_RouteHopZ() { LDKCVec_RouteHopZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHopZ)); return res; } + operator LDKCVec_RouteHopZ() && { LDKCVec_RouteHopZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHopZ)); return res; } + ~CVec_RouteHopZ() { CVec_RouteHopZ_free(self); } + CVec_RouteHopZ& operator=(CVec_RouteHopZ&& o) { CVec_RouteHopZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHopZ)); return *this; } LDKCVec_RouteHopZ* operator &() { return &self; } LDKCVec_RouteHopZ* operator ->() { return &self; } const LDKCVec_RouteHopZ* operator &() const { return &self; } const LDKCVec_RouteHopZ* operator ->() const { return &self; } }; -class CResult_TxOutAccessErrorZ { -private: - LDKCResult_TxOutAccessErrorZ self; -public: - CResult_TxOutAccessErrorZ(const CResult_TxOutAccessErrorZ&) = delete; - ~CResult_TxOutAccessErrorZ() { CResult_TxOutAccessErrorZ_free(self); } - CResult_TxOutAccessErrorZ(CResult_TxOutAccessErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxOutAccessErrorZ)); } - CResult_TxOutAccessErrorZ(LDKCResult_TxOutAccessErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxOutAccessErrorZ)); } - operator LDKCResult_TxOutAccessErrorZ() { LDKCResult_TxOutAccessErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxOutAccessErrorZ)); return res; } - LDKCResult_TxOutAccessErrorZ* operator &() { return &self; } - LDKCResult_TxOutAccessErrorZ* operator ->() { return &self; } - const LDKCResult_TxOutAccessErrorZ* operator &() const { return &self; } - const LDKCResult_TxOutAccessErrorZ* operator ->() const { return &self; } -}; class CResult_NoneChannelMonitorUpdateErrZ { private: LDKCResult_NoneChannelMonitorUpdateErrZ self; public: CResult_NoneChannelMonitorUpdateErrZ(const CResult_NoneChannelMonitorUpdateErrZ&) = delete; - ~CResult_NoneChannelMonitorUpdateErrZ() { CResult_NoneChannelMonitorUpdateErrZ_free(self); } CResult_NoneChannelMonitorUpdateErrZ(CResult_NoneChannelMonitorUpdateErrZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneChannelMonitorUpdateErrZ)); } CResult_NoneChannelMonitorUpdateErrZ(LDKCResult_NoneChannelMonitorUpdateErrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ)); } - operator LDKCResult_NoneChannelMonitorUpdateErrZ() { LDKCResult_NoneChannelMonitorUpdateErrZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ)); return res; } + operator LDKCResult_NoneChannelMonitorUpdateErrZ() && { LDKCResult_NoneChannelMonitorUpdateErrZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ)); return res; } + ~CResult_NoneChannelMonitorUpdateErrZ() { CResult_NoneChannelMonitorUpdateErrZ_free(self); } + CResult_NoneChannelMonitorUpdateErrZ& operator=(CResult_NoneChannelMonitorUpdateErrZ&& o) { CResult_NoneChannelMonitorUpdateErrZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneChannelMonitorUpdateErrZ)); return *this; } LDKCResult_NoneChannelMonitorUpdateErrZ* operator &() { return &self; } LDKCResult_NoneChannelMonitorUpdateErrZ* operator ->() { return &self; } const LDKCResult_NoneChannelMonitorUpdateErrZ* operator &() const { return &self; } @@ -1723,38 +2341,41 @@ class CResult_NonePaymentSendFailureZ { LDKCResult_NonePaymentSendFailureZ self; public: CResult_NonePaymentSendFailureZ(const CResult_NonePaymentSendFailureZ&) = delete; - ~CResult_NonePaymentSendFailureZ() { CResult_NonePaymentSendFailureZ_free(self); } CResult_NonePaymentSendFailureZ(CResult_NonePaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePaymentSendFailureZ)); } CResult_NonePaymentSendFailureZ(LDKCResult_NonePaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); } - operator LDKCResult_NonePaymentSendFailureZ() { LDKCResult_NonePaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); return res; } + operator LDKCResult_NonePaymentSendFailureZ() && { LDKCResult_NonePaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); return res; } + ~CResult_NonePaymentSendFailureZ() { CResult_NonePaymentSendFailureZ_free(self); } + CResult_NonePaymentSendFailureZ& operator=(CResult_NonePaymentSendFailureZ&& o) { CResult_NonePaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonePaymentSendFailureZ)); return *this; } LDKCResult_NonePaymentSendFailureZ* operator &() { return &self; } LDKCResult_NonePaymentSendFailureZ* operator ->() { return &self; } const LDKCResult_NonePaymentSendFailureZ* operator &() const { return &self; } const LDKCResult_NonePaymentSendFailureZ* operator ->() const { return &self; } }; -class CResult_TxCreationKeysSecpErrorZ { +class CResult_NodeInfoDecodeErrorZ { private: - LDKCResult_TxCreationKeysSecpErrorZ self; + LDKCResult_NodeInfoDecodeErrorZ self; public: - CResult_TxCreationKeysSecpErrorZ(const CResult_TxCreationKeysSecpErrorZ&) = delete; - ~CResult_TxCreationKeysSecpErrorZ() { CResult_TxCreationKeysSecpErrorZ_free(self); } - CResult_TxCreationKeysSecpErrorZ(CResult_TxCreationKeysSecpErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxCreationKeysSecpErrorZ)); } - CResult_TxCreationKeysSecpErrorZ(LDKCResult_TxCreationKeysSecpErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxCreationKeysSecpErrorZ)); } - operator LDKCResult_TxCreationKeysSecpErrorZ() { LDKCResult_TxCreationKeysSecpErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxCreationKeysSecpErrorZ)); return res; } - LDKCResult_TxCreationKeysSecpErrorZ* operator &() { return &self; } - LDKCResult_TxCreationKeysSecpErrorZ* operator ->() { return &self; } - const LDKCResult_TxCreationKeysSecpErrorZ* operator &() const { return &self; } - const LDKCResult_TxCreationKeysSecpErrorZ* operator ->() const { return &self; } + CResult_NodeInfoDecodeErrorZ(const CResult_NodeInfoDecodeErrorZ&) = delete; + CResult_NodeInfoDecodeErrorZ(CResult_NodeInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); } + CResult_NodeInfoDecodeErrorZ(LDKCResult_NodeInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); } + operator LDKCResult_NodeInfoDecodeErrorZ() && { LDKCResult_NodeInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); return res; } + ~CResult_NodeInfoDecodeErrorZ() { CResult_NodeInfoDecodeErrorZ_free(self); } + CResult_NodeInfoDecodeErrorZ& operator=(CResult_NodeInfoDecodeErrorZ&& o) { CResult_NodeInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); return *this; } + LDKCResult_NodeInfoDecodeErrorZ* operator &() { return &self; } + LDKCResult_NodeInfoDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NodeInfoDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NodeInfoDecodeErrorZ* operator ->() const { return &self; } }; class CVec_u8Z { private: LDKCVec_u8Z self; public: CVec_u8Z(const CVec_u8Z&) = delete; - ~CVec_u8Z() { CVec_u8Z_free(self); } CVec_u8Z(CVec_u8Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u8Z)); } CVec_u8Z(LDKCVec_u8Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u8Z)); } - operator LDKCVec_u8Z() { LDKCVec_u8Z res = self; memset(&self, 0, sizeof(LDKCVec_u8Z)); return res; } + operator LDKCVec_u8Z() && { LDKCVec_u8Z res = self; memset(&self, 0, sizeof(LDKCVec_u8Z)); return res; } + ~CVec_u8Z() { CVec_u8Z_free(self); } + CVec_u8Z& operator=(CVec_u8Z&& o) { CVec_u8Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_u8Z)); return *this; } LDKCVec_u8Z* operator &() { return &self; } LDKCVec_u8Z* operator ->() { return &self; } const LDKCVec_u8Z* operator &() const { return &self; } @@ -1765,164 +2386,71 @@ class CResult_PublicKeySecpErrorZ { LDKCResult_PublicKeySecpErrorZ self; public: CResult_PublicKeySecpErrorZ(const CResult_PublicKeySecpErrorZ&) = delete; - ~CResult_PublicKeySecpErrorZ() { CResult_PublicKeySecpErrorZ_free(self); } CResult_PublicKeySecpErrorZ(CResult_PublicKeySecpErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PublicKeySecpErrorZ)); } CResult_PublicKeySecpErrorZ(LDKCResult_PublicKeySecpErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PublicKeySecpErrorZ)); } - operator LDKCResult_PublicKeySecpErrorZ() { LDKCResult_PublicKeySecpErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PublicKeySecpErrorZ)); return res; } + operator LDKCResult_PublicKeySecpErrorZ() && { LDKCResult_PublicKeySecpErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PublicKeySecpErrorZ)); return res; } + ~CResult_PublicKeySecpErrorZ() { CResult_PublicKeySecpErrorZ_free(self); } + CResult_PublicKeySecpErrorZ& operator=(CResult_PublicKeySecpErrorZ&& o) { CResult_PublicKeySecpErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PublicKeySecpErrorZ)); return *this; } LDKCResult_PublicKeySecpErrorZ* operator &() { return &self; } LDKCResult_PublicKeySecpErrorZ* operator ->() { return &self; } const LDKCResult_PublicKeySecpErrorZ* operator &() const { return &self; } const LDKCResult_PublicKeySecpErrorZ* operator ->() const { return &self; } }; -class CVec_RouteHintZ { +class CResult_RouteLightningErrorZ { private: - LDKCVec_RouteHintZ self; + LDKCResult_RouteLightningErrorZ self; public: - CVec_RouteHintZ(const CVec_RouteHintZ&) = delete; - ~CVec_RouteHintZ() { CVec_RouteHintZ_free(self); } - CVec_RouteHintZ(CVec_RouteHintZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHintZ)); } - CVec_RouteHintZ(LDKCVec_RouteHintZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHintZ)); } - operator LDKCVec_RouteHintZ() { LDKCVec_RouteHintZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHintZ)); return res; } - LDKCVec_RouteHintZ* operator &() { return &self; } - LDKCVec_RouteHintZ* operator ->() { return &self; } - const LDKCVec_RouteHintZ* operator &() const { return &self; } - const LDKCVec_RouteHintZ* operator ->() const { return &self; } + CResult_RouteLightningErrorZ(const CResult_RouteLightningErrorZ&) = delete; + CResult_RouteLightningErrorZ(CResult_RouteLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteLightningErrorZ)); } + CResult_RouteLightningErrorZ(LDKCResult_RouteLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); } + operator LDKCResult_RouteLightningErrorZ() && { LDKCResult_RouteLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); return res; } + ~CResult_RouteLightningErrorZ() { CResult_RouteLightningErrorZ_free(self); } + CResult_RouteLightningErrorZ& operator=(CResult_RouteLightningErrorZ&& o) { CResult_RouteLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteLightningErrorZ)); return *this; } + LDKCResult_RouteLightningErrorZ* operator &() { return &self; } + LDKCResult_RouteLightningErrorZ* operator ->() { return &self; } + const LDKCResult_RouteLightningErrorZ* operator &() const { return &self; } + const LDKCResult_RouteLightningErrorZ* operator ->() const { return &self; } }; class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { private: LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ self; public: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(const C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&) = delete; - ~C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() { C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(self); } C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); } C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); } - operator LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() { LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); return res; } + operator LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() && { LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); return res; } + ~C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() { C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(self); } + C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ& operator=(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& o) { C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); return *this; } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() { return &self; } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() { return &self; } const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() const { return &self; } const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() const { return &self; } }; -class CVec_CVec_RouteHopZZ { -private: - LDKCVec_CVec_RouteHopZZ self; -public: - CVec_CVec_RouteHopZZ(const CVec_CVec_RouteHopZZ&) = delete; - ~CVec_CVec_RouteHopZZ() { CVec_CVec_RouteHopZZ_free(self); } - CVec_CVec_RouteHopZZ(CVec_CVec_RouteHopZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_CVec_RouteHopZZ)); } - CVec_CVec_RouteHopZZ(LDKCVec_CVec_RouteHopZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_CVec_RouteHopZZ)); } - operator LDKCVec_CVec_RouteHopZZ() { LDKCVec_CVec_RouteHopZZ res = self; memset(&self, 0, sizeof(LDKCVec_CVec_RouteHopZZ)); return res; } - LDKCVec_CVec_RouteHopZZ* operator &() { return &self; } - LDKCVec_CVec_RouteHopZZ* operator ->() { return &self; } - const LDKCVec_CVec_RouteHopZZ* operator &() const { return &self; } - const LDKCVec_CVec_RouteHopZZ* operator ->() const { return &self; } -}; -class CVec_UpdateAddHTLCZ { -private: - LDKCVec_UpdateAddHTLCZ self; -public: - CVec_UpdateAddHTLCZ(const CVec_UpdateAddHTLCZ&) = delete; - ~CVec_UpdateAddHTLCZ() { CVec_UpdateAddHTLCZ_free(self); } - CVec_UpdateAddHTLCZ(CVec_UpdateAddHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateAddHTLCZ)); } - CVec_UpdateAddHTLCZ(LDKCVec_UpdateAddHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); } - operator LDKCVec_UpdateAddHTLCZ() { LDKCVec_UpdateAddHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); return res; } - LDKCVec_UpdateAddHTLCZ* operator &() { return &self; } - LDKCVec_UpdateAddHTLCZ* operator ->() { return &self; } - const LDKCVec_UpdateAddHTLCZ* operator &() const { return &self; } - const LDKCVec_UpdateAddHTLCZ* operator ->() const { return &self; } -}; -class CResult_NoneLightningErrorZ { -private: - LDKCResult_NoneLightningErrorZ self; -public: - CResult_NoneLightningErrorZ(const CResult_NoneLightningErrorZ&) = delete; - ~CResult_NoneLightningErrorZ() { CResult_NoneLightningErrorZ_free(self); } - CResult_NoneLightningErrorZ(CResult_NoneLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneLightningErrorZ)); } - CResult_NoneLightningErrorZ(LDKCResult_NoneLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneLightningErrorZ)); } - operator LDKCResult_NoneLightningErrorZ() { LDKCResult_NoneLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneLightningErrorZ)); return res; } - LDKCResult_NoneLightningErrorZ* operator &() { return &self; } - LDKCResult_NoneLightningErrorZ* operator ->() { return &self; } - const LDKCResult_NoneLightningErrorZ* operator &() const { return &self; } - const LDKCResult_NoneLightningErrorZ* operator ->() const { return &self; } -}; -class CResult_NonePeerHandleErrorZ { -private: - LDKCResult_NonePeerHandleErrorZ self; -public: - CResult_NonePeerHandleErrorZ(const CResult_NonePeerHandleErrorZ&) = delete; - ~CResult_NonePeerHandleErrorZ() { CResult_NonePeerHandleErrorZ_free(self); } - CResult_NonePeerHandleErrorZ(CResult_NonePeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); } - CResult_NonePeerHandleErrorZ(LDKCResult_NonePeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); } - operator LDKCResult_NonePeerHandleErrorZ() { LDKCResult_NonePeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); return res; } - LDKCResult_NonePeerHandleErrorZ* operator &() { return &self; } - LDKCResult_NonePeerHandleErrorZ* operator ->() { return &self; } - const LDKCResult_NonePeerHandleErrorZ* operator &() const { return &self; } - const LDKCResult_NonePeerHandleErrorZ* operator ->() const { return &self; } -}; class CResult_boolPeerHandleErrorZ { private: LDKCResult_boolPeerHandleErrorZ self; public: CResult_boolPeerHandleErrorZ(const CResult_boolPeerHandleErrorZ&) = delete; - ~CResult_boolPeerHandleErrorZ() { CResult_boolPeerHandleErrorZ_free(self); } CResult_boolPeerHandleErrorZ(CResult_boolPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolPeerHandleErrorZ)); } CResult_boolPeerHandleErrorZ(LDKCResult_boolPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolPeerHandleErrorZ)); } - operator LDKCResult_boolPeerHandleErrorZ() { LDKCResult_boolPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolPeerHandleErrorZ)); return res; } + operator LDKCResult_boolPeerHandleErrorZ() && { LDKCResult_boolPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolPeerHandleErrorZ)); return res; } + ~CResult_boolPeerHandleErrorZ() { CResult_boolPeerHandleErrorZ_free(self); } + CResult_boolPeerHandleErrorZ& operator=(CResult_boolPeerHandleErrorZ&& o) { CResult_boolPeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_boolPeerHandleErrorZ)); return *this; } LDKCResult_boolPeerHandleErrorZ* operator &() { return &self; } LDKCResult_boolPeerHandleErrorZ* operator ->() { return &self; } const LDKCResult_boolPeerHandleErrorZ* operator &() const { return &self; } const LDKCResult_boolPeerHandleErrorZ* operator ->() const { return &self; } }; -class CResult_TrustedCommitmentTransactionNoneZ { -private: - LDKCResult_TrustedCommitmentTransactionNoneZ self; -public: - CResult_TrustedCommitmentTransactionNoneZ(const CResult_TrustedCommitmentTransactionNoneZ&) = delete; - ~CResult_TrustedCommitmentTransactionNoneZ() { CResult_TrustedCommitmentTransactionNoneZ_free(self); } - CResult_TrustedCommitmentTransactionNoneZ(CResult_TrustedCommitmentTransactionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TrustedCommitmentTransactionNoneZ)); } - CResult_TrustedCommitmentTransactionNoneZ(LDKCResult_TrustedCommitmentTransactionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ)); } - operator LDKCResult_TrustedCommitmentTransactionNoneZ() { LDKCResult_TrustedCommitmentTransactionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ)); return res; } - LDKCResult_TrustedCommitmentTransactionNoneZ* operator &() { return &self; } - LDKCResult_TrustedCommitmentTransactionNoneZ* operator ->() { return &self; } - const LDKCResult_TrustedCommitmentTransactionNoneZ* operator &() const { return &self; } - const LDKCResult_TrustedCommitmentTransactionNoneZ* operator ->() const { return &self; } -}; -class CResult_RouteLightningErrorZ { -private: - LDKCResult_RouteLightningErrorZ self; -public: - CResult_RouteLightningErrorZ(const CResult_RouteLightningErrorZ&) = delete; - ~CResult_RouteLightningErrorZ() { CResult_RouteLightningErrorZ_free(self); } - CResult_RouteLightningErrorZ(CResult_RouteLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteLightningErrorZ)); } - CResult_RouteLightningErrorZ(LDKCResult_RouteLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); } - operator LDKCResult_RouteLightningErrorZ() { LDKCResult_RouteLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); return res; } - LDKCResult_RouteLightningErrorZ* operator &() { return &self; } - LDKCResult_RouteLightningErrorZ* operator ->() { return &self; } - const LDKCResult_RouteLightningErrorZ* operator &() const { return &self; } - const LDKCResult_RouteLightningErrorZ* operator ->() const { return &self; } -}; -class CResult_CVec_SignatureZNoneZ { -private: - LDKCResult_CVec_SignatureZNoneZ self; -public: - CResult_CVec_SignatureZNoneZ(const CResult_CVec_SignatureZNoneZ&) = delete; - ~CResult_CVec_SignatureZNoneZ() { CResult_CVec_SignatureZNoneZ_free(self); } - CResult_CVec_SignatureZNoneZ(CResult_CVec_SignatureZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_SignatureZNoneZ)); } - CResult_CVec_SignatureZNoneZ(LDKCResult_CVec_SignatureZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); } - operator LDKCResult_CVec_SignatureZNoneZ() { LDKCResult_CVec_SignatureZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); return res; } - LDKCResult_CVec_SignatureZNoneZ* operator &() { return &self; } - LDKCResult_CVec_SignatureZNoneZ* operator ->() { return &self; } - const LDKCResult_CVec_SignatureZNoneZ* operator &() const { return &self; } - const LDKCResult_CVec_SignatureZNoneZ* operator ->() const { return &self; } -}; class CVec_UpdateFulfillHTLCZ { private: LDKCVec_UpdateFulfillHTLCZ self; public: CVec_UpdateFulfillHTLCZ(const CVec_UpdateFulfillHTLCZ&) = delete; - ~CVec_UpdateFulfillHTLCZ() { CVec_UpdateFulfillHTLCZ_free(self); } CVec_UpdateFulfillHTLCZ(CVec_UpdateFulfillHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFulfillHTLCZ)); } CVec_UpdateFulfillHTLCZ(LDKCVec_UpdateFulfillHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFulfillHTLCZ)); } - operator LDKCVec_UpdateFulfillHTLCZ() { LDKCVec_UpdateFulfillHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFulfillHTLCZ)); return res; } + operator LDKCVec_UpdateFulfillHTLCZ() && { LDKCVec_UpdateFulfillHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFulfillHTLCZ)); return res; } + ~CVec_UpdateFulfillHTLCZ() { CVec_UpdateFulfillHTLCZ_free(self); } + CVec_UpdateFulfillHTLCZ& operator=(CVec_UpdateFulfillHTLCZ&& o) { CVec_UpdateFulfillHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFulfillHTLCZ)); return *this; } LDKCVec_UpdateFulfillHTLCZ* operator &() { return &self; } LDKCVec_UpdateFulfillHTLCZ* operator ->() { return &self; } const LDKCVec_UpdateFulfillHTLCZ* operator &() const { return &self; } @@ -1933,10 +2461,11 @@ class CResult_SignatureNoneZ { LDKCResult_SignatureNoneZ self; public: CResult_SignatureNoneZ(const CResult_SignatureNoneZ&) = delete; - ~CResult_SignatureNoneZ() { CResult_SignatureNoneZ_free(self); } CResult_SignatureNoneZ(CResult_SignatureNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SignatureNoneZ)); } CResult_SignatureNoneZ(LDKCResult_SignatureNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SignatureNoneZ)); } - operator LDKCResult_SignatureNoneZ() { LDKCResult_SignatureNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SignatureNoneZ)); return res; } + operator LDKCResult_SignatureNoneZ() && { LDKCResult_SignatureNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SignatureNoneZ)); return res; } + ~CResult_SignatureNoneZ() { CResult_SignatureNoneZ_free(self); } + CResult_SignatureNoneZ& operator=(CResult_SignatureNoneZ&& o) { CResult_SignatureNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SignatureNoneZ)); return *this; } LDKCResult_SignatureNoneZ* operator &() { return &self; } LDKCResult_SignatureNoneZ* operator ->() { return &self; } const LDKCResult_SignatureNoneZ* operator &() const { return &self; } @@ -1947,24 +2476,71 @@ class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ self; public: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(const C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&) = delete; - ~C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ() { C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(self); } C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); } C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); } - operator LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ() { LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); return res; } + operator LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ() && { LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); return res; } + ~C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ() { C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(self); } + C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ& operator=(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& o) { C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); return *this; } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator &() { return &self; } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator ->() { return &self; } const LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator &() const { return &self; } const LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator ->() const { return &self; } }; +class CResult_InitDecodeErrorZ { +private: + LDKCResult_InitDecodeErrorZ self; +public: + CResult_InitDecodeErrorZ(const CResult_InitDecodeErrorZ&) = delete; + CResult_InitDecodeErrorZ(CResult_InitDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InitDecodeErrorZ)); } + CResult_InitDecodeErrorZ(LDKCResult_InitDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InitDecodeErrorZ)); } + operator LDKCResult_InitDecodeErrorZ() && { LDKCResult_InitDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InitDecodeErrorZ)); return res; } + ~CResult_InitDecodeErrorZ() { CResult_InitDecodeErrorZ_free(self); } + CResult_InitDecodeErrorZ& operator=(CResult_InitDecodeErrorZ&& o) { CResult_InitDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InitDecodeErrorZ)); return *this; } + LDKCResult_InitDecodeErrorZ* operator &() { return &self; } + LDKCResult_InitDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InitDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InitDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_ReplyShortChannelIdsEndDecodeErrorZ { +private: + LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ self; +public: + CResult_ReplyShortChannelIdsEndDecodeErrorZ(const CResult_ReplyShortChannelIdsEndDecodeErrorZ&) = delete; + CResult_ReplyShortChannelIdsEndDecodeErrorZ(CResult_ReplyShortChannelIdsEndDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReplyShortChannelIdsEndDecodeErrorZ)); } + CResult_ReplyShortChannelIdsEndDecodeErrorZ(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ)); } + operator LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ() && { LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ)); return res; } + ~CResult_ReplyShortChannelIdsEndDecodeErrorZ() { CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(self); } + CResult_ReplyShortChannelIdsEndDecodeErrorZ& operator=(CResult_ReplyShortChannelIdsEndDecodeErrorZ&& o) { CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReplyShortChannelIdsEndDecodeErrorZ)); return *this; } + LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() { return &self; } + LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_CResult_NetAddressu8ZDecodeErrorZ { +private: + LDKCResult_CResult_NetAddressu8ZDecodeErrorZ self; +public: + CResult_CResult_NetAddressu8ZDecodeErrorZ(const CResult_CResult_NetAddressu8ZDecodeErrorZ&) = delete; + CResult_CResult_NetAddressu8ZDecodeErrorZ(CResult_CResult_NetAddressu8ZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CResult_NetAddressu8ZDecodeErrorZ)); } + CResult_CResult_NetAddressu8ZDecodeErrorZ(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ)); } + operator LDKCResult_CResult_NetAddressu8ZDecodeErrorZ() && { LDKCResult_CResult_NetAddressu8ZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ)); return res; } + ~CResult_CResult_NetAddressu8ZDecodeErrorZ() { CResult_CResult_NetAddressu8ZDecodeErrorZ_free(self); } + CResult_CResult_NetAddressu8ZDecodeErrorZ& operator=(CResult_CResult_NetAddressu8ZDecodeErrorZ&& o) { CResult_CResult_NetAddressu8ZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CResult_NetAddressu8ZDecodeErrorZ)); return *this; } + LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* operator &() { return &self; } + LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* operator ->() const { return &self; } +}; class CVec_ChannelDetailsZ { private: LDKCVec_ChannelDetailsZ self; public: CVec_ChannelDetailsZ(const CVec_ChannelDetailsZ&) = delete; - ~CVec_ChannelDetailsZ() { CVec_ChannelDetailsZ_free(self); } CVec_ChannelDetailsZ(CVec_ChannelDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelDetailsZ)); } CVec_ChannelDetailsZ(LDKCVec_ChannelDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelDetailsZ)); } - operator LDKCVec_ChannelDetailsZ() { LDKCVec_ChannelDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelDetailsZ)); return res; } + operator LDKCVec_ChannelDetailsZ() && { LDKCVec_ChannelDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelDetailsZ)); return res; } + ~CVec_ChannelDetailsZ() { CVec_ChannelDetailsZ_free(self); } + CVec_ChannelDetailsZ& operator=(CVec_ChannelDetailsZ&& o) { CVec_ChannelDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ChannelDetailsZ)); return *this; } LDKCVec_ChannelDetailsZ* operator &() { return &self; } LDKCVec_ChannelDetailsZ* operator ->() { return &self; } const LDKCVec_ChannelDetailsZ* operator &() const { return &self; } @@ -1975,10 +2551,11 @@ class CVec_MessageSendEventZ { LDKCVec_MessageSendEventZ self; public: CVec_MessageSendEventZ(const CVec_MessageSendEventZ&) = delete; - ~CVec_MessageSendEventZ() { CVec_MessageSendEventZ_free(self); } CVec_MessageSendEventZ(CVec_MessageSendEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_MessageSendEventZ)); } CVec_MessageSendEventZ(LDKCVec_MessageSendEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_MessageSendEventZ)); } - operator LDKCVec_MessageSendEventZ() { LDKCVec_MessageSendEventZ res = self; memset(&self, 0, sizeof(LDKCVec_MessageSendEventZ)); return res; } + operator LDKCVec_MessageSendEventZ() && { LDKCVec_MessageSendEventZ res = self; memset(&self, 0, sizeof(LDKCVec_MessageSendEventZ)); return res; } + ~CVec_MessageSendEventZ() { CVec_MessageSendEventZ_free(self); } + CVec_MessageSendEventZ& operator=(CVec_MessageSendEventZ&& o) { CVec_MessageSendEventZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_MessageSendEventZ)); return *this; } LDKCVec_MessageSendEventZ* operator &() { return &self; } LDKCVec_MessageSendEventZ* operator ->() { return &self; } const LDKCVec_MessageSendEventZ* operator &() const { return &self; } @@ -1989,164 +2566,146 @@ class CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ { LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ self; public: CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ(const CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ&) = delete; - ~CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ() { CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(self); } CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ(CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ)); } CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ)); } - operator LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ() { LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ)); return res; } + operator LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ() && { LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ)); return res; } + ~CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ() { CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(self); } + CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ& operator=(CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ&& o) { CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ)); return *this; } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ* operator &() { return &self; } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ* operator ->() { return &self; } const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ* operator &() const { return &self; } const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ* operator ->() const { return &self; } }; -class CResult_NoneAPIErrorZ { +class CVec_UpdateFailHTLCZ { private: - LDKCResult_NoneAPIErrorZ self; + LDKCVec_UpdateFailHTLCZ self; public: - CResult_NoneAPIErrorZ(const CResult_NoneAPIErrorZ&) = delete; - ~CResult_NoneAPIErrorZ() { CResult_NoneAPIErrorZ_free(self); } - CResult_NoneAPIErrorZ(CResult_NoneAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneAPIErrorZ)); } - CResult_NoneAPIErrorZ(LDKCResult_NoneAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); } - operator LDKCResult_NoneAPIErrorZ() { LDKCResult_NoneAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); return res; } - LDKCResult_NoneAPIErrorZ* operator &() { return &self; } - LDKCResult_NoneAPIErrorZ* operator ->() { return &self; } - const LDKCResult_NoneAPIErrorZ* operator &() const { return &self; } - const LDKCResult_NoneAPIErrorZ* operator ->() const { return &self; } + CVec_UpdateFailHTLCZ(const CVec_UpdateFailHTLCZ&) = delete; + CVec_UpdateFailHTLCZ(CVec_UpdateFailHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); } + CVec_UpdateFailHTLCZ(LDKCVec_UpdateFailHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); } + operator LDKCVec_UpdateFailHTLCZ() && { LDKCVec_UpdateFailHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); return res; } + ~CVec_UpdateFailHTLCZ() { CVec_UpdateFailHTLCZ_free(self); } + CVec_UpdateFailHTLCZ& operator=(CVec_UpdateFailHTLCZ&& o) { CVec_UpdateFailHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); return *this; } + LDKCVec_UpdateFailHTLCZ* operator &() { return &self; } + LDKCVec_UpdateFailHTLCZ* operator ->() { return &self; } + const LDKCVec_UpdateFailHTLCZ* operator &() const { return &self; } + const LDKCVec_UpdateFailHTLCZ* operator ->() const { return &self; } }; class C2Tuple_OutPointScriptZ { private: LDKC2Tuple_OutPointScriptZ self; public: C2Tuple_OutPointScriptZ(const C2Tuple_OutPointScriptZ&) = delete; - ~C2Tuple_OutPointScriptZ() { C2Tuple_OutPointScriptZ_free(self); } C2Tuple_OutPointScriptZ(C2Tuple_OutPointScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OutPointScriptZ)); } C2Tuple_OutPointScriptZ(LDKC2Tuple_OutPointScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OutPointScriptZ)); } - operator LDKC2Tuple_OutPointScriptZ() { LDKC2Tuple_OutPointScriptZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OutPointScriptZ)); return res; } + operator LDKC2Tuple_OutPointScriptZ() && { LDKC2Tuple_OutPointScriptZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OutPointScriptZ)); return res; } + ~C2Tuple_OutPointScriptZ() { C2Tuple_OutPointScriptZ_free(self); } + C2Tuple_OutPointScriptZ& operator=(C2Tuple_OutPointScriptZ&& o) { C2Tuple_OutPointScriptZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OutPointScriptZ)); return *this; } LDKC2Tuple_OutPointScriptZ* operator &() { return &self; } LDKC2Tuple_OutPointScriptZ* operator ->() { return &self; } const LDKC2Tuple_OutPointScriptZ* operator &() const { return &self; } const LDKC2Tuple_OutPointScriptZ* operator ->() const { return &self; } }; -class CVec_NetAddressZ { -private: - LDKCVec_NetAddressZ self; -public: - CVec_NetAddressZ(const CVec_NetAddressZ&) = delete; - ~CVec_NetAddressZ() { CVec_NetAddressZ_free(self); } - CVec_NetAddressZ(CVec_NetAddressZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_NetAddressZ)); } - CVec_NetAddressZ(LDKCVec_NetAddressZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_NetAddressZ)); } - operator LDKCVec_NetAddressZ() { LDKCVec_NetAddressZ res = self; memset(&self, 0, sizeof(LDKCVec_NetAddressZ)); return res; } - LDKCVec_NetAddressZ* operator &() { return &self; } - LDKCVec_NetAddressZ* operator ->() { return &self; } - const LDKCVec_NetAddressZ* operator &() const { return &self; } - const LDKCVec_NetAddressZ* operator ->() const { return &self; } -}; -class C2Tuple_usizeTransactionZ { -private: - LDKC2Tuple_usizeTransactionZ self; -public: - C2Tuple_usizeTransactionZ(const C2Tuple_usizeTransactionZ&) = delete; - ~C2Tuple_usizeTransactionZ() { C2Tuple_usizeTransactionZ_free(self); } - C2Tuple_usizeTransactionZ(C2Tuple_usizeTransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_usizeTransactionZ)); } - C2Tuple_usizeTransactionZ(LDKC2Tuple_usizeTransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); } - operator LDKC2Tuple_usizeTransactionZ() { LDKC2Tuple_usizeTransactionZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); return res; } - LDKC2Tuple_usizeTransactionZ* operator &() { return &self; } - LDKC2Tuple_usizeTransactionZ* operator ->() { return &self; } - const LDKC2Tuple_usizeTransactionZ* operator &() const { return &self; } - const LDKC2Tuple_usizeTransactionZ* operator ->() const { return &self; } -}; -class CVec_C2Tuple_usizeTransactionZZ { -private: - LDKCVec_C2Tuple_usizeTransactionZZ self; -public: - CVec_C2Tuple_usizeTransactionZZ(const CVec_C2Tuple_usizeTransactionZZ&) = delete; - ~CVec_C2Tuple_usizeTransactionZZ() { CVec_C2Tuple_usizeTransactionZZ_free(self); } - CVec_C2Tuple_usizeTransactionZZ(CVec_C2Tuple_usizeTransactionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_usizeTransactionZZ)); } - CVec_C2Tuple_usizeTransactionZZ(LDKCVec_C2Tuple_usizeTransactionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_usizeTransactionZZ)); } - operator LDKCVec_C2Tuple_usizeTransactionZZ() { LDKCVec_C2Tuple_usizeTransactionZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_usizeTransactionZZ)); return res; } - LDKCVec_C2Tuple_usizeTransactionZZ* operator &() { return &self; } - LDKCVec_C2Tuple_usizeTransactionZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_usizeTransactionZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_usizeTransactionZZ* operator ->() const { return &self; } -}; -class CVec_TransactionZ { -private: - LDKCVec_TransactionZ self; -public: - CVec_TransactionZ(const CVec_TransactionZ&) = delete; - ~CVec_TransactionZ() { CVec_TransactionZ_free(self); } - CVec_TransactionZ(CVec_TransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TransactionZ)); } - CVec_TransactionZ(LDKCVec_TransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TransactionZ)); } - operator LDKCVec_TransactionZ() { LDKCVec_TransactionZ res = self; memset(&self, 0, sizeof(LDKCVec_TransactionZ)); return res; } - LDKCVec_TransactionZ* operator &() { return &self; } - LDKCVec_TransactionZ* operator ->() { return &self; } - const LDKCVec_TransactionZ* operator &() const { return &self; } - const LDKCVec_TransactionZ* operator ->() const { return &self; } -}; -class CVec_ChannelMonitorZ { -private: - LDKCVec_ChannelMonitorZ self; -public: - CVec_ChannelMonitorZ(const CVec_ChannelMonitorZ&) = delete; - ~CVec_ChannelMonitorZ() { CVec_ChannelMonitorZ_free(self); } - CVec_ChannelMonitorZ(CVec_ChannelMonitorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelMonitorZ)); } - CVec_ChannelMonitorZ(LDKCVec_ChannelMonitorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelMonitorZ)); } - operator LDKCVec_ChannelMonitorZ() { LDKCVec_ChannelMonitorZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelMonitorZ)); return res; } - LDKCVec_ChannelMonitorZ* operator &() { return &self; } - LDKCVec_ChannelMonitorZ* operator ->() { return &self; } - const LDKCVec_ChannelMonitorZ* operator &() const { return &self; } - const LDKCVec_ChannelMonitorZ* operator ->() const { return &self; } -}; -class CVec_UpdateFailHTLCZ { -private: - LDKCVec_UpdateFailHTLCZ self; -public: - CVec_UpdateFailHTLCZ(const CVec_UpdateFailHTLCZ&) = delete; - ~CVec_UpdateFailHTLCZ() { CVec_UpdateFailHTLCZ_free(self); } - CVec_UpdateFailHTLCZ(CVec_UpdateFailHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); } - CVec_UpdateFailHTLCZ(LDKCVec_UpdateFailHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); } - operator LDKCVec_UpdateFailHTLCZ() { LDKCVec_UpdateFailHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); return res; } - LDKCVec_UpdateFailHTLCZ* operator &() { return &self; } - LDKCVec_UpdateFailHTLCZ* operator ->() { return &self; } - const LDKCVec_UpdateFailHTLCZ* operator &() const { return &self; } - const LDKCVec_UpdateFailHTLCZ* operator ->() const { return &self; } +class CResult_InMemoryChannelKeysDecodeErrorZ { +private: + LDKCResult_InMemoryChannelKeysDecodeErrorZ self; +public: + CResult_InMemoryChannelKeysDecodeErrorZ(const CResult_InMemoryChannelKeysDecodeErrorZ&) = delete; + CResult_InMemoryChannelKeysDecodeErrorZ(CResult_InMemoryChannelKeysDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InMemoryChannelKeysDecodeErrorZ)); } + CResult_InMemoryChannelKeysDecodeErrorZ(LDKCResult_InMemoryChannelKeysDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ)); } + operator LDKCResult_InMemoryChannelKeysDecodeErrorZ() && { LDKCResult_InMemoryChannelKeysDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ)); return res; } + ~CResult_InMemoryChannelKeysDecodeErrorZ() { CResult_InMemoryChannelKeysDecodeErrorZ_free(self); } + CResult_InMemoryChannelKeysDecodeErrorZ& operator=(CResult_InMemoryChannelKeysDecodeErrorZ&& o) { CResult_InMemoryChannelKeysDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InMemoryChannelKeysDecodeErrorZ)); return *this; } + LDKCResult_InMemoryChannelKeysDecodeErrorZ* operator &() { return &self; } + LDKCResult_InMemoryChannelKeysDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InMemoryChannelKeysDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InMemoryChannelKeysDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { +private: + LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ self; +public: + CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&) = delete; + CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); } + CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); } + operator LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return res; } + ~CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); } + CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return *this; } + LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() { return &self; } + LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_RouteDecodeErrorZ { +private: + LDKCResult_RouteDecodeErrorZ self; +public: + CResult_RouteDecodeErrorZ(const CResult_RouteDecodeErrorZ&) = delete; + CResult_RouteDecodeErrorZ(CResult_RouteDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteDecodeErrorZ)); } + CResult_RouteDecodeErrorZ(LDKCResult_RouteDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteDecodeErrorZ)); } + operator LDKCResult_RouteDecodeErrorZ() && { LDKCResult_RouteDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteDecodeErrorZ)); return res; } + ~CResult_RouteDecodeErrorZ() { CResult_RouteDecodeErrorZ_free(self); } + CResult_RouteDecodeErrorZ& operator=(CResult_RouteDecodeErrorZ&& o) { CResult_RouteDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteDecodeErrorZ)); return *this; } + LDKCResult_RouteDecodeErrorZ* operator &() { return &self; } + LDKCResult_RouteDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RouteDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RouteDecodeErrorZ* operator ->() const { return &self; } }; class CVec_NodeAnnouncementZ { private: LDKCVec_NodeAnnouncementZ self; public: CVec_NodeAnnouncementZ(const CVec_NodeAnnouncementZ&) = delete; - ~CVec_NodeAnnouncementZ() { CVec_NodeAnnouncementZ_free(self); } CVec_NodeAnnouncementZ(CVec_NodeAnnouncementZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_NodeAnnouncementZ)); } CVec_NodeAnnouncementZ(LDKCVec_NodeAnnouncementZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_NodeAnnouncementZ)); } - operator LDKCVec_NodeAnnouncementZ() { LDKCVec_NodeAnnouncementZ res = self; memset(&self, 0, sizeof(LDKCVec_NodeAnnouncementZ)); return res; } + operator LDKCVec_NodeAnnouncementZ() && { LDKCVec_NodeAnnouncementZ res = self; memset(&self, 0, sizeof(LDKCVec_NodeAnnouncementZ)); return res; } + ~CVec_NodeAnnouncementZ() { CVec_NodeAnnouncementZ_free(self); } + CVec_NodeAnnouncementZ& operator=(CVec_NodeAnnouncementZ&& o) { CVec_NodeAnnouncementZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_NodeAnnouncementZ)); return *this; } LDKCVec_NodeAnnouncementZ* operator &() { return &self; } LDKCVec_NodeAnnouncementZ* operator ->() { return &self; } const LDKCVec_NodeAnnouncementZ* operator &() const { return &self; } const LDKCVec_NodeAnnouncementZ* operator ->() const { return &self; } }; -class C2Tuple_u64u64Z { +class CResult_UnsignedChannelAnnouncementDecodeErrorZ { private: - LDKC2Tuple_u64u64Z self; + LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ self; public: - C2Tuple_u64u64Z(const C2Tuple_u64u64Z&) = delete; - ~C2Tuple_u64u64Z() { C2Tuple_u64u64Z_free(self); } - C2Tuple_u64u64Z(C2Tuple_u64u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u64u64Z)); } - C2Tuple_u64u64Z(LDKC2Tuple_u64u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u64u64Z)); } - operator LDKC2Tuple_u64u64Z() { LDKC2Tuple_u64u64Z res = self; memset(&self, 0, sizeof(LDKC2Tuple_u64u64Z)); return res; } - LDKC2Tuple_u64u64Z* operator &() { return &self; } - LDKC2Tuple_u64u64Z* operator ->() { return &self; } - const LDKC2Tuple_u64u64Z* operator &() const { return &self; } - const LDKC2Tuple_u64u64Z* operator ->() const { return &self; } + CResult_UnsignedChannelAnnouncementDecodeErrorZ(const CResult_UnsignedChannelAnnouncementDecodeErrorZ&) = delete; + CResult_UnsignedChannelAnnouncementDecodeErrorZ(CResult_UnsignedChannelAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedChannelAnnouncementDecodeErrorZ)); } + CResult_UnsignedChannelAnnouncementDecodeErrorZ(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ)); } + operator LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ() && { LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ)); return res; } + ~CResult_UnsignedChannelAnnouncementDecodeErrorZ() { CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(self); } + CResult_UnsignedChannelAnnouncementDecodeErrorZ& operator=(CResult_UnsignedChannelAnnouncementDecodeErrorZ&& o) { CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedChannelAnnouncementDecodeErrorZ)); return *this; } + LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator &() { return &self; } + LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_PongDecodeErrorZ { +private: + LDKCResult_PongDecodeErrorZ self; +public: + CResult_PongDecodeErrorZ(const CResult_PongDecodeErrorZ&) = delete; + CResult_PongDecodeErrorZ(CResult_PongDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); } + CResult_PongDecodeErrorZ(LDKCResult_PongDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); } + operator LDKCResult_PongDecodeErrorZ() && { LDKCResult_PongDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); return res; } + ~CResult_PongDecodeErrorZ() { CResult_PongDecodeErrorZ_free(self); } + CResult_PongDecodeErrorZ& operator=(CResult_PongDecodeErrorZ&& o) { CResult_PongDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); return *this; } + LDKCResult_PongDecodeErrorZ* operator &() { return &self; } + LDKCResult_PongDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PongDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PongDecodeErrorZ* operator ->() const { return &self; } }; class CResult_NoneMonitorUpdateErrorZ { private: LDKCResult_NoneMonitorUpdateErrorZ self; public: CResult_NoneMonitorUpdateErrorZ(const CResult_NoneMonitorUpdateErrorZ&) = delete; - ~CResult_NoneMonitorUpdateErrorZ() { CResult_NoneMonitorUpdateErrorZ_free(self); } CResult_NoneMonitorUpdateErrorZ(CResult_NoneMonitorUpdateErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneMonitorUpdateErrorZ)); } CResult_NoneMonitorUpdateErrorZ(LDKCResult_NoneMonitorUpdateErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneMonitorUpdateErrorZ)); } - operator LDKCResult_NoneMonitorUpdateErrorZ() { LDKCResult_NoneMonitorUpdateErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneMonitorUpdateErrorZ)); return res; } + operator LDKCResult_NoneMonitorUpdateErrorZ() && { LDKCResult_NoneMonitorUpdateErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneMonitorUpdateErrorZ)); return res; } + ~CResult_NoneMonitorUpdateErrorZ() { CResult_NoneMonitorUpdateErrorZ_free(self); } + CResult_NoneMonitorUpdateErrorZ& operator=(CResult_NoneMonitorUpdateErrorZ&& o) { CResult_NoneMonitorUpdateErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneMonitorUpdateErrorZ)); return *this; } LDKCResult_NoneMonitorUpdateErrorZ* operator &() { return &self; } LDKCResult_NoneMonitorUpdateErrorZ* operator ->() { return &self; } const LDKCResult_NoneMonitorUpdateErrorZ* operator &() const { return &self; } diff --git a/lightning-c-bindings/include/rust_types.h b/lightning-c-bindings/include/rust_types.h index 2514c93e4df..68395c7cdef 100644 --- a/lightning-c-bindings/include/rust_types.h +++ b/lightning-c-bindings/include/rust_types.h @@ -1,12 +1,14 @@ #if defined(__GNUC__) #define MUST_USE_STRUCT __attribute__((warn_unused)) +#define MUST_USE_RES __attribute__((warn_unused_result)) #else #define MUST_USE_STRUCT +#define MUST_USE_RES #endif -#if defined(__GNUC__) -#define MUST_USE_RES __attribute__((warn_unused_result)) +#if defined(__clang__) +#define NONNULL_PTR _Nonnull #else -#define MUST_USE_RES +#define NONNULL_PTR #endif struct nativeChannelHandshakeConfigOpaque; typedef struct nativeChannelHandshakeConfigOpaque LDKnativeChannelHandshakeConfig; diff --git a/lightning-c-bindings/src/c_types/derived.rs b/lightning-c-bindings/src/c_types/derived.rs index cd511dea05b..3a7ef9aaf30 100644 --- a/lightning-c-bindings/src/c_types/derived.rs +++ b/lightning-c-bindings/src/c_types/derived.rs @@ -38,6 +38,17 @@ pub type CVec_MonitorEventZ = crate::c_types::CVecTempl; +pub type CResult_ChannelMonitorUpdateDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_ChannelMonitorUpdateDecodeErrorZ_free: extern "C" fn(CResult_ChannelMonitorUpdateDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_ChannelMonitorUpdateDecodeErrorZ_ok: extern "C" fn (crate::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_ChannelMonitorUpdateDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ = + crate::c_types::CResultTempl::::err; + pub type CResult_NoneMonitorUpdateErrorZ = crate::c_types::CResultTempl; #[no_mangle] pub static CResult_NoneMonitorUpdateErrorZ_free: extern "C" fn(CResult_NoneMonitorUpdateErrorZ) = crate::c_types::CResultTempl_free::; @@ -86,6 +97,25 @@ pub type CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ = crate::c_types::CVecTempl< #[no_mangle] pub static CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free: extern "C" fn(CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ) = crate::c_types::CVecTempl_free::>>>; +pub type C2Tuple_BlockHashChannelMonitorZ = crate::c_types::C2TupleTempl; +#[no_mangle] +pub static C2Tuple_BlockHashChannelMonitorZ_free: extern "C" fn(C2Tuple_BlockHashChannelMonitorZ) = crate::c_types::C2TupleTempl_free::; +#[no_mangle] +pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ { + C2Tuple_BlockHashChannelMonitorZ { a, b, } +} + +pub type CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ = crate::c_types::CResultTempl, crate::ln::msgs::DecodeError>; +#[no_mangle] +pub static CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free: extern "C" fn(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) = crate::c_types::CResultTempl_free::, crate::ln::msgs::DecodeError>; +#[no_mangle] +pub static CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok: extern "C" fn (C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ = + crate::c_types::CResultTempl::, crate::ln::msgs::DecodeError>::ok; + +#[no_mangle] +pub static CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ = + crate::c_types::CResultTempl::, crate::ln::msgs::DecodeError>::err; + pub type C2Tuple_u64u64Z = crate::c_types::C2TupleTempl; #[no_mangle] pub static C2Tuple_u64u64Z_free: extern "C" fn(C2Tuple_u64u64Z) = crate::c_types::C2TupleTempl_free::; @@ -94,6 +124,17 @@ pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z { C2Tuple_u64u64Z { a, b, } } +pub type CResult_SpendableOutputDescriptorDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_SpendableOutputDescriptorDecodeErrorZ_free: extern "C" fn(CResult_SpendableOutputDescriptorDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_SpendableOutputDescriptorDecodeErrorZ_ok: extern "C" fn (crate::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_SpendableOutputDescriptorDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ = + crate::c_types::CResultTempl::::err; + pub type CVec_SignatureZ = crate::c_types::CVecTempl; #[no_mangle] pub static CVec_SignatureZ_free: extern "C" fn(CVec_SignatureZ) = crate::c_types::CVecTempl_free::; @@ -141,6 +182,17 @@ pub static CResult_ChanKeySignerDecodeErrorZ_ok: extern "C" fn (crate::chain::ke pub static CResult_ChanKeySignerDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_ChanKeySignerDecodeErrorZ = crate::c_types::CResultTempl::::err; +pub type CResult_InMemoryChannelKeysDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_InMemoryChannelKeysDecodeErrorZ_free: extern "C" fn(CResult_InMemoryChannelKeysDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_InMemoryChannelKeysDecodeErrorZ_ok: extern "C" fn (crate::chain::keysinterface::InMemoryChannelKeys) -> CResult_InMemoryChannelKeysDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_InMemoryChannelKeysDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_InMemoryChannelKeysDecodeErrorZ = + crate::c_types::CResultTempl::::err; + pub type CResult_TxOutAccessErrorZ = crate::c_types::CResultTempl; #[no_mangle] pub static CResult_TxOutAccessErrorZ_free: extern "C" fn(CResult_TxOutAccessErrorZ) = crate::c_types::CResultTempl_free::; @@ -188,6 +240,47 @@ pub type CVec_ChannelMonitorZ = crate::c_types::CVecTempl; +pub type C2Tuple_BlockHashChannelManagerZ = crate::c_types::C2TupleTempl; +#[no_mangle] +pub static C2Tuple_BlockHashChannelManagerZ_free: extern "C" fn(C2Tuple_BlockHashChannelManagerZ) = crate::c_types::C2TupleTempl_free::; +#[no_mangle] +pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ { + C2Tuple_BlockHashChannelManagerZ { a, b, } +} + +pub type CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ = crate::c_types::CResultTempl, crate::ln::msgs::DecodeError>; +#[no_mangle] +pub static CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free: extern "C" fn(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) = crate::c_types::CResultTempl_free::, crate::ln::msgs::DecodeError>; +#[no_mangle] +pub static CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok: extern "C" fn (C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ = + crate::c_types::CResultTempl::, crate::ln::msgs::DecodeError>::ok; + +#[no_mangle] +pub static CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ = + crate::c_types::CResultTempl::, crate::ln::msgs::DecodeError>::err; + +pub type CResult_NetAddressu8Z = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_NetAddressu8Z_free: extern "C" fn(CResult_NetAddressu8Z) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_NetAddressu8Z_ok: extern "C" fn (crate::ln::msgs::NetAddress) -> CResult_NetAddressu8Z = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_NetAddressu8Z_err: extern "C" fn (u8) -> CResult_NetAddressu8Z = + crate::c_types::CResultTempl::::err; + +pub type CResult_CResult_NetAddressu8ZDecodeErrorZ = crate::c_types::CResultTempl, crate::ln::msgs::DecodeError>; +#[no_mangle] +pub static CResult_CResult_NetAddressu8ZDecodeErrorZ_free: extern "C" fn(CResult_CResult_NetAddressu8ZDecodeErrorZ) = crate::c_types::CResultTempl_free::, crate::ln::msgs::DecodeError>; +#[no_mangle] +pub static CResult_CResult_NetAddressu8ZDecodeErrorZ_ok: extern "C" fn (CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ = + crate::c_types::CResultTempl::, crate::ln::msgs::DecodeError>::ok; + +#[no_mangle] +pub static CResult_CResult_NetAddressu8ZDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ = + crate::c_types::CResultTempl::, crate::ln::msgs::DecodeError>::err; + pub type CVec_u64Z = crate::c_types::CVecTempl; #[no_mangle] pub static CVec_u64Z_free: extern "C" fn(CVec_u64Z) = crate::c_types::CVecTempl_free::; @@ -247,6 +340,149 @@ pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningError pub static CResult_NoneLightningErrorZ_err: extern "C" fn (crate::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ = crate::c_types::CResultTempl::::err; +pub type CResult_ChannelReestablishDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_ChannelReestablishDecodeErrorZ_free: extern "C" fn(CResult_ChannelReestablishDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_ChannelReestablishDecodeErrorZ_ok: extern "C" fn (crate::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_ChannelReestablishDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_InitDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_InitDecodeErrorZ_free: extern "C" fn(CResult_InitDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_InitDecodeErrorZ_ok: extern "C" fn (crate::ln::msgs::Init) -> CResult_InitDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_InitDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_PingDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_PingDecodeErrorZ_free: extern "C" fn(CResult_PingDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_PingDecodeErrorZ_ok: extern "C" fn (crate::ln::msgs::Ping) -> CResult_PingDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_PingDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_PongDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_PongDecodeErrorZ_free: extern "C" fn(CResult_PongDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_PongDecodeErrorZ_ok: extern "C" fn (crate::ln::msgs::Pong) -> CResult_PongDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_PongDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_UnsignedChannelAnnouncementDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_UnsignedChannelAnnouncementDecodeErrorZ_free: extern "C" fn(CResult_UnsignedChannelAnnouncementDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok: extern "C" fn (crate::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_UnsignedChannelAnnouncementDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_UnsignedChannelUpdateDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_UnsignedChannelUpdateDecodeErrorZ_free: extern "C" fn(CResult_UnsignedChannelUpdateDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_UnsignedChannelUpdateDecodeErrorZ_ok: extern "C" fn (crate::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_UnsignedChannelUpdateDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_ErrorMessageDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_ErrorMessageDecodeErrorZ_free: extern "C" fn(CResult_ErrorMessageDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_ErrorMessageDecodeErrorZ_ok: extern "C" fn (crate::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_ErrorMessageDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_UnsignedNodeAnnouncementDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_UnsignedNodeAnnouncementDecodeErrorZ_free: extern "C" fn(CResult_UnsignedNodeAnnouncementDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok: extern "C" fn (crate::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_UnsignedNodeAnnouncementDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_QueryShortChannelIdsDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_QueryShortChannelIdsDecodeErrorZ_free: extern "C" fn(CResult_QueryShortChannelIdsDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_QueryShortChannelIdsDecodeErrorZ_ok: extern "C" fn (crate::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_QueryShortChannelIdsDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_ReplyShortChannelIdsEndDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_ReplyShortChannelIdsEndDecodeErrorZ_free: extern "C" fn(CResult_ReplyShortChannelIdsEndDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok: extern "C" fn (crate::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_ReplyShortChannelIdsEndDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_QueryChannelRangeDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_QueryChannelRangeDecodeErrorZ_free: extern "C" fn(CResult_QueryChannelRangeDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_QueryChannelRangeDecodeErrorZ_ok: extern "C" fn (crate::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_QueryChannelRangeDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_ReplyChannelRangeDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_ReplyChannelRangeDecodeErrorZ_free: extern "C" fn(CResult_ReplyChannelRangeDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_ReplyChannelRangeDecodeErrorZ_ok: extern "C" fn (crate::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_ReplyChannelRangeDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_GossipTimestampFilterDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_GossipTimestampFilterDecodeErrorZ_free: extern "C" fn(CResult_GossipTimestampFilterDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_GossipTimestampFilterDecodeErrorZ_ok: extern "C" fn (crate::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_GossipTimestampFilterDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ = + crate::c_types::CResultTempl::::err; + pub type CVec_PublicKeyZ = crate::c_types::CVecTempl; #[no_mangle] pub static CVec_PublicKeyZ_free: extern "C" fn(CVec_PublicKeyZ) = crate::c_types::CVecTempl_free::; @@ -354,6 +590,17 @@ pub type CVec_CVec_RouteHopZZ = crate::c_types::CVecTempl>; +pub type CResult_RouteDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_RouteDecodeErrorZ_free: extern "C" fn(CResult_RouteDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_RouteDecodeErrorZ_ok: extern "C" fn (crate::routing::router::Route) -> CResult_RouteDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_RouteDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ = + crate::c_types::CResultTempl::::err; + pub type CVec_RouteHintZ = crate::c_types::CVecTempl; #[no_mangle] pub static CVec_RouteHintZ_free: extern "C" fn(CVec_RouteHintZ) = crate::c_types::CVecTempl_free::; @@ -369,3 +616,47 @@ pub static CResult_RouteLightningErrorZ_ok: extern "C" fn (crate::routing::route pub static CResult_RouteLightningErrorZ_err: extern "C" fn (crate::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ = crate::c_types::CResultTempl::::err; +pub type CResult_RoutingFeesDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_RoutingFeesDecodeErrorZ_free: extern "C" fn(CResult_RoutingFeesDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_RoutingFeesDecodeErrorZ_ok: extern "C" fn (crate::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_RoutingFeesDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_NodeAnnouncementInfoDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_NodeAnnouncementInfoDecodeErrorZ_free: extern "C" fn(CResult_NodeAnnouncementInfoDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_NodeAnnouncementInfoDecodeErrorZ_ok: extern "C" fn (crate::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_NodeAnnouncementInfoDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_NodeInfoDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_NodeInfoDecodeErrorZ_free: extern "C" fn(CResult_NodeInfoDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_NodeInfoDecodeErrorZ_ok: extern "C" fn (crate::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_NodeInfoDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ = + crate::c_types::CResultTempl::::err; + +pub type CResult_NetworkGraphDecodeErrorZ = crate::c_types::CResultTempl; +#[no_mangle] +pub static CResult_NetworkGraphDecodeErrorZ_free: extern "C" fn(CResult_NetworkGraphDecodeErrorZ) = crate::c_types::CResultTempl_free::; +#[no_mangle] +pub static CResult_NetworkGraphDecodeErrorZ_ok: extern "C" fn (crate::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ = + crate::c_types::CResultTempl::::ok; + +#[no_mangle] +pub static CResult_NetworkGraphDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ = + crate::c_types::CResultTempl::::err; + diff --git a/lightning-c-bindings/src/chain/chainmonitor.rs b/lightning-c-bindings/src/chain/chainmonitor.rs index a0a1b76218b..98543fd13f6 100644 --- a/lightning-c-bindings/src/chain/chainmonitor.rs +++ b/lightning-c-bindings/src/chain/chainmonitor.rs @@ -128,7 +128,7 @@ impl From for crate::chain::Watch { } } #[no_mangle] -pub extern "C" fn ChainMonitor_as_Watch(this_arg: *const ChainMonitor) -> crate::chain::Watch { +pub extern "C" fn ChainMonitor_as_Watch(this_arg: &ChainMonitor) -> crate::chain::Watch { crate::chain::Watch { this_arg: unsafe { (*this_arg).inner as *mut c_void }, free: None, @@ -168,7 +168,7 @@ impl From for crate::util::events::EventsProvider { } } #[no_mangle] -pub extern "C" fn ChainMonitor_as_EventsProvider(this_arg: *const ChainMonitor) -> crate::util::events::EventsProvider { +pub extern "C" fn ChainMonitor_as_EventsProvider(this_arg: &ChainMonitor) -> crate::util::events::EventsProvider { crate::util::events::EventsProvider { this_arg: unsafe { (*this_arg).inner as *mut c_void }, free: None, diff --git a/lightning-c-bindings/src/chain/channelmonitor.rs b/lightning-c-bindings/src/chain/channelmonitor.rs index 8868125162a..111dff174c8 100644 --- a/lightning-c-bindings/src/chain/channelmonitor.rs +++ b/lightning-c-bindings/src/chain/channelmonitor.rs @@ -112,20 +112,18 @@ pub extern "C" fn ChannelMonitorUpdate_set_update_id(this_ptr: &mut ChannelMonit #[no_mangle] pub static CLOSED_CHANNEL_UPDATE_ID: u64 = lightning::chain::channelmonitor::CLOSED_CHANNEL_UPDATE_ID; #[no_mangle] -pub extern "C" fn ChannelMonitorUpdate_write(obj: *const ChannelMonitorUpdate) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn ChannelMonitorUpdate_write(obj: &ChannelMonitorUpdate) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn ChannelMonitorUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelMonitorUpdate) }) } #[no_mangle] -pub extern "C" fn ChannelMonitorUpdate_read(ser: crate::c_types::u8slice) -> ChannelMonitorUpdate { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - ChannelMonitorUpdate { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - ChannelMonitorUpdate { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn ChannelMonitorUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelMonitorUpdateDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::chain::channelmonitor::ChannelMonitorUpdate { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } /// An error enum representing a failure to persist a channel monitor update. #[must_use] @@ -381,7 +379,7 @@ pub extern "C" fn HTLCUpdate_clone(orig: &HTLCUpdate) -> HTLCUpdate { HTLCUpdate { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true } } #[no_mangle] -pub extern "C" fn HTLCUpdate_write(obj: *const HTLCUpdate) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn HTLCUpdate_write(obj: &HTLCUpdate) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -449,6 +447,14 @@ impl ChannelMonitor { ret } } +#[no_mangle] +pub extern "C" fn ChannelMonitor_write(obj: &ChannelMonitor) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) +} +#[no_mangle] +pub(crate) extern "C" fn ChannelMonitor_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelMonitor) }) +} /// Updates a ChannelMonitor on the basis of some new information provided by the Channel /// itself. /// @@ -642,3 +648,10 @@ impl Drop for Persist { } } } +#[no_mangle] +pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_read(ser: crate::c_types::u8slice, arg: &crate::chain::keysinterface::KeysInterface) -> crate::c_types::derived::CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { + let arg_conv = arg; + let res: Result<(bitcoin::hash_types::BlockHash, lightning::chain::channelmonitor::ChannelMonitor), lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_res_0_0, mut orig_res_0_1) = o; let mut local_res_0 = (crate::c_types::ThirtyTwoBytes { data: orig_res_0_0.into_inner() }, crate::chain::channelmonitor::ChannelMonitor { inner: Box::into_raw(Box::new(orig_res_0_1)), is_owned: true }).into(); local_res_0 }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res +} diff --git a/lightning-c-bindings/src/chain/keysinterface.rs b/lightning-c-bindings/src/chain/keysinterface.rs index 285d90ba099..5cac8a643a3 100644 --- a/lightning-c-bindings/src/chain/keysinterface.rs +++ b/lightning-c-bindings/src/chain/keysinterface.rs @@ -224,6 +224,16 @@ pub extern "C" fn SpendableOutputDescriptor_free(this_ptr: SpendableOutputDescri pub extern "C" fn SpendableOutputDescriptor_clone(orig: &SpendableOutputDescriptor) -> SpendableOutputDescriptor { orig.clone() } +#[no_mangle] +pub extern "C" fn SpendableOutputDescriptor_write(obj: &SpendableOutputDescriptor) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) +} +#[no_mangle] +pub extern "C" fn SpendableOutputDescriptor_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_SpendableOutputDescriptorDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::chain::keysinterface::SpendableOutputDescriptor::native_into(o) }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res +} /// Set of lightning keys needed to operate a channel as described in BOLT 3. /// /// Signing services could be implemented on a hardware wallet. In this case, @@ -762,7 +772,7 @@ impl From for crate::chain::keysinterface::ChannelKey } } #[no_mangle] -pub extern "C" fn InMemoryChannelKeys_as_ChannelKeys(this_arg: *const InMemoryChannelKeys) -> crate::chain::keysinterface::ChannelKeys { +pub extern "C" fn InMemoryChannelKeys_as_ChannelKeys(this_arg: &InMemoryChannelKeys) -> crate::chain::keysinterface::ChannelKeys { crate::chain::keysinterface::ChannelKeys { this_arg: unsafe { (*this_arg).inner as *mut c_void }, free: None, @@ -854,20 +864,18 @@ extern "C" fn InMemoryChannelKeys_ChannelKeys_ready_channel(this_arg: *mut c_voi } #[no_mangle] -pub extern "C" fn InMemoryChannelKeys_write(obj: *const InMemoryChannelKeys) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn InMemoryChannelKeys_write(obj: &InMemoryChannelKeys) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn InMemoryChannelKeys_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInMemoryChannelKeys) }) } #[no_mangle] -pub extern "C" fn InMemoryChannelKeys_read(ser: crate::c_types::u8slice) -> InMemoryChannelKeys { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - InMemoryChannelKeys { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - InMemoryChannelKeys { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn InMemoryChannelKeys_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InMemoryChannelKeysDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::chain::keysinterface::InMemoryChannelKeys { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } use lightning::chain::keysinterface::KeysManager as nativeKeysManagerImport; @@ -962,7 +970,7 @@ impl From for crate::chain::keysinterface::KeysInterface { } } #[no_mangle] -pub extern "C" fn KeysManager_as_KeysInterface(this_arg: *const KeysManager) -> crate::chain::keysinterface::KeysInterface { +pub extern "C" fn KeysManager_as_KeysInterface(this_arg: &KeysManager) -> crate::chain::keysinterface::KeysInterface { crate::chain::keysinterface::KeysInterface { this_arg: unsafe { (*this_arg).inner as *mut c_void }, free: None, diff --git a/lightning-c-bindings/src/chain/transaction.rs b/lightning-c-bindings/src/chain/transaction.rs index ff7aff7e9f5..d66709010e8 100644 --- a/lightning-c-bindings/src/chain/transaction.rs +++ b/lightning-c-bindings/src/chain/transaction.rs @@ -101,7 +101,7 @@ pub extern "C" fn OutPoint_to_channel_id(this_arg: &OutPoint) -> crate::c_types: } #[no_mangle] -pub extern "C" fn OutPoint_write(obj: *const OutPoint) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn OutPoint_write(obj: &OutPoint) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] diff --git a/lightning-c-bindings/src/ln/chan_utils.rs b/lightning-c-bindings/src/ln/chan_utils.rs index 5bd27207062..64919ce887f 100644 --- a/lightning-c-bindings/src/ln/chan_utils.rs +++ b/lightning-c-bindings/src/ln/chan_utils.rs @@ -208,7 +208,7 @@ pub extern "C" fn TxCreationKeys_new(mut per_commitment_point_arg: crate::c_type })), is_owned: true } } #[no_mangle] -pub extern "C" fn TxCreationKeys_write(obj: *const TxCreationKeys) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn TxCreationKeys_write(obj: &TxCreationKeys) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -363,7 +363,7 @@ pub extern "C" fn ChannelPublicKeys_new(mut funding_pubkey_arg: crate::c_types:: })), is_owned: true } } #[no_mangle] -pub extern "C" fn ChannelPublicKeys_write(obj: *const ChannelPublicKeys) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelPublicKeys_write(obj: &ChannelPublicKeys) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -515,7 +515,7 @@ pub extern "C" fn HTLCOutputInCommitment_set_payment_hash(this_ptr: &mut HTLCOut unsafe { &mut *this_ptr.inner }.payment_hash = ::lightning::ln::channelmanager::PaymentHash(val.data); } #[no_mangle] -pub extern "C" fn HTLCOutputInCommitment_write(obj: *const HTLCOutputInCommitment) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn HTLCOutputInCommitment_write(obj: &HTLCOutputInCommitment) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -805,7 +805,7 @@ pub extern "C" fn ChannelTransactionParameters_as_counterparty_broadcastable(thi } #[no_mangle] -pub extern "C" fn CounterpartyChannelTransactionParameters_write(obj: *const CounterpartyChannelTransactionParameters) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn CounterpartyChannelTransactionParameters_write(obj: &CounterpartyChannelTransactionParameters) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -821,7 +821,7 @@ pub extern "C" fn CounterpartyChannelTransactionParameters_read(ser: crate::c_ty } } #[no_mangle] -pub extern "C" fn ChannelTransactionParameters_write(obj: *const ChannelTransactionParameters) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelTransactionParameters_write(obj: &ChannelTransactionParameters) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -997,7 +997,7 @@ pub extern "C" fn HolderCommitmentTransaction_set_counterparty_htlc_sigs(this_pt unsafe { &mut *this_ptr.inner }.counterparty_htlc_sigs = local_val; } #[no_mangle] -pub extern "C" fn HolderCommitmentTransaction_write(obj: *const HolderCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn HolderCommitmentTransaction_write(obj: &HolderCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -1115,7 +1115,7 @@ pub extern "C" fn BuiltCommitmentTransaction_new(mut transaction_arg: crate::c_t })), is_owned: true } } #[no_mangle] -pub extern "C" fn BuiltCommitmentTransaction_write(obj: *const BuiltCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn BuiltCommitmentTransaction_write(obj: &BuiltCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -1210,7 +1210,7 @@ pub extern "C" fn CommitmentTransaction_clone(orig: &CommitmentTransaction) -> C CommitmentTransaction { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true } } #[no_mangle] -pub extern "C" fn CommitmentTransaction_write(obj: *const CommitmentTransaction) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn CommitmentTransaction_write(obj: &CommitmentTransaction) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] diff --git a/lightning-c-bindings/src/ln/channelmanager.rs b/lightning-c-bindings/src/ln/channelmanager.rs index 57570d9f2d1..f139e28ba09 100644 --- a/lightning-c-bindings/src/ln/channelmanager.rs +++ b/lightning-c-bindings/src/ln/channelmanager.rs @@ -570,7 +570,7 @@ impl From for crate::util::events::MessageSendEventsProvid } } #[no_mangle] -pub extern "C" fn ChannelManager_as_MessageSendEventsProvider(this_arg: *const ChannelManager) -> crate::util::events::MessageSendEventsProvider { +pub extern "C" fn ChannelManager_as_MessageSendEventsProvider(this_arg: &ChannelManager) -> crate::util::events::MessageSendEventsProvider { crate::util::events::MessageSendEventsProvider { this_arg: unsafe { (*this_arg).inner as *mut c_void }, free: None, @@ -596,7 +596,7 @@ impl From for crate::util::events::EventsProvider { } } #[no_mangle] -pub extern "C" fn ChannelManager_as_EventsProvider(this_arg: *const ChannelManager) -> crate::util::events::EventsProvider { +pub extern "C" fn ChannelManager_as_EventsProvider(this_arg: &ChannelManager) -> crate::util::events::EventsProvider { crate::util::events::EventsProvider { this_arg: unsafe { (*this_arg).inner as *mut c_void }, free: None, @@ -638,7 +638,7 @@ impl From for crate::ln::msgs::ChannelMessageHandler { } } #[no_mangle] -pub extern "C" fn ChannelManager_as_ChannelMessageHandler(this_arg: *const ChannelManager) -> crate::ln::msgs::ChannelMessageHandler { +pub extern "C" fn ChannelManager_as_ChannelMessageHandler(this_arg: &ChannelManager) -> crate::ln::msgs::ChannelMessageHandler { crate::ln::msgs::ChannelMessageHandler { this_arg: unsafe { (*this_arg).inner as *mut c_void }, free: None, @@ -734,6 +734,14 @@ extern "C" fn ChannelManager_ChannelMessageHandler_get_and_clear_pending_msg_eve local_ret.into() } +#[no_mangle] +pub extern "C" fn ChannelManager_write(obj: &ChannelManager) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) +} +#[no_mangle] +pub(crate) extern "C" fn ChannelManager_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelManager) }) +} use lightning::ln::channelmanager::ChannelManagerReadArgs as nativeChannelManagerReadArgsImport; type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImport<'static, crate::chain::keysinterface::ChannelKeys, crate::chain::Watch, crate::chain::chaininterface::BroadcasterInterface, crate::chain::keysinterface::KeysInterface, crate::chain::chaininterface::FeeEstimator, crate::util::logger::Logger>; @@ -886,3 +894,10 @@ pub extern "C" fn ChannelManagerReadArgs_new(mut keys_manager: crate::chain::key ChannelManagerReadArgs { inner: Box::into_raw(Box::new(ret)), is_owned: true } } +#[no_mangle] +pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_read(ser: crate::c_types::u8slice, arg: crate::ln::channelmanager::ChannelManagerReadArgs) -> crate::c_types::derived::CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { + let arg_conv = *unsafe { Box::from_raw(arg.take_inner()) }; + let res: Result<(bitcoin::hash_types::BlockHash, lightning::ln::channelmanager::ChannelManager), lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_res_0_0, mut orig_res_0_1) = o; let mut local_res_0 = (crate::c_types::ThirtyTwoBytes { data: orig_res_0_0.into_inner() }, crate::ln::channelmanager::ChannelManager { inner: Box::into_raw(Box::new(orig_res_0_1)), is_owned: true }).into(); local_res_0 }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res +} diff --git a/lightning-c-bindings/src/ln/msgs.rs b/lightning-c-bindings/src/ln/msgs.rs index 3680c2ac2ee..071b2907dc4 100644 --- a/lightning-c-bindings/src/ln/msgs.rs +++ b/lightning-c-bindings/src/ln/msgs.rs @@ -2407,6 +2407,16 @@ pub extern "C" fn NetAddress_free(this_ptr: NetAddress) { } pub extern "C" fn NetAddress_clone(orig: &NetAddress) -> NetAddress { orig.clone() } +#[no_mangle] +pub extern "C" fn NetAddress_write(obj: &NetAddress) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) +} +#[no_mangle] +pub extern "C" fn Result_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CResult_NetAddressu8ZDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = match o { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::NetAddress::native_into(o) }), Err(mut e) => crate::c_types::CResultTempl::err( { e }) }; local_res_0 }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res +} use lightning::ln::msgs::UnsignedNodeAnnouncement as nativeUnsignedNodeAnnouncementImport; type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport; @@ -4292,7 +4302,7 @@ impl Drop for RoutingMessageHandler { } } #[no_mangle] -pub extern "C" fn AcceptChannel_write(obj: *const AcceptChannel) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn AcceptChannel_write(obj: &AcceptChannel) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4308,7 +4318,7 @@ pub extern "C" fn AcceptChannel_read(ser: crate::c_types::u8slice) -> AcceptChan } } #[no_mangle] -pub extern "C" fn AnnouncementSignatures_write(obj: *const AnnouncementSignatures) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn AnnouncementSignatures_write(obj: &AnnouncementSignatures) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4324,23 +4334,21 @@ pub extern "C" fn AnnouncementSignatures_read(ser: crate::c_types::u8slice) -> A } } #[no_mangle] -pub extern "C" fn ChannelReestablish_write(obj: *const ChannelReestablish) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn ChannelReestablish_write(obj: &ChannelReestablish) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn ChannelReestablish_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelReestablish) }) } #[no_mangle] -pub extern "C" fn ChannelReestablish_read(ser: crate::c_types::u8slice) -> ChannelReestablish { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - ChannelReestablish { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - ChannelReestablish { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn ChannelReestablish_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelReestablishDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ChannelReestablish { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn ClosingSigned_write(obj: *const ClosingSigned) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ClosingSigned_write(obj: &ClosingSigned) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4356,7 +4364,7 @@ pub extern "C" fn ClosingSigned_read(ser: crate::c_types::u8slice) -> ClosingSig } } #[no_mangle] -pub extern "C" fn CommitmentSigned_write(obj: *const CommitmentSigned) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn CommitmentSigned_write(obj: &CommitmentSigned) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4372,7 +4380,7 @@ pub extern "C" fn CommitmentSigned_read(ser: crate::c_types::u8slice) -> Commitm } } #[no_mangle] -pub extern "C" fn FundingCreated_write(obj: *const FundingCreated) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn FundingCreated_write(obj: &FundingCreated) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4388,7 +4396,7 @@ pub extern "C" fn FundingCreated_read(ser: crate::c_types::u8slice) -> FundingCr } } #[no_mangle] -pub extern "C" fn FundingSigned_write(obj: *const FundingSigned) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn FundingSigned_write(obj: &FundingSigned) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4404,7 +4412,7 @@ pub extern "C" fn FundingSigned_read(ser: crate::c_types::u8slice) -> FundingSig } } #[no_mangle] -pub extern "C" fn FundingLocked_write(obj: *const FundingLocked) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn FundingLocked_write(obj: &FundingLocked) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4420,23 +4428,21 @@ pub extern "C" fn FundingLocked_read(ser: crate::c_types::u8slice) -> FundingLoc } } #[no_mangle] -pub extern "C" fn Init_write(obj: *const Init) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn Init_write(obj: &Init) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn Init_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInit) }) } #[no_mangle] -pub extern "C" fn Init_read(ser: crate::c_types::u8slice) -> Init { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - Init { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - Init { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn Init_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::Init { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn OpenChannel_write(obj: *const OpenChannel) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn OpenChannel_write(obj: &OpenChannel) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4452,7 +4458,7 @@ pub extern "C" fn OpenChannel_read(ser: crate::c_types::u8slice) -> OpenChannel } } #[no_mangle] -pub extern "C" fn RevokeAndACK_write(obj: *const RevokeAndACK) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn RevokeAndACK_write(obj: &RevokeAndACK) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4468,7 +4474,7 @@ pub extern "C" fn RevokeAndACK_read(ser: crate::c_types::u8slice) -> RevokeAndAC } } #[no_mangle] -pub extern "C" fn Shutdown_write(obj: *const Shutdown) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn Shutdown_write(obj: &Shutdown) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4484,7 +4490,7 @@ pub extern "C" fn Shutdown_read(ser: crate::c_types::u8slice) -> Shutdown { } } #[no_mangle] -pub extern "C" fn UpdateFailHTLC_write(obj: *const UpdateFailHTLC) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn UpdateFailHTLC_write(obj: &UpdateFailHTLC) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4500,7 +4506,7 @@ pub extern "C" fn UpdateFailHTLC_read(ser: crate::c_types::u8slice) -> UpdateFai } } #[no_mangle] -pub extern "C" fn UpdateFailMalformedHTLC_write(obj: *const UpdateFailMalformedHTLC) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn UpdateFailMalformedHTLC_write(obj: &UpdateFailMalformedHTLC) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4516,7 +4522,7 @@ pub extern "C" fn UpdateFailMalformedHTLC_read(ser: crate::c_types::u8slice) -> } } #[no_mangle] -pub extern "C" fn UpdateFee_write(obj: *const UpdateFee) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn UpdateFee_write(obj: &UpdateFee) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4532,7 +4538,7 @@ pub extern "C" fn UpdateFee_read(ser: crate::c_types::u8slice) -> UpdateFee { } } #[no_mangle] -pub extern "C" fn UpdateFulfillHTLC_write(obj: *const UpdateFulfillHTLC) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn UpdateFulfillHTLC_write(obj: &UpdateFulfillHTLC) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4548,7 +4554,7 @@ pub extern "C" fn UpdateFulfillHTLC_read(ser: crate::c_types::u8slice) -> Update } } #[no_mangle] -pub extern "C" fn UpdateAddHTLC_write(obj: *const UpdateAddHTLC) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn UpdateAddHTLC_write(obj: &UpdateAddHTLC) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4564,55 +4570,49 @@ pub extern "C" fn UpdateAddHTLC_read(ser: crate::c_types::u8slice) -> UpdateAddH } } #[no_mangle] -pub extern "C" fn Ping_write(obj: *const Ping) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn Ping_write(obj: &Ping) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn Ping_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePing) }) } #[no_mangle] -pub extern "C" fn Ping_read(ser: crate::c_types::u8slice) -> Ping { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - Ping { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - Ping { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn Ping_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PingDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::Ping { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn Pong_write(obj: *const Pong) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn Pong_write(obj: &Pong) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn Pong_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePong) }) } #[no_mangle] -pub extern "C" fn Pong_read(ser: crate::c_types::u8slice) -> Pong { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - Pong { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - Pong { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn Pong_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PongDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::Pong { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_write(obj: *const UnsignedChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn UnsignedChannelAnnouncement_write(obj: &UnsignedChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn UnsignedChannelAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedChannelAnnouncement) }) } #[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_read(ser: crate::c_types::u8slice) -> UnsignedChannelAnnouncement { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - UnsignedChannelAnnouncement { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - UnsignedChannelAnnouncement { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn UnsignedChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelAnnouncementDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UnsignedChannelAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn ChannelAnnouncement_write(obj: *const ChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelAnnouncement_write(obj: &ChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4628,23 +4628,21 @@ pub extern "C" fn ChannelAnnouncement_read(ser: crate::c_types::u8slice) -> Chan } } #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_write(obj: *const UnsignedChannelUpdate) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn UnsignedChannelUpdate_write(obj: &UnsignedChannelUpdate) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn UnsignedChannelUpdate_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedChannelUpdate) }) } #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_read(ser: crate::c_types::u8slice) -> UnsignedChannelUpdate { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - UnsignedChannelUpdate { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - UnsignedChannelUpdate { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn UnsignedChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelUpdateDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UnsignedChannelUpdate { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn ChannelUpdate_write(obj: *const ChannelUpdate) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelUpdate_write(obj: &ChannelUpdate) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4660,39 +4658,35 @@ pub extern "C" fn ChannelUpdate_read(ser: crate::c_types::u8slice) -> ChannelUpd } } #[no_mangle] -pub extern "C" fn ErrorMessage_write(obj: *const ErrorMessage) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn ErrorMessage_write(obj: &ErrorMessage) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn ErrorMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeErrorMessage) }) } #[no_mangle] -pub extern "C" fn ErrorMessage_read(ser: crate::c_types::u8slice) -> ErrorMessage { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - ErrorMessage { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - ErrorMessage { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn ErrorMessage_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ErrorMessageDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_write(obj: *const UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn UnsignedNodeAnnouncement_write(obj: &UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn UnsignedNodeAnnouncement_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedNodeAnnouncement) }) } #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_read(ser: crate::c_types::u8slice) -> UnsignedNodeAnnouncement { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - UnsignedNodeAnnouncement { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - UnsignedNodeAnnouncement { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn UnsignedNodeAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedNodeAnnouncementDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::UnsignedNodeAnnouncement { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn NodeAnnouncement_write(obj: *const NodeAnnouncement) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn NodeAnnouncement_write(obj: &NodeAnnouncement) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -4708,80 +4702,70 @@ pub extern "C" fn NodeAnnouncement_read(ser: crate::c_types::u8slice) -> NodeAnn } } #[no_mangle] -pub extern "C" fn QueryShortChannelIds_read(ser: crate::c_types::u8slice) -> QueryShortChannelIds { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - QueryShortChannelIds { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - QueryShortChannelIds { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn QueryShortChannelIds_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryShortChannelIdsDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::QueryShortChannelIds { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn QueryShortChannelIds_write(obj: *const QueryShortChannelIds) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn QueryShortChannelIds_write(obj: &QueryShortChannelIds) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn QueryShortChannelIds_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeQueryShortChannelIds) }) } #[no_mangle] -pub extern "C" fn ReplyShortChannelIdsEnd_read(ser: crate::c_types::u8slice) -> ReplyShortChannelIdsEnd { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - ReplyShortChannelIdsEnd { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn ReplyShortChannelIdsEnd_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyShortChannelIdsEndDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn ReplyShortChannelIdsEnd_write(obj: *const ReplyShortChannelIdsEnd) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn ReplyShortChannelIdsEnd_write(obj: &ReplyShortChannelIdsEnd) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn ReplyShortChannelIdsEnd_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReplyShortChannelIdsEnd) }) } #[no_mangle] -pub extern "C" fn QueryChannelRange_read(ser: crate::c_types::u8slice) -> QueryChannelRange { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - QueryChannelRange { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - QueryChannelRange { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn QueryChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryChannelRangeDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::QueryChannelRange { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn QueryChannelRange_write(obj: *const QueryChannelRange) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn QueryChannelRange_write(obj: &QueryChannelRange) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn QueryChannelRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeQueryChannelRange) }) } #[no_mangle] -pub extern "C" fn ReplyChannelRange_read(ser: crate::c_types::u8slice) -> ReplyChannelRange { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - ReplyChannelRange { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - ReplyChannelRange { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn ReplyChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyChannelRangeDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::ReplyChannelRange { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn ReplyChannelRange_write(obj: *const ReplyChannelRange) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn ReplyChannelRange_write(obj: &ReplyChannelRange) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn ReplyChannelRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReplyChannelRange) }) } #[no_mangle] -pub extern "C" fn GossipTimestampFilter_read(ser: crate::c_types::u8slice) -> GossipTimestampFilter { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - GossipTimestampFilter { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - GossipTimestampFilter { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn GossipTimestampFilter_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_GossipTimestampFilterDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::msgs::GossipTimestampFilter { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn GossipTimestampFilter_write(obj: *const GossipTimestampFilter) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn GossipTimestampFilter_write(obj: &GossipTimestampFilter) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn GossipTimestampFilter_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { diff --git a/lightning-c-bindings/src/routing/network_graph.rs b/lightning-c-bindings/src/routing/network_graph.rs index f70b2e41e14..9c14a2f943a 100644 --- a/lightning-c-bindings/src/routing/network_graph.rs +++ b/lightning-c-bindings/src/routing/network_graph.rs @@ -177,7 +177,7 @@ impl From for crate::ln::msgs::RoutingMessageHandler { } } #[no_mangle] -pub extern "C" fn NetGraphMsgHandler_as_RoutingMessageHandler(this_arg: *const NetGraphMsgHandler) -> crate::ln::msgs::RoutingMessageHandler { +pub extern "C" fn NetGraphMsgHandler_as_RoutingMessageHandler(this_arg: &NetGraphMsgHandler) -> crate::ln::msgs::RoutingMessageHandler { crate::ln::msgs::RoutingMessageHandler { this_arg: unsafe { (*this_arg).inner as *mut c_void }, free: None, @@ -280,7 +280,7 @@ impl From for crate::util::events::MessageSendEventsPr } } #[no_mangle] -pub extern "C" fn NetGraphMsgHandler_as_MessageSendEventsProvider(this_arg: *const NetGraphMsgHandler) -> crate::util::events::MessageSendEventsProvider { +pub extern "C" fn NetGraphMsgHandler_as_MessageSendEventsProvider(this_arg: &NetGraphMsgHandler) -> crate::util::events::MessageSendEventsProvider { crate::util::events::MessageSendEventsProvider { this_arg: unsafe { (*this_arg).inner as *mut c_void }, free: None, @@ -411,7 +411,7 @@ pub extern "C" fn DirectionalChannelInfo_set_last_update_message(this_ptr: &mut unsafe { &mut *this_ptr.inner }.last_update_message = local_val; } #[no_mangle] -pub extern "C" fn DirectionalChannelInfo_write(obj: *const DirectionalChannelInfo) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn DirectionalChannelInfo_write(obj: &DirectionalChannelInfo) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -544,7 +544,7 @@ pub extern "C" fn ChannelInfo_set_announcement_message(this_ptr: &mut ChannelInf unsafe { &mut *this_ptr.inner }.announcement_message = local_val; } #[no_mangle] -pub extern "C" fn ChannelInfo_write(obj: *const ChannelInfo) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelInfo_write(obj: &ChannelInfo) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] @@ -647,16 +647,14 @@ pub extern "C" fn RoutingFees_new(mut base_msat_arg: u32, mut proportional_milli })), is_owned: true } } #[no_mangle] -pub extern "C" fn RoutingFees_read(ser: crate::c_types::u8slice) -> RoutingFees { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - RoutingFees { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - RoutingFees { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn RoutingFees_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RoutingFeesDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::routing::network_graph::RoutingFees { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn RoutingFees_write(obj: *const RoutingFees) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn RoutingFees_write(obj: &RoutingFees) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn RoutingFees_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { @@ -790,20 +788,18 @@ pub extern "C" fn NodeAnnouncementInfo_new(mut features_arg: crate::ln::features })), is_owned: true } } #[no_mangle] -pub extern "C" fn NodeAnnouncementInfo_write(obj: *const NodeAnnouncementInfo) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn NodeAnnouncementInfo_write(obj: &NodeAnnouncementInfo) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn NodeAnnouncementInfo_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeAnnouncementInfo) }) } #[no_mangle] -pub extern "C" fn NodeAnnouncementInfo_read(ser: crate::c_types::u8slice) -> NodeAnnouncementInfo { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - NodeAnnouncementInfo { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - NodeAnnouncementInfo { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn NodeAnnouncementInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAnnouncementInfoDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::routing::network_graph::NodeAnnouncementInfo { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } use lightning::routing::network_graph::NodeInfo as nativeNodeInfoImport; @@ -896,36 +892,32 @@ pub extern "C" fn NodeInfo_new(mut channels_arg: crate::c_types::derived::CVec_u })), is_owned: true } } #[no_mangle] -pub extern "C" fn NodeInfo_write(obj: *const NodeInfo) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn NodeInfo_write(obj: &NodeInfo) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn NodeInfo_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeInfo) }) } #[no_mangle] -pub extern "C" fn NodeInfo_read(ser: crate::c_types::u8slice) -> NodeInfo { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - NodeInfo { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - NodeInfo { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn NodeInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeInfoDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::routing::network_graph::NodeInfo { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } #[no_mangle] -pub extern "C" fn NetworkGraph_write(obj: *const NetworkGraph) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn NetworkGraph_write(obj: &NetworkGraph) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn NetworkGraph_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNetworkGraph) }) } #[no_mangle] -pub extern "C" fn NetworkGraph_read(ser: crate::c_types::u8slice) -> NetworkGraph { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - NetworkGraph { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - NetworkGraph { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn NetworkGraph_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NetworkGraphDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::routing::network_graph::NetworkGraph { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } /// Creates a new, empty, network graph. #[must_use] diff --git a/lightning-c-bindings/src/routing/router.rs b/lightning-c-bindings/src/routing/router.rs index 47f89af4576..d3cd22f5ffa 100644 --- a/lightning-c-bindings/src/routing/router.rs +++ b/lightning-c-bindings/src/routing/router.rs @@ -222,20 +222,18 @@ pub extern "C" fn Route_new(mut paths_arg: crate::c_types::derived::CVec_CVec_Ro })), is_owned: true } } #[no_mangle] -pub extern "C" fn Route_write(obj: *const Route) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) +pub extern "C" fn Route_write(obj: &Route) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) } #[no_mangle] pub(crate) extern "C" fn Route_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeRoute) }) } #[no_mangle] -pub extern "C" fn Route_read(ser: crate::c_types::u8slice) -> Route { - if let Ok(res) = crate::c_types::deserialize_obj(ser) { - Route { inner: Box::into_raw(Box::new(res)), is_owned: true } - } else { - Route { inner: std::ptr::null_mut(), is_owned: true } - } +pub extern "C" fn Route_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RouteDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::routing::router::Route { inner: Box::into_raw(Box::new(o)), is_owned: true } }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) }; + local_res } use lightning::routing::router::RouteHint as nativeRouteHintImport; diff --git a/lightning-c-bindings/src/util/config.rs b/lightning-c-bindings/src/util/config.rs index a9bcd6aee62..37480e5d0d3 100644 --- a/lightning-c-bindings/src/util/config.rs +++ b/lightning-c-bindings/src/util/config.rs @@ -585,7 +585,7 @@ pub extern "C" fn ChannelConfig_default() -> ChannelConfig { ChannelConfig { inner: Box::into_raw(Box::new(Default::default())), is_owned: true } } #[no_mangle] -pub extern "C" fn ChannelConfig_write(obj: *const ChannelConfig) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelConfig_write(obj: &ChannelConfig) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &(*(*obj).inner) }) } #[no_mangle] diff --git a/lightning-c-bindings/src/util/events.rs b/lightning-c-bindings/src/util/events.rs index eef634762be..42aaecbc308 100644 --- a/lightning-c-bindings/src/util/events.rs +++ b/lightning-c-bindings/src/util/events.rs @@ -312,6 +312,10 @@ pub extern "C" fn Event_free(this_ptr: Event) { } pub extern "C" fn Event_clone(orig: &Event) -> Event { orig.clone() } +#[no_mangle] +pub extern "C" fn Event_write(obj: &Event) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) +} /// An event generated by ChannelManager which indicates a message should be sent to a peer (or /// broadcast to most peers). /// These events are handled by PeerManager::process_events if you are using a PeerManager. From 78bc72409144065d544c4723e522c9924791ea43 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 31 Dec 2020 16:45:55 -0500 Subject: [PATCH 11/13] [C++ bindings demo] Add now-missing std::moves --- lightning-c-bindings/demo.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lightning-c-bindings/demo.cpp b/lightning-c-bindings/demo.cpp index a92ae028480..0408486aa9f 100644 --- a/lightning-c-bindings/demo.cpp +++ b/lightning-c-bindings/demo.cpp @@ -262,8 +262,7 @@ int main() { LDK::KeysInterface keys_source1 = KeysManager_as_KeysInterface(&keys1); LDKSecretKey node_secret1 = keys_source1->get_node_secret(keys_source1->this_arg); - LDK::UserConfig config1 = UserConfig_default(); - LDK::ChannelManager cm1 = ChannelManager_new(network, fee_est, mon1, broadcast, logger1, KeysManager_as_KeysInterface(&keys1), config1, 0); + LDK::ChannelManager cm1 = ChannelManager_new(network, fee_est, mon1, broadcast, logger1, KeysManager_as_KeysInterface(&keys1), UserConfig_default(), 0); LDK::CVec_ChannelDetailsZ channels = ChannelManager_list_channels(&cm1); assert(channels->datalen == 0); @@ -273,7 +272,7 @@ int main() { LDK::MessageHandler msg_handler1 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm1), NetGraphMsgHandler_as_RoutingMessageHandler(&net_graph1)); LDKThirtyTwoBytes random_bytes = keys_source1->get_secure_random_bytes(keys_source1->this_arg); - LDK::PeerManager net1 = PeerManager_new(msg_handler1, node_secret1, &random_bytes.data, logger1); + LDK::PeerManager net1 = PeerManager_new(std::move(msg_handler1), node_secret1, &random_bytes.data, logger1); // Demo getting a channel key and check that its returning real pubkeys: LDK::ChannelKeys chan_keys1 = keys_source1->get_channel_keys(keys_source1->this_arg, false, 42); @@ -307,9 +306,9 @@ int main() { LDK::ChannelHandshakeConfig handshake_config2 = ChannelHandshakeConfig_default(); ChannelHandshakeConfig_set_minimum_depth(&handshake_config2, 2); LDK::UserConfig config2 = UserConfig_default(); - UserConfig_set_own_channel_config(&config2, handshake_config2); + UserConfig_set_own_channel_config(&config2, std::move(handshake_config2)); - LDK::ChannelManager cm2 = ChannelManager_new(network, fee_est, mon2, broadcast, logger2, KeysManager_as_KeysInterface(&keys2), config2, 0); + LDK::ChannelManager cm2 = ChannelManager_new(network, fee_est, mon2, broadcast, logger2, KeysManager_as_KeysInterface(&keys2), std::move(config2), 0); LDK::CVec_ChannelDetailsZ channels2 = ChannelManager_list_channels(&cm2); assert(channels2->datalen == 0); @@ -320,10 +319,10 @@ int main() { LDK::CResult_boolLightningErrorZ ann_res = net_msgs2->handle_channel_announcement(net_msgs2->this_arg, &chan_ann); assert(ann_res->result_ok); - LDK::MessageHandler msg_handler2 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm2), net_msgs2); + LDK::MessageHandler msg_handler2 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm2), std::move(net_msgs2)); LDKThirtyTwoBytes random_bytes2 = keys_source2->get_secure_random_bytes(keys_source2->this_arg); - LDK::PeerManager net2 = PeerManager_new(msg_handler2, node_secret2, &random_bytes2.data, logger2); + LDK::PeerManager net2 = PeerManager_new(std::move(msg_handler2), node_secret2, &random_bytes2.data, logger2); // Open a connection! int pipefds_1_to_2[2]; @@ -372,7 +371,7 @@ int main() { } // Note that we have to bind the result to a C++ class to make sure it gets free'd - LDK::CResult_NoneAPIErrorZ res = ChannelManager_create_channel(&cm1, ChannelManager_get_our_node_id(&cm2), 40000, 1000, 42, config1); + LDK::CResult_NoneAPIErrorZ res = ChannelManager_create_channel(&cm1, ChannelManager_get_our_node_id(&cm2), 40000, 1000, 42, UserConfig_default()); assert(res->result_ok); PeerManager_process_events(&net1); @@ -404,7 +403,7 @@ int main() { LDKThirtyTwoBytes txid; for (int i = 0; i < 32; i++) { txid.data[i] = channel_open_txid[31-i]; } LDK::OutPoint outp = OutPoint_new(txid, 0); - ChannelManager_funding_transaction_generated(&cm1, &events->data[0].funding_generation_ready.temporary_channel_id.data, outp); + ChannelManager_funding_transaction_generated(&cm1, &events->data[0].funding_generation_ready.temporary_channel_id.data, std::move(outp)); break; } std::this_thread::yield(); From 3efd641ca4a9b24d1dac5f496ac0d3c4d302023f Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 31 Dec 2020 17:48:55 -0500 Subject: [PATCH 12/13] Update C++ bindings demo to use `ChannelManager` de/serialization This demonstrates (and tests) the newly-exposed `ChannelManager` de/serialization functions. Best revewied with -b --color-moved. --- lightning-c-bindings/demo.cpp | 563 +++++++++++++++++++--------------- 1 file changed, 321 insertions(+), 242 deletions(-) diff --git a/lightning-c-bindings/demo.cpp b/lightning-c-bindings/demo.cpp index 0408486aa9f..8f4b4f90d05 100644 --- a/lightning-c-bindings/demo.cpp +++ b/lightning-c-bindings/demo.cpp @@ -9,6 +9,7 @@ extern "C" { #include #include +#include #include #include #include @@ -121,7 +122,7 @@ const LDKFeeEstimator fee_est { .free = NULL, }; -static int num_txs_broadcasted = 0; // Technically a race, but ints are atomic on x86 +static std::atomic_int num_txs_broadcasted(0); void broadcast_tx(const void *this_arg, LDKTransaction tx) { num_txs_broadcasted += 1; //TODO @@ -152,7 +153,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ add_channel_monitor(const void *this_arg arg->mons.push_back(std::make_pair(std::move(funding_txo), std::move(mon))); return CResult_NoneChannelMonitorUpdateErrZ_ok(); } -static int mons_updated = 0; // Technically a race, but ints are atomic on x86. +static std::atomic_int mons_updated(0); LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_monitor(const void *this_arg, LDKOutPoint funding_txo_arg, LDKChannelMonitorUpdate monitor_arg) { // First bind the args to C++ objects so they auto-free LDK::ChannelMonitorUpdate update(std::move(monitor_arg)); @@ -224,13 +225,74 @@ void sock_read_data_thread(int rdfd, LDKSocketDescriptor *peer_descriptor, LDKPe PeerManager_socket_disconnected(&*pm, peer_descriptor); } -int main() { - uint8_t node_seed[32]; - memset(&node_seed, 0, 32); +class PeersConnection { + int pipefds_1_to_2[2]; + int pipefds_2_to_1[2]; + std::thread t1, t2; + LDKSocketDescriptor sock1, sock2; + +public: + PeersConnection(LDK::ChannelManager& cm1, LDK::ChannelManager& cm2, LDK::PeerManager& net1, LDK::PeerManager& net2) { + assert(!pipe(pipefds_1_to_2)); + assert(!pipe(pipefds_2_to_1)); + + sock1 = LDKSocketDescriptor { + .this_arg = (void*)(long)pipefds_1_to_2[1], + .send_data = sock_send_data, + .disconnect_socket = sock_disconnect_socket, + .eq = sock_eq, + .hash = sock_hash, + .clone = NULL, + .free = NULL, + }; + + sock2 = LDKSocketDescriptor { + .this_arg = (void*)(long)pipefds_2_to_1[1], + .send_data = sock_send_data, + .disconnect_socket = sock_disconnect_socket, + .eq = sock_eq, + .hash = sock_hash, + .clone = NULL, + .free = NULL, + }; + + t1 = std::thread(&sock_read_data_thread, pipefds_2_to_1[0], &sock1, &net1); + t2 = std::thread(&sock_read_data_thread, pipefds_1_to_2[0], &sock2, &net2); + + // Note that we have to bind the result to a C++ class to make sure it gets free'd + LDK::CResult_CVec_u8ZPeerHandleErrorZ con_res = PeerManager_new_outbound_connection(&net1, ChannelManager_get_our_node_id(&cm2), sock1); + assert(con_res->result_ok); + LDK::CResult_NonePeerHandleErrorZ con_res2 = PeerManager_new_inbound_connection(&net2, sock2); + assert(con_res2->result_ok); + + auto writelen = write(pipefds_1_to_2[1], con_res->contents.result->data, con_res->contents.result->datalen); + assert(writelen > 0 && uint64_t(writelen) == con_res->contents.result->datalen); + + while (true) { + // Wait for the initial handshakes to complete... + LDK::CVec_PublicKeyZ peers_1 = PeerManager_get_peer_node_ids(&net1); + LDK::CVec_PublicKeyZ peers_2 = PeerManager_get_peer_node_ids(&net2); + if (peers_1->datalen == 1 && peers_2->datalen ==1) { break; } + std::this_thread::yield(); + } + } + void stop() { + close(pipefds_1_to_2[0]); + close(pipefds_2_to_1[0]); + close(pipefds_1_to_2[1]); + close(pipefds_2_to_1[1]); + t1.join(); + t2.join(); + } +}; + +int main() { LDKPublicKey null_pk; memset(&null_pk, 0, sizeof(null_pk)); + LDKThirtyTwoBytes random_bytes; + LDKNetwork network = LDKNetwork_Testnet; // Trait implementations: @@ -240,8 +302,7 @@ int main() { .free = NULL, }; - // Instantiate classes for node 1: - + // Instantiate classes for the nodes that don't get reloaded on a ser-des reload LDKLogger logger1 { .this_arg = (void*)1, .log = print_log, @@ -258,29 +319,8 @@ int main() { .free = NULL, }; - LDK::KeysManager keys1 = KeysManager_new(&node_seed, network, 0, 0); - LDK::KeysInterface keys_source1 = KeysManager_as_KeysInterface(&keys1); - LDKSecretKey node_secret1 = keys_source1->get_node_secret(keys_source1->this_arg); - - LDK::ChannelManager cm1 = ChannelManager_new(network, fee_est, mon1, broadcast, logger1, KeysManager_as_KeysInterface(&keys1), UserConfig_default(), 0); - - LDK::CVec_ChannelDetailsZ channels = ChannelManager_list_channels(&cm1); - assert(channels->datalen == 0); - LDK::NetGraphMsgHandler net_graph1 = NetGraphMsgHandler_new(genesis_hash, NULL, logger1); - - LDK::MessageHandler msg_handler1 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm1), NetGraphMsgHandler_as_RoutingMessageHandler(&net_graph1)); - - LDKThirtyTwoBytes random_bytes = keys_source1->get_secure_random_bytes(keys_source1->this_arg); - LDK::PeerManager net1 = PeerManager_new(std::move(msg_handler1), node_secret1, &random_bytes.data, logger1); - - // Demo getting a channel key and check that its returning real pubkeys: - LDK::ChannelKeys chan_keys1 = keys_source1->get_channel_keys(keys_source1->this_arg, false, 42); - chan_keys1->set_pubkeys(&chan_keys1); // Make sure pubkeys is defined - LDKPublicKey payment_point = ChannelPublicKeys_get_payment_point(&chan_keys1->pubkeys); - assert(memcmp(&payment_point, &null_pk, sizeof(null_pk))); - - // Instantiate classes for node 2: + LDKSecretKey node_secret1; LDKLogger logger2 { .this_arg = (void*)2, @@ -298,239 +338,283 @@ int main() { .free = NULL, }; - memset(&node_seed, 1, 32); - LDK::KeysManager keys2 = KeysManager_new(&node_seed, network, 0, 0); - LDK::KeysInterface keys_source2 = KeysManager_as_KeysInterface(&keys2); - LDKSecretKey node_secret2 = keys_source2->get_node_secret(keys_source2->this_arg); - - LDK::ChannelHandshakeConfig handshake_config2 = ChannelHandshakeConfig_default(); - ChannelHandshakeConfig_set_minimum_depth(&handshake_config2, 2); - LDK::UserConfig config2 = UserConfig_default(); - UserConfig_set_own_channel_config(&config2, std::move(handshake_config2)); - - LDK::ChannelManager cm2 = ChannelManager_new(network, fee_est, mon2, broadcast, logger2, KeysManager_as_KeysInterface(&keys2), std::move(config2), 0); - - LDK::CVec_ChannelDetailsZ channels2 = ChannelManager_list_channels(&cm2); - assert(channels2->datalen == 0); - LDK::NetGraphMsgHandler net_graph2 = NetGraphMsgHandler_new(genesis_hash, NULL, logger2); - LDK::RoutingMessageHandler net_msgs2 = NetGraphMsgHandler_as_RoutingMessageHandler(&net_graph2); - LDK::ChannelAnnouncement chan_ann = ChannelAnnouncement_read(LDKu8slice { .data = valid_node_announcement, .datalen = sizeof(valid_node_announcement) }); - LDK::CResult_boolLightningErrorZ ann_res = net_msgs2->handle_channel_announcement(net_msgs2->this_arg, &chan_ann); - assert(ann_res->result_ok); - - LDK::MessageHandler msg_handler2 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm2), std::move(net_msgs2)); - - LDKThirtyTwoBytes random_bytes2 = keys_source2->get_secure_random_bytes(keys_source2->this_arg); - LDK::PeerManager net2 = PeerManager_new(std::move(msg_handler2), node_secret2, &random_bytes2.data, logger2); - - // Open a connection! - int pipefds_1_to_2[2]; - int pipefds_2_to_1[2]; - assert(!pipe(pipefds_1_to_2)); - assert(!pipe(pipefds_2_to_1)); - - LDKSocketDescriptor sock1 { - .this_arg = (void*)(long)pipefds_1_to_2[1], - .send_data = sock_send_data, - .disconnect_socket = sock_disconnect_socket, - .eq = sock_eq, - .hash = sock_hash, - .clone = NULL, - .free = NULL, - }; - - LDKSocketDescriptor sock2 { - .this_arg = (void*)(long)pipefds_2_to_1[1], - .send_data = sock_send_data, - .disconnect_socket = sock_disconnect_socket, - .eq = sock_eq, - .hash = sock_hash, - .clone = NULL, - .free = NULL, - }; - - std::thread t1(&sock_read_data_thread, pipefds_2_to_1[0], &sock1, &net1); - std::thread t2(&sock_read_data_thread, pipefds_1_to_2[0], &sock2, &net2); - - // Note that we have to bind the result to a C++ class to make sure it gets free'd - LDK::CResult_CVec_u8ZPeerHandleErrorZ con_res = PeerManager_new_outbound_connection(&net1, ChannelManager_get_our_node_id(&cm2), sock1); - assert(con_res->result_ok); - LDK::CResult_NonePeerHandleErrorZ con_res2 = PeerManager_new_inbound_connection(&net2, sock2); - assert(con_res2->result_ok); - - auto writelen = write(pipefds_1_to_2[1], con_res->contents.result->data, con_res->contents.result->datalen); - assert(writelen > 0 && uint64_t(writelen) == con_res->contents.result->datalen); + LDKSecretKey node_secret2; + + LDK::CVec_u8Z cm1_ser = LDKCVec_u8Z {}; // ChannelManager 1 serialization at the end of the ser-des scope + LDK::CVec_u8Z cm2_ser = LDKCVec_u8Z {}; // ChannelManager 2 serialization at the end of the ser-des scope + + { // Scope for the ser-des reload + // Instantiate classes for node 1: + uint8_t node_seed[32]; + memset(&node_seed, 0, 32); + LDK::KeysManager keys1 = KeysManager_new(&node_seed, network, 0, 0); + LDK::KeysInterface keys_source1 = KeysManager_as_KeysInterface(&keys1); + node_secret1 = keys_source1->get_node_secret(keys_source1->this_arg); + + LDK::ChannelManager cm1 = ChannelManager_new(network, fee_est, mon1, broadcast, logger1, KeysManager_as_KeysInterface(&keys1), UserConfig_default(), 0); + + LDK::CVec_ChannelDetailsZ channels = ChannelManager_list_channels(&cm1); + assert(channels->datalen == 0); + + LDK::MessageHandler msg_handler1 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm1), NetGraphMsgHandler_as_RoutingMessageHandler(&net_graph1)); + + random_bytes = keys_source1->get_secure_random_bytes(keys_source1->this_arg); + LDK::PeerManager net1 = PeerManager_new(std::move(msg_handler1), node_secret1, &random_bytes.data, logger1); + + // Demo getting a channel key and check that its returning real pubkeys: + LDK::ChannelKeys chan_keys1 = keys_source1->get_channel_keys(keys_source1->this_arg, false, 42); + chan_keys1->set_pubkeys(&chan_keys1); // Make sure pubkeys is defined + LDKPublicKey payment_point = ChannelPublicKeys_get_payment_point(&chan_keys1->pubkeys); + assert(memcmp(&payment_point, &null_pk, sizeof(null_pk))); + + // Instantiate classes for node 2: + memset(&node_seed, 1, 32); + LDK::KeysManager keys2 = KeysManager_new(&node_seed, network, 0, 0); + LDK::KeysInterface keys_source2 = KeysManager_as_KeysInterface(&keys2); + node_secret2 = keys_source2->get_node_secret(keys_source2->this_arg); + + LDK::ChannelHandshakeConfig handshake_config2 = ChannelHandshakeConfig_default(); + ChannelHandshakeConfig_set_minimum_depth(&handshake_config2, 2); + LDK::UserConfig config2 = UserConfig_default(); + UserConfig_set_own_channel_config(&config2, std::move(handshake_config2)); + + LDK::ChannelManager cm2 = ChannelManager_new(network, fee_est, mon2, broadcast, logger2, KeysManager_as_KeysInterface(&keys2), std::move(config2), 0); + + LDK::CVec_ChannelDetailsZ channels2 = ChannelManager_list_channels(&cm2); + assert(channels2->datalen == 0); + + LDK::RoutingMessageHandler net_msgs2 = NetGraphMsgHandler_as_RoutingMessageHandler(&net_graph2); + LDK::ChannelAnnouncement chan_ann = ChannelAnnouncement_read(LDKu8slice { .data = valid_node_announcement, .datalen = sizeof(valid_node_announcement) }); + LDK::CResult_boolLightningErrorZ ann_res = net_msgs2->handle_channel_announcement(net_msgs2->this_arg, &chan_ann); + assert(ann_res->result_ok); + + LDK::MessageHandler msg_handler2 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm2), std::move(net_msgs2)); + + random_bytes = keys_source2->get_secure_random_bytes(keys_source2->this_arg); + LDK::PeerManager net2 = PeerManager_new(std::move(msg_handler2), node_secret2, &random_bytes.data, logger2); + + // Open a connection! + PeersConnection conn(cm1, cm2, net1, net2); + + // Note that we have to bind the result to a C++ class to make sure it gets free'd + LDK::CResult_NoneAPIErrorZ res = ChannelManager_create_channel(&cm1, ChannelManager_get_our_node_id(&cm2), 40000, 1000, 42, UserConfig_default()); + assert(res->result_ok); + PeerManager_process_events(&net1); + + LDK::CVec_ChannelDetailsZ new_channels = ChannelManager_list_channels(&cm1); + assert(new_channels->datalen == 1); + LDKPublicKey chan_open_pk = ChannelDetails_get_remote_network_id(&new_channels->data[0]); + assert(!memcmp(chan_open_pk.compressed_form, ChannelManager_get_our_node_id(&cm2).compressed_form, 33)); + + while (true) { + LDK::CVec_ChannelDetailsZ new_channels_2 = ChannelManager_list_channels(&cm2); + if (new_channels_2->datalen == 1) { + // Sample getting our counterparty's init features (which used to be hard to do without a memory leak): + const LDK::InitFeatures init_feats = ChannelDetails_get_counterparty_features(&new_channels_2->data[0]); + assert(init_feats->inner != NULL); + break; + } + std::this_thread::yield(); + } - while (true) { - // Wait for the initial handshakes to complete... - LDK::CVec_PublicKeyZ peers_1 = PeerManager_get_peer_node_ids(&net1); - LDK::CVec_PublicKeyZ peers_2 = PeerManager_get_peer_node_ids(&net2); - if (peers_1->datalen == 1 && peers_2->datalen ==1) { break; } - std::this_thread::yield(); - } + LDKEventsProvider ev1 = ChannelManager_as_EventsProvider(&cm1); + while (true) { + LDK::CVec_EventZ events = ev1.get_and_clear_pending_events(ev1.this_arg); + if (events->datalen == 1) { + assert(events->data[0].tag == LDKEvent_FundingGenerationReady); + assert(events->data[0].funding_generation_ready.user_channel_id == 42); + assert(events->data[0].funding_generation_ready.channel_value_satoshis == 40000); + assert(events->data[0].funding_generation_ready.output_script.datalen == 34); + assert(!memcmp(events->data[0].funding_generation_ready.output_script.data, channel_open_tx + 58, 34)); + LDKThirtyTwoBytes txid; + for (int i = 0; i < 32; i++) { txid.data[i] = channel_open_txid[31-i]; } + LDK::OutPoint outp = OutPoint_new(txid, 0); + ChannelManager_funding_transaction_generated(&cm1, &events->data[0].funding_generation_ready.temporary_channel_id.data, std::move(outp)); + break; + } + std::this_thread::yield(); + } - // Note that we have to bind the result to a C++ class to make sure it gets free'd - LDK::CResult_NoneAPIErrorZ res = ChannelManager_create_channel(&cm1, ChannelManager_get_our_node_id(&cm2), 40000, 1000, 42, UserConfig_default()); - assert(res->result_ok); - PeerManager_process_events(&net1); + // We observe when the funding signed messages have been exchanged by + // waiting for two monitors to be registered. + PeerManager_process_events(&net1); + while (true) { + LDK::CVec_EventZ events = ev1.get_and_clear_pending_events(ev1.this_arg); + if (events->datalen == 1) { + assert(events->data[0].tag == LDKEvent_FundingBroadcastSafe); + assert(events->data[0].funding_broadcast_safe.user_channel_id == 42); + break; + } + std::this_thread::yield(); + } - LDK::CVec_ChannelDetailsZ new_channels = ChannelManager_list_channels(&cm1); - assert(new_channels->datalen == 1); - LDKPublicKey chan_open_pk = ChannelDetails_get_remote_network_id(&new_channels->data[0]); - assert(!memcmp(chan_open_pk.compressed_form, ChannelManager_get_our_node_id(&cm2).compressed_form, 33)); + LDKCVec_C2Tuple_usizeTransactionZZ txdata { .data = (LDKC2TupleTempl_usize__Transaction*)malloc(sizeof(LDKC2Tuple_usizeTransactionZ)), .datalen = 1 }; + *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = (uint8_t*)channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false }); + ChannelManager_block_connected(&cm1, &channel_open_header, txdata, 1); + + txdata = LDKCVec_C2Tuple_usizeTransactionZZ { .data = (LDKC2TupleTempl_usize__Transaction*)malloc(sizeof(LDKC2Tuple_usizeTransactionZ)), .datalen = 1 }; + *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = (uint8_t*)channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false }); + ChannelManager_block_connected(&cm2, &channel_open_header, txdata, 1); + + txdata = LDKCVec_C2Tuple_usizeTransactionZZ { .data = (LDKC2TupleTempl_usize__Transaction*)malloc(sizeof(LDKC2Tuple_usizeTransactionZ)), .datalen = 1 }; + *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = (uint8_t*)channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false }); + mons1.ConnectBlock(&channel_open_header, 1, txdata, broadcast, fee_est); + + txdata = LDKCVec_C2Tuple_usizeTransactionZZ { .data = (LDKC2TupleTempl_usize__Transaction*)malloc(sizeof(LDKC2Tuple_usizeTransactionZ)), .datalen = 1 }; + *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = (uint8_t*)channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false }); + mons2.ConnectBlock(&channel_open_header, 1, txdata, broadcast, fee_est); + + ChannelManager_block_connected(&cm1, &header_1, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, 2); + ChannelManager_block_connected(&cm2, &header_1, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, 2); + mons1.ConnectBlock(&header_1, 2, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, broadcast, fee_est); + mons2.ConnectBlock(&header_1, 2, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, broadcast, fee_est); + + ChannelManager_block_connected(&cm1, &header_2, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, 3); + ChannelManager_block_connected(&cm2, &header_2, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, 3); + mons1.ConnectBlock(&header_2, 3, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, broadcast, fee_est); + mons2.ConnectBlock(&header_2, 3, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, broadcast, fee_est); + + PeerManager_process_events(&net1); + PeerManager_process_events(&net2); + + // Now send funds from 1 to 2! + while (true) { + LDK::CVec_ChannelDetailsZ outbound_channels = ChannelManager_list_usable_channels(&cm1); + if (outbound_channels->datalen == 1) { + const LDKChannelDetails *channel = &outbound_channels->data[0]; + // Note that the channel ID is the same as the channel txid reversed as the output index is 0 + uint8_t expected_chan_id[32]; + for (int i = 0; i < 32; i++) { expected_chan_id[i] = channel_open_txid[31-i]; } + assert(!memcmp(ChannelDetails_get_channel_id(channel), expected_chan_id, 32)); + assert(!memcmp(ChannelDetails_get_remote_network_id(channel).compressed_form, + ChannelManager_get_our_node_id(&cm2).compressed_form, 33)); + assert(ChannelDetails_get_channel_value_satoshis(channel) == 40000); + // We opened the channel with 1000 push_msat: + assert(ChannelDetails_get_outbound_capacity_msat(channel) == 40000*1000 - 1000); + assert(ChannelDetails_get_inbound_capacity_msat(channel) == 1000); + assert(ChannelDetails_get_is_live(channel)); + break; + } + std::this_thread::yield(); + } - while (true) { - LDK::CVec_ChannelDetailsZ new_channels_2 = ChannelManager_list_channels(&cm2); - if (new_channels_2->datalen == 1) { - // Sample getting our counterparty's init features (which used to be hard to do without a memory leak): - const LDK::InitFeatures init_feats = ChannelDetails_get_counterparty_features(&new_channels_2->data[0]); - assert(init_feats->inner != NULL); - break; + LDK::CVec_ChannelDetailsZ outbound_channels = ChannelManager_list_usable_channels(&cm1); + LDKThirtyTwoBytes payment_secret; + memset(payment_secret.data, 0x42, 32); + { + LDK::LockedNetworkGraph graph_2_locked = NetGraphMsgHandler_read_locked_graph(&net_graph2); + LDK::NetworkGraph graph_2_ref = LockedNetworkGraph_graph(&graph_2_locked); + LDK::CResult_RouteLightningErrorZ route = get_route(ChannelManager_get_our_node_id(&cm1), &graph_2_ref, ChannelManager_get_our_node_id(&cm2), &outbound_channels, LDKCVec_RouteHintZ { + .data = NULL, .datalen = 0 + }, 5000, 10, logger1); + assert(route->result_ok); + LDK::CResult_NonePaymentSendFailureZ send_res = ChannelManager_send_payment(&cm1, route->contents.result, payment_hash_1, payment_secret); + assert(send_res->result_ok); } - std::this_thread::yield(); - } - LDKEventsProvider ev1 = ChannelManager_as_EventsProvider(&cm1); - while (true) { - LDK::CVec_EventZ events = ev1.get_and_clear_pending_events(ev1.this_arg); - if (events->datalen == 1) { - assert(events->data[0].tag == LDKEvent_FundingGenerationReady); - assert(events->data[0].funding_generation_ready.user_channel_id == 42); - assert(events->data[0].funding_generation_ready.channel_value_satoshis == 40000); - assert(events->data[0].funding_generation_ready.output_script.datalen == 34); - assert(!memcmp(events->data[0].funding_generation_ready.output_script.data, channel_open_tx + 58, 34)); - LDKThirtyTwoBytes txid; - for (int i = 0; i < 32; i++) { txid.data[i] = channel_open_txid[31-i]; } - LDK::OutPoint outp = OutPoint_new(txid, 0); - ChannelManager_funding_transaction_generated(&cm1, &events->data[0].funding_generation_ready.temporary_channel_id.data, std::move(outp)); - break; + mons_updated = 0; + PeerManager_process_events(&net1); + while (mons_updated != 4) { + std::this_thread::yield(); } - std::this_thread::yield(); - } - // We observe when the funding signed messages have been exchanged by - // waiting for two monitors to be registered. - PeerManager_process_events(&net1); - while (true) { - LDK::CVec_EventZ events = ev1.get_and_clear_pending_events(ev1.this_arg); - if (events->datalen == 1) { - assert(events->data[0].tag == LDKEvent_FundingBroadcastSafe); - assert(events->data[0].funding_broadcast_safe.user_channel_id == 42); - break; + // Check that we received the payment! + LDKEventsProvider ev2 = ChannelManager_as_EventsProvider(&cm2); + while (true) { + LDK::CVec_EventZ events = ev2.get_and_clear_pending_events(ev2.this_arg); + if (events->datalen == 1) { + assert(events->data[0].tag == LDKEvent_PendingHTLCsForwardable); + break; + } + std::this_thread::yield(); + } + ChannelManager_process_pending_htlc_forwards(&cm2); + PeerManager_process_events(&net2); + + mons_updated = 0; + { + LDK::CVec_EventZ events = ev2.get_and_clear_pending_events(ev2.this_arg); + assert(events->datalen == 1); + assert(events->data[0].tag == LDKEvent_PaymentReceived); + assert(!memcmp(events->data[0].payment_received.payment_hash.data, payment_hash_1.data, 32)); + assert(!memcmp(events->data[0].payment_received.payment_secret.data, payment_secret.data, 32)); + assert(events->data[0].payment_received.amt == 5000); + assert(ChannelManager_claim_funds(&cm2, payment_preimage_1, payment_secret, 5000)); + } + PeerManager_process_events(&net2); + // Wait until we've passed through a full set of monitor updates (ie new preimage + CS/RAA messages) + while (mons_updated != 5) { + std::this_thread::yield(); + } + { + LDK::CVec_EventZ events = ev1.get_and_clear_pending_events(ev1.this_arg); + assert(events->datalen == 1); + assert(events->data[0].tag == LDKEvent_PaymentSent); + assert(!memcmp(events->data[0].payment_sent.payment_preimage.data, payment_preimage_1.data, 32)); } - std::this_thread::yield(); - } - LDKCVec_C2Tuple_usizeTransactionZZ txdata { .data = (LDKC2TupleTempl_usize__Transaction*)malloc(sizeof(LDKC2Tuple_usizeTransactionZ)), .datalen = 1 }; - *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = (uint8_t*)channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false }); - ChannelManager_block_connected(&cm1, &channel_open_header, txdata, 1); + conn.stop(); - txdata = LDKCVec_C2Tuple_usizeTransactionZZ { .data = (LDKC2TupleTempl_usize__Transaction*)malloc(sizeof(LDKC2Tuple_usizeTransactionZ)), .datalen = 1 }; - *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = (uint8_t*)channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false }); - ChannelManager_block_connected(&cm2, &channel_open_header, txdata, 1); + cm1_ser = ChannelManager_write(&cm1); + cm2_ser = ChannelManager_write(&cm2); + } - txdata = LDKCVec_C2Tuple_usizeTransactionZZ { .data = (LDKC2TupleTempl_usize__Transaction*)malloc(sizeof(LDKC2Tuple_usizeTransactionZ)), .datalen = 1 }; - *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = (uint8_t*)channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false }); - mons1.ConnectBlock(&channel_open_header, 1, txdata, broadcast, fee_est); + LDK::CVec_ChannelMonitorZ mons_list1 = LDKCVec_ChannelMonitorZ { .data = (LDKChannelMonitor*)malloc(sizeof(LDKChannelMonitor)), .datalen = 1 }; + assert(mons1.mons.size() == 1); + mons_list1->data[0] = *& std::get<1>(mons1.mons[0]); // Note that we need a reference, thus need a raw clone here, which *& does. + mons_list1->data[0].is_owned = false; // XXX: God this sucks + uint8_t node_seed[32]; + memset(&node_seed, 0, 32); + LDK::KeysManager keys1 = KeysManager_new(&node_seed, network, 1, 0); + LDK::KeysInterface keys_source1 = KeysManager_as_KeysInterface(&keys1); - txdata = LDKCVec_C2Tuple_usizeTransactionZZ { .data = (LDKC2TupleTempl_usize__Transaction*)malloc(sizeof(LDKC2Tuple_usizeTransactionZ)), .datalen = 1 }; - *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = (uint8_t*)channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false }); - mons2.ConnectBlock(&channel_open_header, 1, txdata, broadcast, fee_est); + LDK::ChannelManagerReadArgs cm1_args = ChannelManagerReadArgs_new(KeysManager_as_KeysInterface(&keys1), fee_est, mon1, broadcast, logger1, UserConfig_default(), std::move(mons_list1)); + LDK::CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ cm1_read = + C2Tuple_BlockHashChannelManagerZ_read(LDKu8slice { .data = cm1_ser->data, .datalen = cm1_ser -> datalen}, std::move(cm1_args)); + assert(cm1_read->result_ok); + LDK::ChannelManager cm1(std::move(cm1_read->contents.result->b)); - ChannelManager_block_connected(&cm1, &header_1, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, 2); - ChannelManager_block_connected(&cm2, &header_1, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, 2); - mons1.ConnectBlock(&header_1, 2, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, broadcast, fee_est); - mons2.ConnectBlock(&header_1, 2, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, broadcast, fee_est); + LDK::CVec_ChannelMonitorZ mons_list2 = LDKCVec_ChannelMonitorZ { .data = (LDKChannelMonitor*)malloc(sizeof(LDKChannelMonitor)), .datalen = 1 }; + assert(mons2.mons.size() == 1); + mons_list2->data[0] = *& std::get<1>(mons2.mons[0]); // Note that we need a reference, thus need a raw clone here, which *& does. + mons_list2->data[0].is_owned = false; // XXX: God this sucks + memset(&node_seed, 1, 32); + LDK::KeysManager keys2 = KeysManager_new(&node_seed, network, 1, 0); - ChannelManager_block_connected(&cm1, &header_2, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, 3); - ChannelManager_block_connected(&cm2, &header_2, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, 3); - mons1.ConnectBlock(&header_2, 3, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, broadcast, fee_est); - mons2.ConnectBlock(&header_2, 3, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, broadcast, fee_est); + LDK::ChannelManagerReadArgs cm2_args = ChannelManagerReadArgs_new(KeysManager_as_KeysInterface(&keys2), fee_est, mon2, broadcast, logger2, UserConfig_default(), std::move(mons_list2)); + LDK::CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ cm2_read = + C2Tuple_BlockHashChannelManagerZ_read(LDKu8slice { .data = cm2_ser->data, .datalen = cm2_ser -> datalen}, std::move(cm2_args)); + assert(cm2_read->result_ok); + LDK::ChannelManager cm2(std::move(cm2_read->contents.result->b)); - PeerManager_process_events(&net1); - PeerManager_process_events(&net2); + // Attempt to close the channel... + uint8_t chan_id[32]; + for (int i = 0; i < 32; i++) { chan_id[i] = channel_open_txid[31-i]; } + LDK::CResult_NoneAPIErrorZ close_res = ChannelManager_close_channel(&cm1, &chan_id); + assert(!close_res->result_ok); // Note that we can't close while disconnected! - // Now send funds from 1 to 2! - while (true) { - LDK::CVec_ChannelDetailsZ outbound_channels = ChannelManager_list_usable_channels(&cm1); - if (outbound_channels->datalen == 1) { - const LDKChannelDetails *channel = &outbound_channels->data[0]; - // Note that the channel ID is the same as the channel txid reversed as the output index is 0 - uint8_t expected_chan_id[32]; - for (int i = 0; i < 32; i++) { expected_chan_id[i] = channel_open_txid[31-i]; } - assert(!memcmp(ChannelDetails_get_channel_id(channel), expected_chan_id, 32)); - assert(!memcmp(ChannelDetails_get_remote_network_id(channel).compressed_form, - ChannelManager_get_our_node_id(&cm2).compressed_form, 33)); - assert(ChannelDetails_get_channel_value_satoshis(channel) == 40000); - // We opened the channel with 1000 push_msat: - assert(ChannelDetails_get_outbound_capacity_msat(channel) == 40000*1000 - 1000); - assert(ChannelDetails_get_inbound_capacity_msat(channel) == 1000); - assert(ChannelDetails_get_is_live(channel)); - break; - } - std::this_thread::yield(); - } + // Open a connection! + LDK::MessageHandler msg_handler1 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm1), NetGraphMsgHandler_as_RoutingMessageHandler(&net_graph1)); + random_bytes = keys_source1->get_secure_random_bytes(keys_source1->this_arg); + LDK::PeerManager net1 = PeerManager_new(std::move(msg_handler1), node_secret1, &random_bytes.data, logger1); - LDK::CVec_ChannelDetailsZ outbound_channels = ChannelManager_list_usable_channels(&cm1); - LDKThirtyTwoBytes payment_secret; - memset(payment_secret.data, 0x42, 32); - { - LDK::LockedNetworkGraph graph_2_locked = NetGraphMsgHandler_read_locked_graph(&net_graph2); - LDK::NetworkGraph graph_2_ref = LockedNetworkGraph_graph(&graph_2_locked); - LDK::CResult_RouteLightningErrorZ route = get_route(ChannelManager_get_our_node_id(&cm1), &graph_2_ref, ChannelManager_get_our_node_id(&cm2), &outbound_channels, LDKCVec_RouteHintZ { - .data = NULL, .datalen = 0 - }, 5000, 10, logger1); - assert(route->result_ok); - LDK::CResult_NonePaymentSendFailureZ send_res = ChannelManager_send_payment(&cm1, route->contents.result, payment_hash_1, payment_secret); - assert(send_res->result_ok); - } + LDK::MessageHandler msg_handler2 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm2), NetGraphMsgHandler_as_RoutingMessageHandler(&net_graph2)); + random_bytes = keys_source1->get_secure_random_bytes(keys_source1->this_arg); + LDK::PeerManager net2 = PeerManager_new(std::move(msg_handler2), node_secret2, &random_bytes.data, logger2); - mons_updated = 0; - PeerManager_process_events(&net1); - while (mons_updated != 4) { - std::this_thread::yield(); - } + PeersConnection conn(cm1, cm2, net1, net2); - // Check that we received the payment! - LDKEventsProvider ev2 = ChannelManager_as_EventsProvider(&cm2); while (true) { - LDK::CVec_EventZ events = ev2.get_and_clear_pending_events(ev2.this_arg); - if (events->datalen == 1) { - assert(events->data[0].tag == LDKEvent_PendingHTLCsForwardable); + // Wait for the channels to be considered up once the reestablish messages are processed + LDK::CVec_ChannelDetailsZ outbound_channels = ChannelManager_list_usable_channels(&cm1); + if (outbound_channels->datalen == 1) { break; } - std::this_thread::yield(); - } - ChannelManager_process_pending_htlc_forwards(&cm2); - PeerManager_process_events(&net2); - - mons_updated = 0; - { - LDK::CVec_EventZ events = ev2.get_and_clear_pending_events(ev2.this_arg); - assert(events->datalen == 1); - assert(events->data[0].tag == LDKEvent_PaymentReceived); - assert(!memcmp(events->data[0].payment_received.payment_hash.data, payment_hash_1.data, 32)); - assert(!memcmp(events->data[0].payment_received.payment_secret.data, payment_secret.data, 32)); - assert(events->data[0].payment_received.amt == 5000); - assert(ChannelManager_claim_funds(&cm2, payment_preimage_1, payment_secret, 5000)); - } - PeerManager_process_events(&net2); - // Wait until we've passed through a full set of monitor updates (ie new preimage + CS/RAA messages) - while (mons_updated != 5) { - std::this_thread::yield(); - } - { - LDK::CVec_EventZ events = ev1.get_and_clear_pending_events(ev1.this_arg); - assert(events->datalen == 1); - assert(events->data[0].tag == LDKEvent_PaymentSent); - assert(!memcmp(events->data[0].payment_sent.payment_preimage.data, payment_preimage_1.data, 32)); } - // Close the channel. - uint8_t chan_id[32]; - for (int i = 0; i < 32; i++) { chan_id[i] = channel_open_txid[31-i]; } - LDK::CResult_NoneAPIErrorZ close_res = ChannelManager_close_channel(&cm1, &chan_id); + // Actually close the channel + close_res = ChannelManager_close_channel(&cm1, &chan_id); assert(close_res->result_ok); PeerManager_process_events(&net1); num_txs_broadcasted = 0; @@ -542,12 +626,7 @@ int main() { LDK::CVec_ChannelDetailsZ chans_after_close2 = ChannelManager_list_channels(&cm2); assert(chans_after_close2->datalen == 0); - close(pipefds_1_to_2[0]); - close(pipefds_2_to_1[0]); - close(pipefds_1_to_2[1]); - close(pipefds_2_to_1[1]); - t1.join(); - t2.join(); + conn.stop(); // Few extra random tests: LDKSecretKey sk; From 5d045de8be7b6458d315547f9058fd22f2d7580f Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 2 Feb 2021 19:28:40 -0500 Subject: [PATCH 13/13] [bindings] Fix genbindings.sh compile issues on OSX There were two issues on OSX - we need to give gcc the clang warnings flags because `gcc` *is* clang on OSX and we missed an `-std=c++11` on one of the clang++ calls, causing compile failures. --- genbindings.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/genbindings.sh b/genbindings.sh index c63de7dbc05..29e6ac1867e 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -47,12 +47,14 @@ fi # Finally, sanity-check the generated C and C++ bindings with demo apps: +CFLAGS="-Wall -Wno-nullability-completeness -pthread" + # Naively run the C demo app: -gcc -Wall -g -pthread demo.c target/debug/libldk.a -ldl +gcc $CFLAGS -Wall -g -pthread demo.c target/debug/libldk.a -ldl ./a.out # And run the C++ demo app in valgrind to test memory model correctness and lack of leaks. -g++ -std=c++11 -Wall -g -pthread demo.cpp -Ltarget/debug/ -lldk -ldl +g++ $CFLAGS -std=c++11 -Wall -g -pthread demo.cpp -Ltarget/debug/ -lldk -ldl if [ -x "`which valgrind`" ]; then LD_LIBRARY_PATH=target/debug/ valgrind --error-exitcode=4 --memcheck:leak-check=full --show-leak-kinds=all ./a.out echo @@ -60,11 +62,9 @@ else echo "WARNING: Please install valgrind for more testing" fi -CLANGOPTS="-Wall -Wno-nullability-completeness -pthread" - # Test a statically-linked C++ version, tracking the resulting binary size and runtime # across debug, LTO, and cross-language LTO builds (using the same compiler each time). -clang++ $CLANGOPTS demo.cpp target/debug/libldk.a -ldl +clang++ $CFLAGS -std=c++11 demo.cpp target/debug/libldk.a -ldl strip ./a.out echo " C++ Bin size and runtime w/o optimization:" ls -lha a.out @@ -85,11 +85,11 @@ if [ "$HOST_PLATFORM" = "host: x86_64-unknown-linux-gnu" ]; then set +e # First the C demo app... - clang-$LLVM_V $CLANGOPTS -fsanitize=memory -fsanitize-memory-track-origins -g demo.c target/debug/libldk.a -ldl + clang-$LLVM_V $CFLAGS -fsanitize=memory -fsanitize-memory-track-origins -g demo.c target/debug/libldk.a -ldl ./a.out # ...then the C++ demo app - clang++-$LLVM_V -std=c++11 $CLANGOPTS -fsanitize=memory -fsanitize-memory-track-origins -g demo.cpp target/debug/libldk.a -ldl + clang++-$LLVM_V $CFLAGS -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -g demo.cpp target/debug/libldk.a -ldl ./a.out >/dev/null # restore exit-on-failure @@ -155,11 +155,11 @@ if [ "$HOST_PLATFORM" = "host: x86_64-unknown-linux-gnu" -o "$HOST_PLATFORM" = " mv Cargo.toml.bk Cargo.toml # First the C demo app... - $CLANG $CLANGOPTS -fsanitize=address -g demo.c target/debug/libldk.a -ldl + $CLANG $CFLAGS -fsanitize=address -g demo.c target/debug/libldk.a -ldl ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' ./a.out # ...then the C++ demo app - $CLANGPP $CLANGOPTS -std=c++11 -fsanitize=address -g demo.cpp target/debug/libldk.a -ldl + $CLANGPP $CFLAGS -std=c++11 -fsanitize=address -g demo.cpp target/debug/libldk.a -ldl ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' ./a.out >/dev/null else echo "WARNING: Please install clang-$RUSTC_LLVM_V and clang++-$RUSTC_LLVM_V to build with address sanitizer" @@ -170,7 +170,7 @@ fi # Now build with LTO on on both C++ and rust, but without cross-language LTO: CARGO_PROFILE_RELEASE_LTO=true cargo rustc -v --release -- -C lto -clang++ $CLANGOPTS -std=c++11 -flto -O2 demo.cpp target/release/libldk.a -ldl +clang++ $CFLAGS -std=c++11 -flto -O2 demo.cpp target/release/libldk.a -ldl strip ./a.out echo "C++ Bin size and runtime with only RL (LTO) optimized:" ls -lha a.out @@ -183,7 +183,7 @@ if [ "$HOST_PLATFORM" != "host: x86_64-apple-darwin" -a "$CLANGPP" != "" ]; then # packaging than simply shipping the rustup binaries (eg Debian should Just Work # here). CARGO_PROFILE_RELEASE_LTO=true cargo rustc -v --release -- -C linker-plugin-lto -C lto -C link-arg=-fuse-ld=lld - $CLANGPP $CLANGOPTS -flto -fuse-ld=lld -O2 demo.cpp target/release/libldk.a -ldl + $CLANGPP $CFLAGS -flto -fuse-ld=lld -O2 demo.cpp target/release/libldk.a -ldl strip ./a.out echo "C++ Bin size and runtime with cross-language LTO:" ls -lha a.out