From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Tue, 19 Apr 2022 23:19:47 +0000 (+0000) Subject: Merge pull request #73 from TheBlueMatt/main X-Git-Tag: v0.0.108.0~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=commitdiff_plain;h=3fafbe3b1625eb163737b705bac7e2f911b53bdb;hp=8b697a686e0ddf11c1e57a68f595deb9329ab16b Merge pull request #73 from TheBlueMatt/main Handle impl blocks outside of the mod of the being-implemented object --- diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 7c7cad3..3814d57 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -43,6 +43,14 @@ use crate::c_types::*; use alloc::{vec::Vec, boxed::Box}; "; + +/// str.rsplit_once but with an older MSRV +fn rsplit_once<'a>(inp: &'a str, pattern: &str) -> Option<(&'a str, &'a str)> { + let mut iter = inp.rsplitn(2, pattern); + let second_entry = iter.next().unwrap(); + Some((iter.next().unwrap(), second_entry)) +} + // ************************************* // *** Manually-expanded conversions *** // ************************************* @@ -54,11 +62,10 @@ 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) = 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))); - } else { return; } + let resolved_path = types.resolve_path(&p.path, Some(generics)); + for_obj = format!("{}", p.path.segments.last().unwrap().ident); + full_obj_path = format!("crate::{}", resolved_path); + has_inner = types.c_type_has_inner_from_path(&resolved_path); } else { // We assume that anything that isn't a Path is somehow a generic that ends up in our // derived-types module. @@ -872,8 +879,12 @@ fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut Typ } 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) { - if let Some(resolved_path) = types.maybe_resolve_non_ignored_ident(&ident) { + let ident = &p.path.segments.last().unwrap().ident; + if let Some(resolved_path) = types.maybe_resolve_path(&p.path, None) { + if types.crate_types.opaques.contains_key(&resolved_path) || types.crate_types.mirrored_enums.contains_key(&resolved_path) || + // At least for core::infallible::Infallible we need to support mapping an + // out-of-crate trait implementation. + (types.understood_c_path(&p.path) && first_seg_is_stdlib(resolved_path.split("::").next().unwrap())) { if !types.understood_c_path(&p.path) { eprintln!("Not implementing anything for impl {} as the type is not understood (probably C-not exported)", ident); return; @@ -1300,7 +1311,8 @@ fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut Typ 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(); + let is_opaque = types.crate_types.opaques.contains_key(&resolved_path); + let is_mirrored_enum = types.crate_types.mirrored_enums.contains_key(&resolved_path); for item in i.items.iter() { match item { syn::ImplItem::Method(m) => { @@ -1318,11 +1330,7 @@ fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut Typ writeln!(w, "#[must_use]").unwrap(); } write!(w, "#[no_mangle]\npub extern \"C\" fn {}_{}(", ident, m.sig.ident).unwrap(); - let ret_type = match &declared_type { - DeclType::MirroredEnum => format!("{}", ident), - DeclType::StructImported {..} => format!("{}", ident), - _ => unimplemented!(), - }; + let ret_type = format!("crate::{}", resolved_path); write_method_params(w, &m.sig, &ret_type, types, Some(&meth_gen_types), false, true); write!(w, " {{\n\t").unwrap(); write_method_var_decl_body(w, &m.sig, "", types, Some(&meth_gen_types), false); @@ -1339,18 +1347,18 @@ fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut Typ if !takes_mut_self && !takes_self { write!(w, "{}::{}(", resolved_path, m.sig.ident).unwrap(); } else { - match &declared_type { - DeclType::MirroredEnum => write!(w, "this_arg.to_native().{}(", m.sig.ident).unwrap(), - DeclType::StructImported {..} => { - if takes_owned_self { - write!(w, "(*unsafe {{ Box::from_raw(this_arg.take_inner()) }}).{}(", m.sig.ident).unwrap(); - } else if takes_mut_self { - write!(w, "unsafe {{ &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut native{})) }}.{}(", ident, m.sig.ident).unwrap(); - } else { - write!(w, "unsafe {{ &*ObjOps::untweak_ptr(this_arg.inner) }}.{}(", m.sig.ident).unwrap(); - } - }, - _ => unimplemented!(), + if is_mirrored_enum { + write!(w, "this_arg.to_native().{}(", m.sig.ident).unwrap(); + } else if is_opaque { + if takes_owned_self { + write!(w, "(*unsafe {{ Box::from_raw(this_arg.take_inner()) }}).{}(", m.sig.ident).unwrap(); + } else if takes_mut_self { + write!(w, "unsafe {{ &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::{}::native{})) }}.{}(", rsplit_once(&resolved_path, "::").unwrap().0, ident, m.sig.ident).unwrap(); + } else { + write!(w, "unsafe {{ &*ObjOps::untweak_ptr(this_arg.inner) }}.{}(", m.sig.ident).unwrap(); + } + } else { + unimplemented!(); } } write_method_call_params(w, &m.sig, "", types, Some(&meth_gen_types), &ret_type, false); @@ -1367,11 +1375,18 @@ fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut Typ if !gen_types.as_mut().unwrap().learn_generics(&i.generics, types) { gen_types = None; } - 'alias_impls: for (alias, arguments) in aliases { + let alias_module = rsplit_once(&resolved_path, "::").unwrap().0; + + 'alias_impls: for (alias_resolved, arguments) in aliases { let mut new_ty_generics = Vec::new(); let mut need_generics = false; - let alias_resolved = types.resolve_path(&alias, None); + let alias_resolver_override; + let alias_resolver = if alias_module != types.module_path { + alias_resolver_override = ImportResolver::new(types.types.crate_name, &types.crate_types.lib_ast.dependencies, + alias_module, &types.crate_types.lib_ast.modules.get(alias_module).unwrap().items); + &alias_resolver_override + } else { &types.types };/*.maybe_resolve_path(&alias, None).unwrap();*/ for (idx, gen) in i.generics.params.iter().enumerate() { match gen { syn::GenericParam::Type(type_param) => { @@ -1380,10 +1395,11 @@ fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut Typ if let syn::PathArguments::AngleBracketed(ref t) = &arguments { assert!(idx < t.args.len()); if let syn::GenericArgument::Type(syn::Type::Path(p)) = &t.args[idx] { - if let Some(generic_arg) = types.maybe_resolve_path(&p.path, None) { + if let Some(generic_arg) = alias_resolver.maybe_resolve_path(&p.path, None) { new_ty_generics.push((type_param.ident.clone(), syn::Type::Path(p.clone()))); - let generic_bound = types.resolve_path(&trait_bound.path, None); + let generic_bound = types.maybe_resolve_path(&trait_bound.path, None) + .unwrap_or_else(|| format!("{}::{}", types.module_path, single_ident_generic_path_to_ident(&trait_bound.path).unwrap())); if let Some(traits_impld) = types.crate_types.trait_impls.get(&generic_arg) { for trait_impld in traits_impld { if *trait_impld == generic_bound { continue 'bounds_check; } @@ -1411,6 +1427,7 @@ fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut Typ } } let mut params = syn::punctuated::Punctuated::new(); + let alias = string_path_to_syn_path(&alias_resolved); let real_aliased = if need_generics { let alias_generics = types.crate_types.opaques.get(&alias_resolved).unwrap().1; @@ -1776,11 +1793,7 @@ fn convert_priv_mod<'a, 'b: 'a, W: std::io::Write>(w: &mut W, libast: &'b FullLi match item { syn::Item::Mod(m) => convert_priv_mod(w, libast, crate_types, out_dir, &format!("{}::{}", mod_path, module.ident), m), syn::Item::Impl(i) => { - if let &syn::Type::Path(ref p) = &*i.self_ty { - if p.path.get_ident().is_some() { - writeln_impl(w, i, &mut types); - } - } + writeln_impl(w, i, &mut types); }, _ => {}, } @@ -2022,17 +2035,14 @@ fn walk_ast<'a>(ast_storage: &'a FullLibraryAST, crate_types: &mut CrateTypes<'a let type_path = format!("{}::{}", module, t.ident); match &*t.ty { syn::Type::Path(p) => { - let t_ident = &t.ident; - // If its a path with no generics, assume we don't map the aliased type and map it opaque - let path_obj = parse_quote!(#t_ident); let args_obj = p.path.segments.last().unwrap().arguments.clone(); match crate_types.reverse_alias_map.entry(import_resolver.maybe_resolve_path(&p.path, None).unwrap()) { - hash_map::Entry::Occupied(mut e) => { e.get_mut().push((path_obj, args_obj)); }, - hash_map::Entry::Vacant(e) => { e.insert(vec![(path_obj, args_obj)]); }, + hash_map::Entry::Occupied(mut e) => { e.get_mut().push((type_path.clone(), args_obj)); }, + hash_map::Entry::Vacant(e) => { e.insert(vec![(type_path.clone(), args_obj)]); }, } - crate_types.opaques.insert(type_path, (t_ident, &t.generics)); + crate_types.opaques.insert(type_path, (&t.ident, &t.generics)); }, _ => { crate_types.type_aliases.insert(type_path, import_resolver.resolve_imported_refs((*t.ty).clone())); diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index da2d180..6a2bb56 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -65,6 +65,17 @@ pub fn path_matches_nongeneric(p: &syn::Path, exp: &[&str]) -> bool { true } +pub fn string_path_to_syn_path(path: &str) -> syn::Path { + let mut segments = syn::punctuated::Punctuated::new(); + for seg in path.split("::") { + segments.push(syn::PathSegment { + ident: syn::Ident::new(seg, Span::call_site()), + arguments: syn::PathArguments::None, + }); + } + syn::Path { leading_colon: Some(syn::Token![::](Span::call_site())), segments } +} + #[derive(Debug, PartialEq)] pub enum ExportStatus { Export, @@ -391,7 +402,7 @@ pub enum DeclType<'a> { } pub struct ImportResolver<'mod_lifetime, 'crate_lft: 'mod_lifetime> { - crate_name: &'mod_lifetime str, + pub crate_name: &'mod_lifetime str, dependencies: &'mod_lifetime HashSet, module_path: &'mod_lifetime str, imports: HashMap, @@ -546,10 +557,6 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr Self { crate_name, dependencies, module_path, imports, declared, priv_modules } } - pub fn get_declared_type(&self, ident: &syn::Ident) -> Option<&DeclType<'crate_lft>> { - self.declared.get(ident) - } - pub fn maybe_resolve_declared(&self, id: &syn::Ident) -> Option<&DeclType<'crate_lft>> { self.declared.get(id) } @@ -562,17 +569,6 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr } else { None } } - pub fn maybe_resolve_non_ignored_ident(&self, id: &syn::Ident) -> Option { - if let Some((imp, _)) = self.imports.get(id) { - Some(imp.clone()) - } else if let Some(decl_type) = self.declared.get(id) { - match decl_type { - DeclType::StructIgnored => None, - _ => Some(self.module_path.to_string() + "::" + &format!("{}", id)), - } - } else { None } - } - pub fn maybe_resolve_path(&self, p: &syn::Path, generics: Option<&GenericTypes>) -> Option { if let Some(gen_types) = generics { if let Some(resp) = gen_types.maybe_resolve_path(p) { @@ -741,7 +737,7 @@ pub struct CrateTypes<'a> { /// Aliases from paths to some other Type pub type_aliases: HashMap, /// Value is an alias to Key (maybe with some generics) - pub reverse_alias_map: HashMap>, + pub reverse_alias_map: HashMap>, /// Template continer types defined, map from mangled type name -> whether a destructor fn /// exists. /// @@ -785,7 +781,7 @@ impl<'a> CrateTypes<'a> { pub struct TypeResolver<'mod_lifetime, 'crate_lft: 'mod_lifetime> { pub module_path: &'mod_lifetime str, pub crate_types: &'mod_lifetime CrateTypes<'crate_lft>, - types: ImportResolver<'mod_lifetime, 'crate_lft>, + pub types: ImportResolver<'mod_lifetime, 'crate_lft>, } /// Returned by write_empty_rust_val_check_suffix to indicate what type of dereferencing needs to @@ -1583,9 +1579,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { // *** Type definition during main.rs processing *** // ************************************************* - pub fn get_declared_type(&'a self, ident: &syn::Ident) -> Option<&'a DeclType<'c>> { - self.types.get_declared_type(ident) - } /// Returns true if the object at the given path is mapped as X { inner: *mut origX, .. }. pub fn c_type_has_inner_from_path(&self, full_path: &str) -> bool { self.crate_types.opaques.get(full_path).is_some() @@ -1610,10 +1603,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { self.types.maybe_resolve_ident(id) } - pub fn maybe_resolve_non_ignored_ident(&self, id: &syn::Ident) -> Option { - self.types.maybe_resolve_non_ignored_ident(id) - } - pub fn maybe_resolve_path(&self, p_arg: &syn::Path, generics: Option<&GenericTypes>) -> Option { self.types.maybe_resolve_path(p_arg, generics) } @@ -2874,7 +2863,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { assert!(self.write_c_type_intern(w, t, generics, false, false, ptr_for_ref, true, false)); } pub fn understood_c_path(&self, p: &syn::Path) -> bool { - if p.leading_colon.is_some() { return false; } self.write_c_path_intern(&mut std::io::sink(), p, None, false, false, false, false, true) } pub fn understood_c_type(&self, t: &syn::Type, generics: Option<&GenericTypes>) -> bool { diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index cb929f6..5a1ea3c 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -24099,6 +24099,541 @@ struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures */ struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); +/** + * Set this feature as optional. + */ +void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + /** * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL. */ diff --git a/lightning-c-bindings/src/lightning/chain/chainmonitor.rs b/lightning-c-bindings/src/lightning/chain/chainmonitor.rs index a0e8bcc..caf7d6d 100644 --- a/lightning-c-bindings/src/lightning/chain/chainmonitor.rs +++ b/lightning-c-bindings/src/lightning/chain/chainmonitor.rs @@ -368,10 +368,10 @@ impl ChainMonitor { /// transactions relevant to the watched channels. #[must_use] #[no_mangle] -pub extern "C" fn ChainMonitor_new(mut chain_source: crate::c_types::derived::COption_FilterZ, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut logger: crate::lightning::util::logger::Logger, mut feeest: crate::lightning::chain::chaininterface::FeeEstimator, mut persister: crate::lightning::chain::chainmonitor::Persist) -> ChainMonitor { +pub extern "C" fn ChainMonitor_new(mut chain_source: crate::c_types::derived::COption_FilterZ, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut logger: crate::lightning::util::logger::Logger, mut feeest: crate::lightning::chain::chaininterface::FeeEstimator, mut persister: crate::lightning::chain::chainmonitor::Persist) -> crate::lightning::chain::chainmonitor::ChainMonitor { let mut local_chain_source = { /* chain_source*/ let chain_source_opt = chain_source; { } if chain_source_opt.is_none() { None } else { Some({ chain_source_opt.take() }) } }; let mut ret = lightning::chain::chainmonitor::ChainMonitor::new(local_chain_source, broadcaster, logger, feeest, persister); - ChainMonitor { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::chain::chainmonitor::ChainMonitor { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or @@ -385,7 +385,7 @@ pub extern "C" fn ChainMonitor_new(mut chain_source: crate::c_types::derived::CO /// inclusion in the return value. #[must_use] #[no_mangle] -pub extern "C" fn ChainMonitor_get_claimable_balances(this_arg: &ChainMonitor, mut ignored_channels: crate::c_types::derived::CVec_ChannelDetailsZ) -> crate::c_types::derived::CVec_BalanceZ { +pub extern "C" fn ChainMonitor_get_claimable_balances(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor, mut ignored_channels: crate::c_types::derived::CVec_ChannelDetailsZ) -> crate::c_types::derived::CVec_BalanceZ { let mut local_ignored_channels = Vec::new(); for mut item in ignored_channels.as_slice().iter() { local_ignored_channels.push( { item.get_native_ref() }); }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_claimable_balances(&local_ignored_channels[..]); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::chain::channelmonitor::Balance::native_into(item) }); }; @@ -399,7 +399,7 @@ pub extern "C" fn ChainMonitor_get_claimable_balances(this_arg: &ChainMonitor, m /// indefinitely. #[must_use] #[no_mangle] -pub extern "C" fn ChainMonitor_get_monitor(this_arg: &ChainMonitor, mut funding_txo: crate::lightning::chain::transaction::OutPoint) -> crate::c_types::derived::CResult_LockedChannelMonitorNoneZ { +pub extern "C" fn ChainMonitor_get_monitor(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor, mut funding_txo: crate::lightning::chain::transaction::OutPoint) -> crate::c_types::derived::CResult_LockedChannelMonitorNoneZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_monitor(*unsafe { Box::from_raw(funding_txo.take_inner()) }); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::chainmonitor::LockedChannelMonitor { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret @@ -411,7 +411,7 @@ pub extern "C" fn ChainMonitor_get_monitor(this_arg: &ChainMonitor, mut funding_ /// monitoring for on-chain state resolutions. #[must_use] #[no_mangle] -pub extern "C" fn ChainMonitor_list_monitors(this_arg: &ChainMonitor) -> crate::c_types::derived::CVec_OutPointZ { +pub extern "C" fn ChainMonitor_list_monitors(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor) -> crate::c_types::derived::CVec_OutPointZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.list_monitors(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret.into() @@ -432,7 +432,7 @@ pub extern "C" fn ChainMonitor_list_monitors(this_arg: &ChainMonitor) -> crate:: /// registered [`ChannelMonitor`]s. #[must_use] #[no_mangle] -pub extern "C" fn ChainMonitor_channel_monitor_updated(this_arg: &ChainMonitor, mut funding_txo: crate::lightning::chain::transaction::OutPoint, mut completed_update_id: crate::lightning::chain::chainmonitor::MonitorUpdateId) -> crate::c_types::derived::CResult_NoneAPIErrorZ { +pub extern "C" fn ChainMonitor_channel_monitor_updated(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor, mut funding_txo: crate::lightning::chain::transaction::OutPoint, mut completed_update_id: crate::lightning::chain::chainmonitor::MonitorUpdateId) -> crate::c_types::derived::CResult_NoneAPIErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_monitor_updated(*unsafe { Box::from_raw(funding_txo.take_inner()) }, *unsafe { Box::from_raw(completed_update_id.take_inner()) }); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_ret diff --git a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs index da82fb9..0fa366b 100644 --- a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs +++ b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs @@ -141,7 +141,7 @@ pub extern "C" fn ChannelMonitorUpdate_clone(orig: &ChannelMonitorUpdate) -> Cha pub static CLOSED_CHANNEL_UPDATE_ID: u64 = lightning::chain::channelmonitor::CLOSED_CHANNEL_UPDATE_ID; #[no_mangle] /// Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read -pub extern "C" fn ChannelMonitorUpdate_write(obj: &ChannelMonitorUpdate) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelMonitorUpdate_write(obj: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -334,7 +334,7 @@ pub extern "C" fn MonitorEvent_update_failed(a: crate::lightning::chain::transac } #[no_mangle] /// Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read -pub extern "C" fn MonitorEvent_write(obj: &MonitorEvent) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn MonitorEvent_write(obj: &crate::lightning::chain::channelmonitor::MonitorEvent) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) } #[no_mangle] @@ -418,7 +418,7 @@ pub extern "C" fn HTLCUpdate_clone(orig: &HTLCUpdate) -> HTLCUpdate { } #[no_mangle] /// Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read -pub extern "C" fn HTLCUpdate_write(obj: &HTLCUpdate) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn HTLCUpdate_write(obj: &crate::lightning::chain::channelmonitor::HTLCUpdate) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -737,7 +737,7 @@ impl ChannelMonitor { } #[no_mangle] /// Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read -pub extern "C" fn ChannelMonitor_write(obj: &ChannelMonitor) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelMonitor_write(obj: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -750,7 +750,7 @@ pub(crate) extern "C" fn ChannelMonitor_write_void(obj: *const c_void) -> crate: /// panics if the given update is not the next update by update_id. #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_update_monitor(this_arg: &ChannelMonitor, updates: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, broadcaster: &crate::lightning::chain::chaininterface::BroadcasterInterface, fee_estimator: &crate::lightning::chain::chaininterface::FeeEstimator, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_NoneNoneZ { +pub extern "C" fn ChannelMonitor_update_monitor(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, updates: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, broadcaster: &crate::lightning::chain::chaininterface::BroadcasterInterface, fee_estimator: &crate::lightning::chain::chaininterface::FeeEstimator, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_NoneNoneZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_monitor(updates.get_native_ref(), broadcaster, fee_estimator, logger); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret @@ -760,7 +760,7 @@ pub extern "C" fn ChannelMonitor_update_monitor(this_arg: &ChannelMonitor, updat /// ChannelMonitor. #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_get_latest_update_id(this_arg: &ChannelMonitor) -> u64 { +pub extern "C" fn ChannelMonitor_get_latest_update_id(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_latest_update_id(); ret } @@ -768,7 +768,7 @@ pub extern "C" fn ChannelMonitor_get_latest_update_id(this_arg: &ChannelMonitor) /// Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for. #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_get_funding_txo(this_arg: &ChannelMonitor) -> crate::c_types::derived::C2Tuple_OutPointScriptZ { +pub extern "C" fn ChannelMonitor_get_funding_txo(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::C2Tuple_OutPointScriptZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_funding_txo(); let (mut orig_ret_0, mut orig_ret_1) = ret; let mut local_ret = (crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(orig_ret_0), is_owned: true }, orig_ret_1.into_bytes().into()).into(); local_ret @@ -778,7 +778,7 @@ pub extern "C" fn ChannelMonitor_get_funding_txo(this_arg: &ChannelMonitor) -> c /// transaction), which we must learn about spends of via block_connected(). #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_get_outputs_to_watch(this_arg: &ChannelMonitor) -> crate::c_types::derived::CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { +pub extern "C" fn ChannelMonitor_get_outputs_to_watch(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_outputs_to_watch(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { let (mut orig_orig_ret_0_1_0_0, mut orig_orig_ret_0_1_0_1) = item; let mut local_orig_ret_0_1_0 = (orig_orig_ret_0_1_0_0, orig_orig_ret_0_1_0_1.into_bytes().into()).into(); local_orig_ret_0_1_0 }); }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1.into()).into(); local_ret_0 }); }; local_ret.into() @@ -788,7 +788,7 @@ pub extern "C" fn ChannelMonitor_get_outputs_to_watch(this_arg: &ChannelMonitor) /// calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs /// have been registered. #[no_mangle] -pub extern "C" fn ChannelMonitor_load_outputs_to_watch(this_arg: &ChannelMonitor, filter: &crate::lightning::chain::Filter) { +pub extern "C" fn ChannelMonitor_load_outputs_to_watch(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, filter: &crate::lightning::chain::Filter) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.load_outputs_to_watch(filter) } @@ -796,7 +796,7 @@ pub extern "C" fn ChannelMonitor_load_outputs_to_watch(this_arg: &ChannelMonitor /// ChannelManager via [`chain::Watch::release_pending_monitor_events`]. #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg: &ChannelMonitor) -> crate::c_types::derived::CVec_MonitorEventZ { +pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_MonitorEventZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_and_clear_pending_monitor_events(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::chain::channelmonitor::MonitorEvent::native_into(item) }); }; local_ret.into() @@ -810,7 +810,7 @@ pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg: /// no internal locking in ChannelMonitors. #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_get_and_clear_pending_events(this_arg: &ChannelMonitor) -> crate::c_types::derived::CVec_EventZ { +pub extern "C" fn ChannelMonitor_get_and_clear_pending_events(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_EventZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_and_clear_pending_events(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::util::events::Event::native_into(item) }); }; local_ret.into() @@ -827,7 +827,7 @@ pub extern "C" fn ChannelMonitor_get_and_clear_pending_events(this_arg: &Channel /// In any-case, choice is up to the user. #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &ChannelMonitor, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionZ { +pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_latest_holder_commitment_txn(logger); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::Transaction::from_bitcoin(&item) }); }; local_ret.into() @@ -846,7 +846,7 @@ pub extern "C" fn ChannelMonitor_get_latest_holder_commitment_txn(this_arg: &Cha /// [`get_outputs_to_watch`]: #method.get_outputs_to_watch #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_block_connected(this_arg: &ChannelMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ { +pub extern "C" fn ChannelMonitor_block_connected(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ { let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.block_connected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::>()[..], height, broadcaster, fee_estimator, logger); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { let (mut orig_orig_ret_0_1_0_0, mut orig_orig_ret_0_1_0_1) = item; let mut local_orig_ret_0_1_0 = (orig_orig_ret_0_1_0_0, crate::c_types::TxOut::from_rust(orig_orig_ret_0_1_0_1)).into(); local_orig_ret_0_1_0 }); }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1.into()).into(); local_ret_0 }); }; @@ -856,7 +856,7 @@ pub extern "C" fn ChannelMonitor_block_connected(this_arg: &ChannelMonitor, head /// Determines if the disconnected block contained any transactions of interest and updates /// appropriately. #[no_mangle] -pub extern "C" fn ChannelMonitor_block_disconnected(this_arg: &ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) { +pub extern "C" fn ChannelMonitor_block_disconnected(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, broadcaster, fee_estimator, logger) } @@ -869,7 +869,7 @@ pub extern "C" fn ChannelMonitor_block_disconnected(this_arg: &ChannelMonitor, h /// [`block_connected`]: Self::block_connected #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_transactions_confirmed(this_arg: &ChannelMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ { +pub extern "C" fn ChannelMonitor_transactions_confirmed(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ { let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.transactions_confirmed(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::>()[..], height, broadcaster, fee_estimator, logger); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { let (mut orig_orig_ret_0_1_0_0, mut orig_orig_ret_0_1_0_1) = item; let mut local_orig_ret_0_1_0 = (orig_orig_ret_0_1_0_0, crate::c_types::TxOut::from_rust(orig_orig_ret_0_1_0_1)).into(); local_orig_ret_0_1_0 }); }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1.into()).into(); local_ret_0 }); }; @@ -883,7 +883,7 @@ pub extern "C" fn ChannelMonitor_transactions_confirmed(this_arg: &ChannelMonito /// /// [`block_disconnected`]: Self::block_disconnected #[no_mangle] -pub extern "C" fn ChannelMonitor_transaction_unconfirmed(this_arg: &ChannelMonitor, txid: *const [u8; 32], mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) { +pub extern "C" fn ChannelMonitor_transaction_unconfirmed(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, txid: *const [u8; 32], mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.transaction_unconfirmed(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap(), broadcaster, fee_estimator, logger) } @@ -896,7 +896,7 @@ pub extern "C" fn ChannelMonitor_transaction_unconfirmed(this_arg: &ChannelMonit /// [`block_connected`]: Self::block_connected #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_best_block_updated(this_arg: &ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ { +pub extern "C" fn ChannelMonitor_best_block_updated(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut logger: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CVec_TransactionOutputsZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.best_block_updated(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, broadcaster, fee_estimator, logger); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { let (mut orig_orig_ret_0_1_0_0, mut orig_orig_ret_0_1_0_1) = item; let mut local_orig_ret_0_1_0 = (orig_orig_ret_0_1_0_0, crate::c_types::TxOut::from_rust(orig_orig_ret_0_1_0_1)).into(); local_orig_ret_0_1_0 }); }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1.into()).into(); local_ret_0 }); }; local_ret.into() @@ -905,7 +905,7 @@ pub extern "C" fn ChannelMonitor_best_block_updated(this_arg: &ChannelMonitor, h /// Returns the set of txids that should be monitored for re-organization out of the chain. #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_get_relevant_txids(this_arg: &ChannelMonitor) -> crate::c_types::derived::CVec_TxidZ { +pub extern "C" fn ChannelMonitor_get_relevant_txids(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_TxidZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_relevant_txids(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.into_inner() } }); }; local_ret.into() @@ -915,7 +915,7 @@ pub extern "C" fn ChannelMonitor_get_relevant_txids(this_arg: &ChannelMonitor) - /// [`chain::Confirm`] interfaces. #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_current_best_block(this_arg: &ChannelMonitor) -> crate::lightning::chain::BestBlock { +pub extern "C" fn ChannelMonitor_current_best_block(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::BestBlock { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.current_best_block(); crate::lightning::chain::BestBlock { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -936,7 +936,7 @@ pub extern "C" fn ChannelMonitor_current_best_block(this_arg: &ChannelMonitor) - /// may be returned here and their meanings. #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_get_claimable_balances(this_arg: &ChannelMonitor) -> crate::c_types::derived::CVec_BalanceZ { +pub extern "C" fn ChannelMonitor_get_claimable_balances(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_BalanceZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_claimable_balances(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::chain::channelmonitor::Balance::native_into(item) }); }; local_ret.into() diff --git a/lightning-c-bindings/src/lightning/chain/keysinterface.rs b/lightning-c-bindings/src/lightning/chain/keysinterface.rs index bb0b207..0e7e37d 100644 --- a/lightning-c-bindings/src/lightning/chain/keysinterface.rs +++ b/lightning-c-bindings/src/lightning/chain/keysinterface.rs @@ -184,7 +184,7 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_clone(orig: &DelayedPaymentOutp } #[no_mangle] /// Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read -pub extern "C" fn DelayedPaymentOutputDescriptor_write(obj: &DelayedPaymentOutputDescriptor) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn DelayedPaymentOutputDescriptor_write(obj: &crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -324,7 +324,7 @@ pub extern "C" fn StaticPaymentOutputDescriptor_clone(orig: &StaticPaymentOutput } #[no_mangle] /// Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read -pub extern "C" fn StaticPaymentOutputDescriptor_write(obj: &StaticPaymentOutputDescriptor) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn StaticPaymentOutputDescriptor_write(obj: &crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -519,7 +519,7 @@ pub extern "C" fn SpendableOutputDescriptor_static_payment_output(a: crate::ligh } #[no_mangle] /// Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read -pub extern "C" fn SpendableOutputDescriptor_write(obj: &SpendableOutputDescriptor) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn SpendableOutputDescriptor_write(obj: &crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) } #[no_mangle] @@ -1329,7 +1329,7 @@ pub extern "C" fn InMemorySigner_new(mut node_secret: crate::c_types::SecretKey, /// Will panic if ready_channel wasn't called. #[must_use] #[no_mangle] -pub extern "C" fn InMemorySigner_counterparty_pubkeys(this_arg: &InMemorySigner) -> crate::lightning::ln::chan_utils::ChannelPublicKeys { +pub extern "C" fn InMemorySigner_counterparty_pubkeys(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> crate::lightning::ln::chan_utils::ChannelPublicKeys { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.counterparty_pubkeys(); crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::ChannelPublicKeys<>) as *mut _) }, is_owned: false } } @@ -1340,7 +1340,7 @@ pub extern "C" fn InMemorySigner_counterparty_pubkeys(this_arg: &InMemorySigner) /// Will panic if ready_channel wasn't called. #[must_use] #[no_mangle] -pub extern "C" fn InMemorySigner_counterparty_selected_contest_delay(this_arg: &InMemorySigner) -> u16 { +pub extern "C" fn InMemorySigner_counterparty_selected_contest_delay(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> u16 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.counterparty_selected_contest_delay(); ret } @@ -1351,7 +1351,7 @@ pub extern "C" fn InMemorySigner_counterparty_selected_contest_delay(this_arg: & /// Will panic if ready_channel wasn't called. #[must_use] #[no_mangle] -pub extern "C" fn InMemorySigner_holder_selected_contest_delay(this_arg: &InMemorySigner) -> u16 { +pub extern "C" fn InMemorySigner_holder_selected_contest_delay(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> u16 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.holder_selected_contest_delay(); ret } @@ -1360,7 +1360,7 @@ pub extern "C" fn InMemorySigner_holder_selected_contest_delay(this_arg: &InMemo /// Will panic if ready_channel wasn't called. #[must_use] #[no_mangle] -pub extern "C" fn InMemorySigner_is_outbound(this_arg: &InMemorySigner) -> bool { +pub extern "C" fn InMemorySigner_is_outbound(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_outbound(); ret } @@ -1369,7 +1369,7 @@ pub extern "C" fn InMemorySigner_is_outbound(this_arg: &InMemorySigner) -> bool /// Will panic if ready_channel wasn't called. #[must_use] #[no_mangle] -pub extern "C" fn InMemorySigner_funding_outpoint(this_arg: &InMemorySigner) -> crate::lightning::chain::transaction::OutPoint { +pub extern "C" fn InMemorySigner_funding_outpoint(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> crate::lightning::chain::transaction::OutPoint { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.funding_outpoint(); crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::chain::transaction::OutPoint<>) as *mut _) }, is_owned: false } } @@ -1380,7 +1380,7 @@ pub extern "C" fn InMemorySigner_funding_outpoint(this_arg: &InMemorySigner) -> /// Will panic if ready_channel wasn't called. #[must_use] #[no_mangle] -pub extern "C" fn InMemorySigner_get_channel_parameters(this_arg: &InMemorySigner) -> crate::lightning::ln::chan_utils::ChannelTransactionParameters { +pub extern "C" fn InMemorySigner_get_channel_parameters(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> crate::lightning::ln::chan_utils::ChannelTransactionParameters { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_channel_parameters(); crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false } } @@ -1389,7 +1389,7 @@ pub extern "C" fn InMemorySigner_get_channel_parameters(this_arg: &InMemorySigne /// Will panic if ready_channel wasn't called. #[must_use] #[no_mangle] -pub extern "C" fn InMemorySigner_opt_anchors(this_arg: &InMemorySigner) -> bool { +pub extern "C" fn InMemorySigner_opt_anchors(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.opt_anchors(); ret } @@ -1402,7 +1402,7 @@ pub extern "C" fn InMemorySigner_opt_anchors(this_arg: &InMemorySigner) -> bool /// or if an output descriptor script_pubkey does not match the one we can spend. #[must_use] #[no_mangle] -pub extern "C" fn InMemorySigner_sign_counterparty_payment_input(this_arg: &InMemorySigner, mut spend_tx: crate::c_types::Transaction, mut input_idx: usize, descriptor: &crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> crate::c_types::derived::CResult_CVec_CVec_u8ZZNoneZ { +pub extern "C" fn InMemorySigner_sign_counterparty_payment_input(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner, mut spend_tx: crate::c_types::Transaction, mut input_idx: usize, descriptor: &crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> crate::c_types::derived::CResult_CVec_CVec_u8ZZNoneZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_counterparty_payment_input(&spend_tx.into_bitcoin(), input_idx, descriptor.get_native_ref(), secp256k1::SECP256K1); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = Vec::new(); for mut item in o.drain(..) { local_ret_0.push( { let mut local_ret_0_0 = Vec::new(); for mut item in item.drain(..) { local_ret_0_0.push( { item }); }; local_ret_0_0.into() }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret @@ -1417,7 +1417,7 @@ pub extern "C" fn InMemorySigner_sign_counterparty_payment_input(this_arg: &InMe /// script_pubkey does not match the one we can spend. #[must_use] #[no_mangle] -pub extern "C" fn InMemorySigner_sign_dynamic_p2wsh_input(this_arg: &InMemorySigner, mut spend_tx: crate::c_types::Transaction, mut input_idx: usize, descriptor: &crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> crate::c_types::derived::CResult_CVec_CVec_u8ZZNoneZ { +pub extern "C" fn InMemorySigner_sign_dynamic_p2wsh_input(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner, mut spend_tx: crate::c_types::Transaction, mut input_idx: usize, descriptor: &crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> crate::c_types::derived::CResult_CVec_CVec_u8ZZNoneZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_dynamic_p2wsh_input(&spend_tx.into_bitcoin(), input_idx, descriptor.get_native_ref(), secp256k1::SECP256K1); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = Vec::new(); for mut item in o.drain(..) { local_ret_0.push( { let mut local_ret_0_0 = Vec::new(); for mut item in item.drain(..) { local_ret_0_0.push( { item }); }; local_ret_0_0.into() }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret @@ -1597,7 +1597,7 @@ extern "C" fn Sign_InMemorySigner_cloned(new_obj: &mut crate::lightning::chain:: #[no_mangle] /// Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read -pub extern "C" fn InMemorySigner_write(obj: &InMemorySigner) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn InMemorySigner_write(obj: &crate::lightning::chain::keysinterface::InMemorySigner) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1696,9 +1696,9 @@ impl KeysManager { /// detailed description of the guarantee. #[must_use] #[no_mangle] -pub extern "C" fn KeysManager_new(seed: *const [u8; 32], mut starting_time_secs: u64, mut starting_time_nanos: u32) -> KeysManager { +pub extern "C" fn KeysManager_new(seed: *const [u8; 32], mut starting_time_secs: u64, mut starting_time_nanos: u32) -> crate::lightning::chain::keysinterface::KeysManager { let mut ret = lightning::chain::keysinterface::KeysManager::new(unsafe { &*seed}, starting_time_secs, starting_time_nanos); - KeysManager { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::chain::keysinterface::KeysManager { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Derive an old Sign containing per-channel secrets based on a key derivation parameters. @@ -1708,7 +1708,7 @@ pub extern "C" fn KeysManager_new(seed: *const [u8; 32], mut starting_time_secs: /// onchain output detection for which a corresponding delayed_payment_key must be derived. #[must_use] #[no_mangle] -pub extern "C" fn KeysManager_derive_channel_keys(this_arg: &KeysManager, mut channel_value_satoshis: u64, params: *const [u8; 32]) -> crate::lightning::chain::keysinterface::InMemorySigner { +pub extern "C" fn KeysManager_derive_channel_keys(this_arg: &crate::lightning::chain::keysinterface::KeysManager, mut channel_value_satoshis: u64, params: *const [u8; 32]) -> crate::lightning::chain::keysinterface::InMemorySigner { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.derive_channel_keys(channel_value_satoshis, unsafe { &*params}); crate::lightning::chain::keysinterface::InMemorySigner { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -1727,7 +1727,7 @@ pub extern "C" fn KeysManager_derive_channel_keys(this_arg: &KeysManager, mut ch /// this KeysManager or one of the `InMemorySigner` created by this KeysManager. #[must_use] #[no_mangle] -pub extern "C" fn KeysManager_spend_spendable_outputs(this_arg: &KeysManager, mut descriptors: crate::c_types::derived::CVec_SpendableOutputDescriptorZ, mut outputs: crate::c_types::derived::CVec_TxOutZ, mut change_destination_script: crate::c_types::derived::CVec_u8Z, mut feerate_sat_per_1000_weight: u32) -> crate::c_types::derived::CResult_TransactionNoneZ { +pub extern "C" fn KeysManager_spend_spendable_outputs(this_arg: &crate::lightning::chain::keysinterface::KeysManager, mut descriptors: crate::c_types::derived::CVec_SpendableOutputDescriptorZ, mut outputs: crate::c_types::derived::CVec_TxOutZ, mut change_destination_script: crate::c_types::derived::CVec_u8Z, mut feerate_sat_per_1000_weight: u32) -> crate::c_types::derived::CResult_TransactionNoneZ { let mut local_descriptors = Vec::new(); for mut item in descriptors.into_rust().drain(..) { local_descriptors.push( { item.into_native() }); }; let mut local_outputs = Vec::new(); for mut item in outputs.into_rust().drain(..) { local_outputs.push( { item.into_rust() }); }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.spend_spendable_outputs(&local_descriptors.iter().collect::>()[..], local_outputs, ::bitcoin::blockdata::script::Script::from(change_destination_script.into_rust()), feerate_sat_per_1000_weight, secp256k1::SECP256K1); @@ -1958,15 +1958,15 @@ extern "C" fn PhantomKeysManager_KeysInterface_sign_invoice(this_arg: *const c_v /// [phantom node payments]: PhantomKeysManager #[must_use] #[no_mangle] -pub extern "C" fn PhantomKeysManager_new(seed: *const [u8; 32], mut starting_time_secs: u64, mut starting_time_nanos: u32, cross_node_seed: *const [u8; 32]) -> PhantomKeysManager { +pub extern "C" fn PhantomKeysManager_new(seed: *const [u8; 32], mut starting_time_secs: u64, mut starting_time_nanos: u32, cross_node_seed: *const [u8; 32]) -> crate::lightning::chain::keysinterface::PhantomKeysManager { let mut ret = lightning::chain::keysinterface::PhantomKeysManager::new(unsafe { &*seed}, starting_time_secs, starting_time_nanos, unsafe { &*cross_node_seed}); - PhantomKeysManager { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::chain::keysinterface::PhantomKeysManager { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// See [`KeysManager::spend_spendable_outputs`] for documentation on this method. #[must_use] #[no_mangle] -pub extern "C" fn PhantomKeysManager_spend_spendable_outputs(this_arg: &PhantomKeysManager, mut descriptors: crate::c_types::derived::CVec_SpendableOutputDescriptorZ, mut outputs: crate::c_types::derived::CVec_TxOutZ, mut change_destination_script: crate::c_types::derived::CVec_u8Z, mut feerate_sat_per_1000_weight: u32) -> crate::c_types::derived::CResult_TransactionNoneZ { +pub extern "C" fn PhantomKeysManager_spend_spendable_outputs(this_arg: &crate::lightning::chain::keysinterface::PhantomKeysManager, mut descriptors: crate::c_types::derived::CVec_SpendableOutputDescriptorZ, mut outputs: crate::c_types::derived::CVec_TxOutZ, mut change_destination_script: crate::c_types::derived::CVec_u8Z, mut feerate_sat_per_1000_weight: u32) -> crate::c_types::derived::CResult_TransactionNoneZ { let mut local_descriptors = Vec::new(); for mut item in descriptors.into_rust().drain(..) { local_descriptors.push( { item.into_native() }); }; let mut local_outputs = Vec::new(); for mut item in outputs.into_rust().drain(..) { local_outputs.push( { item.into_rust() }); }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.spend_spendable_outputs(&local_descriptors.iter().collect::>()[..], local_outputs, ::bitcoin::blockdata::script::Script::from(change_destination_script.into_rust()), feerate_sat_per_1000_weight, secp256k1::SECP256K1); @@ -1977,7 +1977,7 @@ pub extern "C" fn PhantomKeysManager_spend_spendable_outputs(this_arg: &PhantomK /// See [`KeysManager::derive_channel_keys`] for documentation on this method. #[must_use] #[no_mangle] -pub extern "C" fn PhantomKeysManager_derive_channel_keys(this_arg: &PhantomKeysManager, mut channel_value_satoshis: u64, params: *const [u8; 32]) -> crate::lightning::chain::keysinterface::InMemorySigner { +pub extern "C" fn PhantomKeysManager_derive_channel_keys(this_arg: &crate::lightning::chain::keysinterface::PhantomKeysManager, mut channel_value_satoshis: u64, params: *const [u8; 32]) -> crate::lightning::chain::keysinterface::InMemorySigner { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.derive_channel_keys(channel_value_satoshis, unsafe { &*params}); crate::lightning::chain::keysinterface::InMemorySigner { inner: ObjOps::heap_alloc(ret), is_owned: true } } diff --git a/lightning-c-bindings/src/lightning/chain/mod.rs b/lightning-c-bindings/src/lightning/chain/mod.rs index c5e857a..7dfbcdb 100644 --- a/lightning-c-bindings/src/lightning/chain/mod.rs +++ b/lightning-c-bindings/src/lightning/chain/mod.rs @@ -117,23 +117,23 @@ pub extern "C" fn BestBlock_clone(orig: &BestBlock) -> BestBlock { /// network. #[must_use] #[no_mangle] -pub extern "C" fn BestBlock_from_genesis(mut network: crate::bitcoin::network::Network) -> BestBlock { +pub extern "C" fn BestBlock_from_genesis(mut network: crate::bitcoin::network::Network) -> crate::lightning::chain::BestBlock { let mut ret = lightning::chain::BestBlock::from_genesis(network.into_bitcoin()); - BestBlock { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::chain::BestBlock { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Returns a `BestBlock` as identified by the given block hash and height. #[must_use] #[no_mangle] -pub extern "C" fn BestBlock_new(mut block_hash: crate::c_types::ThirtyTwoBytes, mut height: u32) -> BestBlock { +pub extern "C" fn BestBlock_new(mut block_hash: crate::c_types::ThirtyTwoBytes, mut height: u32) -> crate::lightning::chain::BestBlock { let mut ret = lightning::chain::BestBlock::new(::bitcoin::hash_types::BlockHash::from_slice(&block_hash.data[..]).unwrap(), height); - BestBlock { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::chain::BestBlock { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Returns the best block hash. #[must_use] #[no_mangle] -pub extern "C" fn BestBlock_block_hash(this_arg: &BestBlock) -> crate::c_types::ThirtyTwoBytes { +pub extern "C" fn BestBlock_block_hash(this_arg: &crate::lightning::chain::BestBlock) -> crate::c_types::ThirtyTwoBytes { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.block_hash(); crate::c_types::ThirtyTwoBytes { data: ret.into_inner() } } @@ -141,7 +141,7 @@ pub extern "C" fn BestBlock_block_hash(this_arg: &BestBlock) -> crate::c_types:: /// Returns the best block height. #[must_use] #[no_mangle] -pub extern "C" fn BestBlock_height(this_arg: &BestBlock) -> u32 { +pub extern "C" fn BestBlock_height(this_arg: &crate::lightning::chain::BestBlock) -> u32 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.height(); ret } diff --git a/lightning-c-bindings/src/lightning/chain/transaction.rs b/lightning-c-bindings/src/lightning/chain/transaction.rs index c5d01ea..7430c5a 100644 --- a/lightning-c-bindings/src/lightning/chain/transaction.rs +++ b/lightning-c-bindings/src/lightning/chain/transaction.rs @@ -142,14 +142,14 @@ pub extern "C" fn OutPoint_hash(o: &OutPoint) -> u64 { /// Convert an `OutPoint` to a lightning channel id. #[must_use] #[no_mangle] -pub extern "C" fn OutPoint_to_channel_id(this_arg: &OutPoint) -> crate::c_types::ThirtyTwoBytes { +pub extern "C" fn OutPoint_to_channel_id(this_arg: &crate::lightning::chain::transaction::OutPoint) -> crate::c_types::ThirtyTwoBytes { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_channel_id(); crate::c_types::ThirtyTwoBytes { data: ret } } #[no_mangle] /// Serialize the OutPoint object into a byte array which can be read by OutPoint_read -pub extern "C" fn OutPoint_write(obj: &OutPoint) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn OutPoint_write(obj: &crate::lightning::chain::transaction::OutPoint) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] diff --git a/lightning-c-bindings/src/lightning/ln/chan_utils.rs b/lightning-c-bindings/src/lightning/ln/chan_utils.rs index 225dfbb..591de66 100644 --- a/lightning-c-bindings/src/lightning/ln/chan_utils.rs +++ b/lightning-c-bindings/src/lightning/ln/chan_utils.rs @@ -122,16 +122,16 @@ pub extern "C" fn CounterpartyCommitmentSecrets_clone(orig: &CounterpartyCommitm /// Creates a new empty `CounterpartyCommitmentSecrets` structure. #[must_use] #[no_mangle] -pub extern "C" fn CounterpartyCommitmentSecrets_new() -> CounterpartyCommitmentSecrets { +pub extern "C" fn CounterpartyCommitmentSecrets_new() -> crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets { let mut ret = lightning::ln::chan_utils::CounterpartyCommitmentSecrets::new(); - CounterpartyCommitmentSecrets { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Returns the minimum index of all stored secrets. Note that indexes start /// at 1 << 48 and get decremented by one for each new secret. #[must_use] #[no_mangle] -pub extern "C" fn CounterpartyCommitmentSecrets_get_min_seen_secret(this_arg: &CounterpartyCommitmentSecrets) -> u64 { +pub extern "C" fn CounterpartyCommitmentSecrets_get_min_seen_secret(this_arg: &crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_min_seen_secret(); ret } @@ -140,8 +140,8 @@ pub extern "C" fn CounterpartyCommitmentSecrets_get_min_seen_secret(this_arg: &C /// was generated in accordance with BOLT 3 and is consistent with previous secrets. #[must_use] #[no_mangle] -pub extern "C" fn CounterpartyCommitmentSecrets_provide_secret(this_arg: &mut CounterpartyCommitmentSecrets, mut idx: u64, mut secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut nativeCounterpartyCommitmentSecrets)) }.provide_secret(idx, secret.data); +pub extern "C" fn CounterpartyCommitmentSecrets_provide_secret(this_arg: &mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, mut idx: u64, mut secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::chan_utils::nativeCounterpartyCommitmentSecrets)) }.provide_secret(idx, secret.data); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } @@ -152,7 +152,7 @@ pub extern "C" fn CounterpartyCommitmentSecrets_provide_secret(this_arg: &mut Co /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn CounterpartyCommitmentSecrets_get_secret(this_arg: &CounterpartyCommitmentSecrets, mut idx: u64) -> crate::c_types::ThirtyTwoBytes { +pub extern "C" fn CounterpartyCommitmentSecrets_get_secret(this_arg: &crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, mut idx: u64) -> crate::c_types::ThirtyTwoBytes { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_secret(idx); let mut local_ret = if ret.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (ret.unwrap()) } } }; local_ret @@ -160,7 +160,7 @@ pub extern "C" fn CounterpartyCommitmentSecrets_get_secret(this_arg: &Counterpar #[no_mangle] /// Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read -pub extern "C" fn CounterpartyCommitmentSecrets_write(obj: &CounterpartyCommitmentSecrets) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn CounterpartyCommitmentSecrets_write(obj: &crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -386,7 +386,7 @@ pub extern "C" fn TxCreationKeys_clone(orig: &TxCreationKeys) -> TxCreationKeys } #[no_mangle] /// Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read -pub extern "C" fn TxCreationKeys_write(obj: &TxCreationKeys) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn TxCreationKeys_write(obj: &crate::lightning::ln::chan_utils::TxCreationKeys) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -557,7 +557,7 @@ pub extern "C" fn ChannelPublicKeys_clone(orig: &ChannelPublicKeys) -> ChannelPu } #[no_mangle] /// Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read -pub extern "C" fn ChannelPublicKeys_write(obj: &ChannelPublicKeys) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelPublicKeys_write(obj: &crate::lightning::ln::chan_utils::ChannelPublicKeys) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -758,7 +758,7 @@ pub extern "C" fn HTLCOutputInCommitment_clone(orig: &HTLCOutputInCommitment) -> } #[no_mangle] /// Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read -pub extern "C" fn HTLCOutputInCommitment_write(obj: &HTLCOutputInCommitment) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn HTLCOutputInCommitment_write(obj: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1091,7 +1091,7 @@ pub extern "C" fn CounterpartyChannelTransactionParameters_clone(orig: &Counterp /// Whether the late bound parameters are populated. #[must_use] #[no_mangle] -pub extern "C" fn ChannelTransactionParameters_is_populated(this_arg: &ChannelTransactionParameters) -> bool { +pub extern "C" fn ChannelTransactionParameters_is_populated(this_arg: &crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_populated(); ret } @@ -1102,7 +1102,7 @@ pub extern "C" fn ChannelTransactionParameters_is_populated(this_arg: &ChannelTr /// self.is_populated() must be true before calling this function. #[must_use] #[no_mangle] -pub extern "C" fn ChannelTransactionParameters_as_holder_broadcastable(this_arg: &ChannelTransactionParameters) -> crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters { +pub extern "C" fn ChannelTransactionParameters_as_holder_broadcastable(this_arg: &crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_holder_broadcastable(); crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -1113,14 +1113,14 @@ pub extern "C" fn ChannelTransactionParameters_as_holder_broadcastable(this_arg: /// self.is_populated() must be true before calling this function. #[must_use] #[no_mangle] -pub extern "C" fn ChannelTransactionParameters_as_counterparty_broadcastable(this_arg: &ChannelTransactionParameters) -> crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters { +pub extern "C" fn ChannelTransactionParameters_as_counterparty_broadcastable(this_arg: &crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_counterparty_broadcastable(); crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters { inner: ObjOps::heap_alloc(ret), is_owned: true } } #[no_mangle] /// Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read -pub extern "C" fn CounterpartyChannelTransactionParameters_write(obj: &CounterpartyChannelTransactionParameters) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn CounterpartyChannelTransactionParameters_write(obj: &crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1136,7 +1136,7 @@ pub extern "C" fn CounterpartyChannelTransactionParameters_read(ser: crate::c_ty } #[no_mangle] /// Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read -pub extern "C" fn ChannelTransactionParameters_write(obj: &ChannelTransactionParameters) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelTransactionParameters_write(obj: &crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1208,7 +1208,7 @@ impl DirectedChannelTransactionParameters { /// Get the channel pubkeys for the broadcaster #[must_use] #[no_mangle] -pub extern "C" fn DirectedChannelTransactionParameters_broadcaster_pubkeys(this_arg: &DirectedChannelTransactionParameters) -> crate::lightning::ln::chan_utils::ChannelPublicKeys { +pub extern "C" fn DirectedChannelTransactionParameters_broadcaster_pubkeys(this_arg: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> crate::lightning::ln::chan_utils::ChannelPublicKeys { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.broadcaster_pubkeys(); crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::ChannelPublicKeys<>) as *mut _) }, is_owned: false } } @@ -1216,7 +1216,7 @@ pub extern "C" fn DirectedChannelTransactionParameters_broadcaster_pubkeys(this_ /// Get the channel pubkeys for the countersignatory #[must_use] #[no_mangle] -pub extern "C" fn DirectedChannelTransactionParameters_countersignatory_pubkeys(this_arg: &DirectedChannelTransactionParameters) -> crate::lightning::ln::chan_utils::ChannelPublicKeys { +pub extern "C" fn DirectedChannelTransactionParameters_countersignatory_pubkeys(this_arg: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> crate::lightning::ln::chan_utils::ChannelPublicKeys { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.countersignatory_pubkeys(); crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::ChannelPublicKeys<>) as *mut _) }, is_owned: false } } @@ -1225,7 +1225,7 @@ pub extern "C" fn DirectedChannelTransactionParameters_countersignatory_pubkeys( /// Note that the contest delay was selected by the countersignatory. #[must_use] #[no_mangle] -pub extern "C" fn DirectedChannelTransactionParameters_contest_delay(this_arg: &DirectedChannelTransactionParameters) -> u16 { +pub extern "C" fn DirectedChannelTransactionParameters_contest_delay(this_arg: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> u16 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.contest_delay(); ret } @@ -1236,7 +1236,7 @@ pub extern "C" fn DirectedChannelTransactionParameters_contest_delay(this_arg: & /// an input to the commitment number obscure factor computation. #[must_use] #[no_mangle] -pub extern "C" fn DirectedChannelTransactionParameters_is_outbound(this_arg: &DirectedChannelTransactionParameters) -> bool { +pub extern "C" fn DirectedChannelTransactionParameters_is_outbound(this_arg: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_outbound(); ret } @@ -1244,7 +1244,7 @@ pub extern "C" fn DirectedChannelTransactionParameters_is_outbound(this_arg: &Di /// The funding outpoint #[must_use] #[no_mangle] -pub extern "C" fn DirectedChannelTransactionParameters_funding_outpoint(this_arg: &DirectedChannelTransactionParameters) -> crate::lightning::chain::transaction::OutPoint { +pub extern "C" fn DirectedChannelTransactionParameters_funding_outpoint(this_arg: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> crate::lightning::chain::transaction::OutPoint { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.funding_outpoint(); crate::c_types::bitcoin_to_C_outpoint(ret) } @@ -1252,7 +1252,7 @@ pub extern "C" fn DirectedChannelTransactionParameters_funding_outpoint(this_arg /// Whether to use anchors for this channel #[must_use] #[no_mangle] -pub extern "C" fn DirectedChannelTransactionParameters_opt_anchors(this_arg: &DirectedChannelTransactionParameters) -> bool { +pub extern "C" fn DirectedChannelTransactionParameters_opt_anchors(this_arg: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.opt_anchors(); ret } @@ -1348,7 +1348,7 @@ pub extern "C" fn HolderCommitmentTransaction_clone(orig: &HolderCommitmentTrans } #[no_mangle] /// Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read -pub extern "C" fn HolderCommitmentTransaction_write(obj: &HolderCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn HolderCommitmentTransaction_write(obj: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1366,10 +1366,10 @@ pub extern "C" fn HolderCommitmentTransaction_read(ser: crate::c_types::u8slice) /// The funding keys are used to figure out which signature should go first when building the transaction for broadcast. #[must_use] #[no_mangle] -pub extern "C" fn HolderCommitmentTransaction_new(mut commitment_tx: crate::lightning::ln::chan_utils::CommitmentTransaction, mut counterparty_sig: crate::c_types::Signature, mut counterparty_htlc_sigs: crate::c_types::derived::CVec_SignatureZ, mut holder_funding_key: crate::c_types::PublicKey, mut counterparty_funding_key: crate::c_types::PublicKey) -> HolderCommitmentTransaction { +pub extern "C" fn HolderCommitmentTransaction_new(mut commitment_tx: crate::lightning::ln::chan_utils::CommitmentTransaction, mut counterparty_sig: crate::c_types::Signature, mut counterparty_htlc_sigs: crate::c_types::derived::CVec_SignatureZ, mut holder_funding_key: crate::c_types::PublicKey, mut counterparty_funding_key: crate::c_types::PublicKey) -> crate::lightning::ln::chan_utils::HolderCommitmentTransaction { let mut local_counterparty_htlc_sigs = Vec::new(); for mut item in counterparty_htlc_sigs.into_rust().drain(..) { local_counterparty_htlc_sigs.push( { item.into_rust() }); }; let mut ret = lightning::ln::chan_utils::HolderCommitmentTransaction::new(*unsafe { Box::from_raw(commitment_tx.take_inner()) }, counterparty_sig.into_rust(), local_counterparty_htlc_sigs, &holder_funding_key.into_rust(), &counterparty_funding_key.into_rust()); - HolderCommitmentTransaction { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -1481,7 +1481,7 @@ pub extern "C" fn BuiltCommitmentTransaction_clone(orig: &BuiltCommitmentTransac } #[no_mangle] /// Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read -pub extern "C" fn BuiltCommitmentTransaction_write(obj: &BuiltCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn BuiltCommitmentTransaction_write(obj: &crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1500,7 +1500,7 @@ pub extern "C" fn BuiltCommitmentTransaction_read(ser: crate::c_types::u8slice) /// This can be used to verify a signature. #[must_use] #[no_mangle] -pub extern "C" fn BuiltCommitmentTransaction_get_sighash_all(this_arg: &BuiltCommitmentTransaction, mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::ThirtyTwoBytes { +pub extern "C" fn BuiltCommitmentTransaction_get_sighash_all(this_arg: &crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::ThirtyTwoBytes { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_sighash_all(&::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis); crate::c_types::ThirtyTwoBytes { data: ret.as_ref().clone() } } @@ -1509,7 +1509,7 @@ pub extern "C" fn BuiltCommitmentTransaction_get_sighash_all(this_arg: &BuiltCom /// because we are about to broadcast a holder transaction. #[must_use] #[no_mangle] -pub extern "C" fn BuiltCommitmentTransaction_sign(this_arg: &BuiltCommitmentTransaction, funding_key: *const [u8; 32], mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::Signature { +pub extern "C" fn BuiltCommitmentTransaction_sign(this_arg: &crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, funding_key: *const [u8; 32], mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::Signature { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign(&::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis, secp256k1::SECP256K1); crate::c_types::Signature::from_rust(&ret) } @@ -1601,9 +1601,9 @@ pub extern "C" fn ClosingTransaction_hash(o: &ClosingTransaction) -> u64 { /// Construct an object of the class #[must_use] #[no_mangle] -pub extern "C" fn ClosingTransaction_new(mut to_holder_value_sat: u64, mut to_counterparty_value_sat: u64, mut to_holder_script: crate::c_types::derived::CVec_u8Z, mut to_counterparty_script: crate::c_types::derived::CVec_u8Z, mut funding_outpoint: crate::lightning::chain::transaction::OutPoint) -> ClosingTransaction { +pub extern "C" fn ClosingTransaction_new(mut to_holder_value_sat: u64, mut to_counterparty_value_sat: u64, mut to_holder_script: crate::c_types::derived::CVec_u8Z, mut to_counterparty_script: crate::c_types::derived::CVec_u8Z, mut funding_outpoint: crate::lightning::chain::transaction::OutPoint) -> crate::lightning::ln::chan_utils::ClosingTransaction { let mut ret = lightning::ln::chan_utils::ClosingTransaction::new(to_holder_value_sat, to_counterparty_value_sat, ::bitcoin::blockdata::script::Script::from(to_holder_script.into_rust()), ::bitcoin::blockdata::script::Script::from(to_counterparty_script.into_rust()), crate::c_types::C_to_bitcoin_outpoint(funding_outpoint)); - ClosingTransaction { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::chan_utils::ClosingTransaction { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Trust our pre-built transaction. @@ -1614,7 +1614,7 @@ pub extern "C" fn ClosingTransaction_new(mut to_holder_value_sat: u64, mut to_co /// be used by an external signer - instead use the verify function. #[must_use] #[no_mangle] -pub extern "C" fn ClosingTransaction_trust(this_arg: &ClosingTransaction) -> crate::lightning::ln::chan_utils::TrustedClosingTransaction { +pub extern "C" fn ClosingTransaction_trust(this_arg: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::lightning::ln::chan_utils::TrustedClosingTransaction { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.trust(); crate::lightning::ln::chan_utils::TrustedClosingTransaction { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -1627,7 +1627,7 @@ pub extern "C" fn ClosingTransaction_trust(this_arg: &ClosingTransaction) -> cra /// or using the built transaction. #[must_use] #[no_mangle] -pub extern "C" fn ClosingTransaction_verify(this_arg: &ClosingTransaction, mut funding_outpoint: crate::lightning::chain::transaction::OutPoint) -> crate::c_types::derived::CResult_TrustedClosingTransactionNoneZ { +pub extern "C" fn ClosingTransaction_verify(this_arg: &crate::lightning::ln::chan_utils::ClosingTransaction, mut funding_outpoint: crate::lightning::chain::transaction::OutPoint) -> crate::c_types::derived::CResult_TrustedClosingTransactionNoneZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.verify(crate::c_types::C_to_bitcoin_outpoint(funding_outpoint)); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::TrustedClosingTransaction { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret @@ -1636,7 +1636,7 @@ pub extern "C" fn ClosingTransaction_verify(this_arg: &ClosingTransaction, mut f /// The value to be sent to the holder, or zero if the output will be omitted #[must_use] #[no_mangle] -pub extern "C" fn ClosingTransaction_to_holder_value_sat(this_arg: &ClosingTransaction) -> u64 { +pub extern "C" fn ClosingTransaction_to_holder_value_sat(this_arg: &crate::lightning::ln::chan_utils::ClosingTransaction) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_holder_value_sat(); ret } @@ -1644,7 +1644,7 @@ pub extern "C" fn ClosingTransaction_to_holder_value_sat(this_arg: &ClosingTrans /// The value to be sent to the counterparty, or zero if the output will be omitted #[must_use] #[no_mangle] -pub extern "C" fn ClosingTransaction_to_counterparty_value_sat(this_arg: &ClosingTransaction) -> u64 { +pub extern "C" fn ClosingTransaction_to_counterparty_value_sat(this_arg: &crate::lightning::ln::chan_utils::ClosingTransaction) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_counterparty_value_sat(); ret } @@ -1652,7 +1652,7 @@ pub extern "C" fn ClosingTransaction_to_counterparty_value_sat(this_arg: &Closin /// The destination of the holder's output #[must_use] #[no_mangle] -pub extern "C" fn ClosingTransaction_to_holder_script(this_arg: &ClosingTransaction) -> crate::c_types::u8slice { +pub extern "C" fn ClosingTransaction_to_holder_script(this_arg: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::u8slice { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_holder_script(); crate::c_types::u8slice::from_slice(&ret[..]) } @@ -1660,7 +1660,7 @@ pub extern "C" fn ClosingTransaction_to_holder_script(this_arg: &ClosingTransact /// The destination of the counterparty's output #[must_use] #[no_mangle] -pub extern "C" fn ClosingTransaction_to_counterparty_script(this_arg: &ClosingTransaction) -> crate::c_types::u8slice { +pub extern "C" fn ClosingTransaction_to_counterparty_script(this_arg: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::u8slice { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_counterparty_script(); crate::c_types::u8slice::from_slice(&ret[..]) } @@ -1724,7 +1724,7 @@ impl TrustedClosingTransaction { /// The pre-built Bitcoin commitment transaction #[must_use] #[no_mangle] -pub extern "C" fn TrustedClosingTransaction_built_transaction(this_arg: &TrustedClosingTransaction) -> crate::c_types::Transaction { +pub extern "C" fn TrustedClosingTransaction_built_transaction(this_arg: &crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> crate::c_types::Transaction { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.built_transaction(); crate::c_types::Transaction::from_bitcoin(ret) } @@ -1734,7 +1734,7 @@ pub extern "C" fn TrustedClosingTransaction_built_transaction(this_arg: &Trusted /// This can be used to verify a signature. #[must_use] #[no_mangle] -pub extern "C" fn TrustedClosingTransaction_get_sighash_all(this_arg: &TrustedClosingTransaction, mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::ThirtyTwoBytes { +pub extern "C" fn TrustedClosingTransaction_get_sighash_all(this_arg: &crate::lightning::ln::chan_utils::TrustedClosingTransaction, mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::ThirtyTwoBytes { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_sighash_all(&::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis); crate::c_types::ThirtyTwoBytes { data: ret.as_ref().clone() } } @@ -1743,7 +1743,7 @@ pub extern "C" fn TrustedClosingTransaction_get_sighash_all(this_arg: &TrustedCl /// because we are about to broadcast a holder transaction. #[must_use] #[no_mangle] -pub extern "C" fn TrustedClosingTransaction_sign(this_arg: &TrustedClosingTransaction, funding_key: *const [u8; 32], mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::Signature { +pub extern "C" fn TrustedClosingTransaction_sign(this_arg: &crate::lightning::ln::chan_utils::TrustedClosingTransaction, funding_key: *const [u8; 32], mut funding_redeemscript: crate::c_types::u8slice, mut channel_value_satoshis: u64) -> crate::c_types::Signature { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign(&::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis, secp256k1::SECP256K1); crate::c_types::Signature::from_rust(&ret) } @@ -1825,7 +1825,7 @@ pub extern "C" fn CommitmentTransaction_clone(orig: &CommitmentTransaction) -> C } #[no_mangle] /// Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read -pub extern "C" fn CommitmentTransaction_write(obj: &CommitmentTransaction) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn CommitmentTransaction_write(obj: &crate::lightning::ln::chan_utils::CommitmentTransaction) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1842,7 +1842,7 @@ pub extern "C" fn CommitmentTransaction_read(ser: crate::c_types::u8slice) -> cr /// The backwards-counting commitment number #[must_use] #[no_mangle] -pub extern "C" fn CommitmentTransaction_commitment_number(this_arg: &CommitmentTransaction) -> u64 { +pub extern "C" fn CommitmentTransaction_commitment_number(this_arg: &crate::lightning::ln::chan_utils::CommitmentTransaction) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.commitment_number(); ret } @@ -1850,7 +1850,7 @@ pub extern "C" fn CommitmentTransaction_commitment_number(this_arg: &CommitmentT /// The value to be sent to the broadcaster #[must_use] #[no_mangle] -pub extern "C" fn CommitmentTransaction_to_broadcaster_value_sat(this_arg: &CommitmentTransaction) -> u64 { +pub extern "C" fn CommitmentTransaction_to_broadcaster_value_sat(this_arg: &crate::lightning::ln::chan_utils::CommitmentTransaction) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_broadcaster_value_sat(); ret } @@ -1858,7 +1858,7 @@ pub extern "C" fn CommitmentTransaction_to_broadcaster_value_sat(this_arg: &Comm /// The value to be sent to the counterparty #[must_use] #[no_mangle] -pub extern "C" fn CommitmentTransaction_to_countersignatory_value_sat(this_arg: &CommitmentTransaction) -> u64 { +pub extern "C" fn CommitmentTransaction_to_countersignatory_value_sat(this_arg: &crate::lightning::ln::chan_utils::CommitmentTransaction) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_countersignatory_value_sat(); ret } @@ -1866,7 +1866,7 @@ pub extern "C" fn CommitmentTransaction_to_countersignatory_value_sat(this_arg: /// The feerate paid per 1000-weight-unit in this commitment transaction. #[must_use] #[no_mangle] -pub extern "C" fn CommitmentTransaction_feerate_per_kw(this_arg: &CommitmentTransaction) -> u32 { +pub extern "C" fn CommitmentTransaction_feerate_per_kw(this_arg: &crate::lightning::ln::chan_utils::CommitmentTransaction) -> u32 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.feerate_per_kw(); ret } @@ -1879,7 +1879,7 @@ pub extern "C" fn CommitmentTransaction_feerate_per_kw(this_arg: &CommitmentTran /// be used by an external signer - instead use the verify function. #[must_use] #[no_mangle] -pub extern "C" fn CommitmentTransaction_trust(this_arg: &CommitmentTransaction) -> crate::lightning::ln::chan_utils::TrustedCommitmentTransaction { +pub extern "C" fn CommitmentTransaction_trust(this_arg: &crate::lightning::ln::chan_utils::CommitmentTransaction) -> crate::lightning::ln::chan_utils::TrustedCommitmentTransaction { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.trust(); crate::lightning::ln::chan_utils::TrustedCommitmentTransaction { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -1892,7 +1892,7 @@ pub extern "C" fn CommitmentTransaction_trust(this_arg: &CommitmentTransaction) /// or using the built transaction. #[must_use] #[no_mangle] -pub extern "C" fn CommitmentTransaction_verify(this_arg: &CommitmentTransaction, channel_parameters: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters, broadcaster_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys, countersignatory_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys) -> crate::c_types::derived::CResult_TrustedCommitmentTransactionNoneZ { +pub extern "C" fn CommitmentTransaction_verify(this_arg: &crate::lightning::ln::chan_utils::CommitmentTransaction, channel_parameters: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters, broadcaster_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys, countersignatory_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys) -> crate::c_types::derived::CResult_TrustedCommitmentTransactionNoneZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.verify(channel_parameters.get_native_ref(), broadcaster_keys.get_native_ref(), countersignatory_keys.get_native_ref(), secp256k1::SECP256K1); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::TrustedCommitmentTransaction { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret @@ -1957,7 +1957,7 @@ impl TrustedCommitmentTransaction { /// The transaction ID of the built Bitcoin transaction #[must_use] #[no_mangle] -pub extern "C" fn TrustedCommitmentTransaction_txid(this_arg: &TrustedCommitmentTransaction) -> crate::c_types::ThirtyTwoBytes { +pub extern "C" fn TrustedCommitmentTransaction_txid(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> crate::c_types::ThirtyTwoBytes { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.txid(); crate::c_types::ThirtyTwoBytes { data: ret.into_inner() } } @@ -1965,7 +1965,7 @@ pub extern "C" fn TrustedCommitmentTransaction_txid(this_arg: &TrustedCommitment /// The pre-built Bitcoin commitment transaction #[must_use] #[no_mangle] -pub extern "C" fn TrustedCommitmentTransaction_built_transaction(this_arg: &TrustedCommitmentTransaction) -> crate::lightning::ln::chan_utils::BuiltCommitmentTransaction { +pub extern "C" fn TrustedCommitmentTransaction_built_transaction(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> crate::lightning::ln::chan_utils::BuiltCommitmentTransaction { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.built_transaction(); crate::lightning::ln::chan_utils::BuiltCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::BuiltCommitmentTransaction<>) as *mut _) }, is_owned: false } } @@ -1973,7 +1973,7 @@ pub extern "C" fn TrustedCommitmentTransaction_built_transaction(this_arg: &Trus /// The pre-calculated transaction creation public keys. #[must_use] #[no_mangle] -pub extern "C" fn TrustedCommitmentTransaction_keys(this_arg: &TrustedCommitmentTransaction) -> crate::lightning::ln::chan_utils::TxCreationKeys { +pub extern "C" fn TrustedCommitmentTransaction_keys(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> crate::lightning::ln::chan_utils::TxCreationKeys { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.keys(); crate::lightning::ln::chan_utils::TxCreationKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::TxCreationKeys<>) as *mut _) }, is_owned: false } } @@ -1981,7 +1981,7 @@ pub extern "C" fn TrustedCommitmentTransaction_keys(this_arg: &TrustedCommitment /// Should anchors be used. #[must_use] #[no_mangle] -pub extern "C" fn TrustedCommitmentTransaction_opt_anchors(this_arg: &TrustedCommitmentTransaction) -> bool { +pub extern "C" fn TrustedCommitmentTransaction_opt_anchors(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.opt_anchors(); ret } @@ -1994,7 +1994,7 @@ pub extern "C" fn TrustedCommitmentTransaction_opt_anchors(this_arg: &TrustedCom /// This function is only valid in the holder commitment context, it always uses SigHashType::All. #[must_use] #[no_mangle] -pub extern "C" fn TrustedCommitmentTransaction_get_htlc_sigs(this_arg: &TrustedCommitmentTransaction, htlc_base_key: *const [u8; 32], channel_parameters: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> crate::c_types::derived::CResult_CVec_SignatureZNoneZ { +pub extern "C" fn TrustedCommitmentTransaction_get_htlc_sigs(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, htlc_base_key: *const [u8; 32], channel_parameters: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> crate::c_types::derived::CResult_CVec_SignatureZNoneZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_htlc_sigs(&::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *htlc_base_key}[..]).unwrap(), channel_parameters.get_native_ref(), secp256k1::SECP256K1); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = Vec::new(); for mut item in o.drain(..) { local_ret_0.push( { crate::c_types::Signature::from_rust(&item) }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret diff --git a/lightning-c-bindings/src/lightning/ln/channelmanager.rs b/lightning-c-bindings/src/lightning/ln/channelmanager.rs index 2b91ced..b9df804 100644 --- a/lightning-c-bindings/src/lightning/ln/channelmanager.rs +++ b/lightning-c-bindings/src/lightning/ln/channelmanager.rs @@ -1019,7 +1019,7 @@ pub extern "C" fn ChannelDetails_clone(orig: &ChannelDetails) -> ChannelDetails /// [`ChannelDetails::short_channel_id`]. See those for more information. #[must_use] #[no_mangle] -pub extern "C" fn ChannelDetails_get_inbound_payment_scid(this_arg: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { +pub extern "C" fn ChannelDetails_get_inbound_payment_scid(this_arg: &crate::lightning::ln::channelmanager::ChannelDetails) -> crate::c_types::derived::COption_u64Z { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_inbound_payment_scid(); let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) }; local_ret @@ -1378,15 +1378,15 @@ pub extern "C" fn PhantomRouteHints_clone(orig: &PhantomRouteHints) -> PhantomRo /// from after `params.latest_hash`. #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_new(mut fee_est: crate::lightning::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::lightning::chain::Watch, mut tx_broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut logger: crate::lightning::util::logger::Logger, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut config: crate::lightning::util::config::UserConfig, mut params: crate::lightning::ln::channelmanager::ChainParameters) -> ChannelManager { +pub extern "C" fn ChannelManager_new(mut fee_est: crate::lightning::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::lightning::chain::Watch, mut tx_broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut logger: crate::lightning::util::logger::Logger, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut config: crate::lightning::util::config::UserConfig, mut params: crate::lightning::ln::channelmanager::ChainParameters) -> crate::lightning::ln::channelmanager::ChannelManager { let mut ret = lightning::ln::channelmanager::ChannelManager::new(fee_est, chain_monitor, tx_broadcaster, logger, keys_manager, *unsafe { Box::from_raw(config.take_inner()) }, *unsafe { Box::from_raw(params.take_inner()) }); - ChannelManager { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Gets the current configuration applied to all new channels, as #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_get_current_default_configuration(this_arg: &ChannelManager) -> crate::lightning::util::config::UserConfig { +pub extern "C" fn ChannelManager_get_current_default_configuration(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::lightning::util::config::UserConfig { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_current_default_configuration(); crate::lightning::util::config::UserConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::util::config::UserConfig<>) as *mut _) }, is_owned: false } } @@ -1421,7 +1421,7 @@ pub extern "C" fn ChannelManager_get_current_default_configuration(this_arg: &Ch /// Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_create_channel(this_arg: &ChannelManager, mut their_network_key: crate::c_types::PublicKey, mut channel_value_satoshis: u64, mut push_msat: u64, mut user_channel_id: u64, mut override_config: crate::lightning::util::config::UserConfig) -> crate::c_types::derived::CResult__u832APIErrorZ { +pub extern "C" fn ChannelManager_create_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut their_network_key: crate::c_types::PublicKey, mut channel_value_satoshis: u64, mut push_msat: u64, mut user_channel_id: u64, mut override_config: crate::lightning::util::config::UserConfig) -> crate::c_types::derived::CResult__u832APIErrorZ { let mut local_override_config = if override_config.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(override_config.take_inner()) } }) }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_channel(their_network_key.into_rust(), channel_value_satoshis, push_msat, user_channel_id, local_override_config); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; @@ -1432,7 +1432,7 @@ pub extern "C" fn ChannelManager_create_channel(this_arg: &ChannelManager, mut t /// more information. #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_list_channels(this_arg: &ChannelManager) -> crate::c_types::derived::CVec_ChannelDetailsZ { +pub extern "C" fn ChannelManager_list_channels(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CVec_ChannelDetailsZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.list_channels(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret.into() @@ -1446,7 +1446,7 @@ pub extern "C" fn ChannelManager_list_channels(this_arg: &ChannelManager) -> cra /// are. #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_list_usable_channels(this_arg: &ChannelManager) -> crate::c_types::derived::CVec_ChannelDetailsZ { +pub extern "C" fn ChannelManager_list_usable_channels(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CVec_ChannelDetailsZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.list_usable_channels(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret.into() @@ -1471,7 +1471,7 @@ pub extern "C" fn ChannelManager_list_usable_channels(this_arg: &ChannelManager) /// [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_close_channel(this_arg: &ChannelManager, channel_id: *const [u8; 32]) -> crate::c_types::derived::CResult_NoneAPIErrorZ { +pub extern "C" fn ChannelManager_close_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: *const [u8; 32]) -> crate::c_types::derived::CResult_NoneAPIErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.close_channel(unsafe { &*channel_id}); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_ret @@ -1498,7 +1498,7 @@ pub extern "C" fn ChannelManager_close_channel(this_arg: &ChannelManager, channe /// [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_close_channel_with_target_feerate(this_arg: &ChannelManager, channel_id: *const [u8; 32], mut target_feerate_sats_per_1000_weight: u32) -> crate::c_types::derived::CResult_NoneAPIErrorZ { +pub extern "C" fn ChannelManager_close_channel_with_target_feerate(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: *const [u8; 32], mut target_feerate_sats_per_1000_weight: u32) -> crate::c_types::derived::CResult_NoneAPIErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.close_channel_with_target_feerate(unsafe { &*channel_id}, target_feerate_sats_per_1000_weight); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_ret @@ -1508,7 +1508,7 @@ pub extern "C" fn ChannelManager_close_channel_with_target_feerate(this_arg: &Ch /// the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager. #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_force_close_channel(this_arg: &ChannelManager, channel_id: *const [u8; 32]) -> crate::c_types::derived::CResult_NoneAPIErrorZ { +pub extern "C" fn ChannelManager_force_close_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: *const [u8; 32]) -> crate::c_types::derived::CResult_NoneAPIErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.force_close_channel(unsafe { &*channel_id}); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_ret @@ -1517,7 +1517,7 @@ pub extern "C" fn ChannelManager_force_close_channel(this_arg: &ChannelManager, /// Force close all channels, immediately broadcasting the latest local commitment transaction /// for each to the chain and rejecting new HTLCs on each. #[no_mangle] -pub extern "C" fn ChannelManager_force_close_all_channels(this_arg: &ChannelManager) { +pub extern "C" fn ChannelManager_force_close_all_channels(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.force_close_all_channels() } @@ -1564,7 +1564,7 @@ pub extern "C" fn ChannelManager_force_close_all_channels(this_arg: &ChannelMana /// Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_send_payment(this_arg: &ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentIdPaymentSendFailureZ { +pub extern "C" fn ChannelManager_send_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentIdPaymentSendFailureZ { let mut local_payment_secret = if payment_secret.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentSecret(payment_secret.data) }) }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_payment(route.get_native_ref(), ::lightning::ln::PaymentHash(payment_hash.data), &local_payment_secret); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() }; @@ -1583,7 +1583,7 @@ pub extern "C" fn ChannelManager_send_payment(this_arg: &ChannelManager, route: /// [`abandon_payment`]: [`ChannelManager::abandon_payment`] #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_retry_payment(this_arg: &ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ { +pub extern "C" fn ChannelManager_retry_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.retry_payment(route.get_native_ref(), ::lightning::ln::channelmanager::PaymentId(payment_id.data)); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() }; local_ret @@ -1604,7 +1604,7 @@ pub extern "C" fn ChannelManager_retry_payment(this_arg: &ChannelManager, route: /// [`Event::PaymentFailed`]: events::Event::PaymentFailed /// [`Event::PaymentSent`]: events::Event::PaymentSent #[no_mangle] -pub extern "C" fn ChannelManager_abandon_payment(this_arg: &ChannelManager, mut payment_id: crate::c_types::ThirtyTwoBytes) { +pub extern "C" fn ChannelManager_abandon_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_id: crate::c_types::ThirtyTwoBytes) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.abandon_payment(::lightning::ln::channelmanager::PaymentId(payment_id.data)) } @@ -1626,7 +1626,7 @@ pub extern "C" fn ChannelManager_abandon_payment(this_arg: &ChannelManager, mut /// Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_send_spontaneous_payment(this_arg: &ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_preimage: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { +pub extern "C" fn ChannelManager_send_spontaneous_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_preimage: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { let mut local_payment_preimage = if payment_preimage.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentPreimage(payment_preimage.data) }) }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_spontaneous_payment(route.get_native_ref(), local_payment_preimage); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.0 }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() }; @@ -1657,7 +1657,7 @@ pub extern "C" fn ChannelManager_send_spontaneous_payment(this_arg: &ChannelMana /// [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_funding_transaction_generated(this_arg: &ChannelManager, temporary_channel_id: *const [u8; 32], mut funding_transaction: crate::c_types::Transaction) -> crate::c_types::derived::CResult_NoneAPIErrorZ { +pub extern "C" fn ChannelManager_funding_transaction_generated(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut funding_transaction: crate::c_types::Transaction) -> crate::c_types::derived::CResult_NoneAPIErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.funding_transaction_generated(unsafe { &*temporary_channel_id}, funding_transaction.into_bitcoin()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_ret @@ -1682,7 +1682,7 @@ pub extern "C" fn ChannelManager_funding_transaction_generated(this_arg: &Channe /// /// [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events #[no_mangle] -pub extern "C" fn ChannelManager_broadcast_node_announcement(this_arg: &ChannelManager, mut rgb: crate::c_types::ThreeBytes, mut alias: crate::c_types::ThirtyTwoBytes, mut addresses: crate::c_types::derived::CVec_NetAddressZ) { +pub extern "C" fn ChannelManager_broadcast_node_announcement(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut rgb: crate::c_types::ThreeBytes, mut alias: crate::c_types::ThirtyTwoBytes, mut addresses: crate::c_types::derived::CVec_NetAddressZ) { let mut local_addresses = Vec::new(); for mut item in addresses.into_rust().drain(..) { local_addresses.push( { item.into_native() }); }; unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.broadcast_node_announcement(rgb.data, alias.data, local_addresses) } @@ -1692,7 +1692,7 @@ pub extern "C" fn ChannelManager_broadcast_node_announcement(this_arg: &ChannelM /// Should only really ever be called in response to a PendingHTLCsForwardable event. /// Will likely generate further events. #[no_mangle] -pub extern "C" fn ChannelManager_process_pending_htlc_forwards(this_arg: &ChannelManager) { +pub extern "C" fn ChannelManager_process_pending_htlc_forwards(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.process_pending_htlc_forwards() } @@ -1707,7 +1707,7 @@ pub extern "C" fn ChannelManager_process_pending_htlc_forwards(this_arg: &Channe /// Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate /// estimate fetches. #[no_mangle] -pub extern "C" fn ChannelManager_timer_tick_occurred(this_arg: &ChannelManager) { +pub extern "C" fn ChannelManager_timer_tick_occurred(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.timer_tick_occurred() } @@ -1718,7 +1718,7 @@ pub extern "C" fn ChannelManager_timer_tick_occurred(this_arg: &ChannelManager) /// HTLC backwards has been started. #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &ChannelManager, payment_hash: *const [u8; 32]) -> bool { +pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, payment_hash: *const [u8; 32]) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fail_htlc_backwards(&::lightning::ln::PaymentHash(unsafe { *payment_hash })); ret } @@ -1740,7 +1740,7 @@ pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &ChannelManager, /// [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_claim_funds(this_arg: &ChannelManager, mut payment_preimage: crate::c_types::ThirtyTwoBytes) -> bool { +pub extern "C" fn ChannelManager_claim_funds(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_preimage: crate::c_types::ThirtyTwoBytes) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.claim_funds(::lightning::ln::PaymentPreimage(payment_preimage.data)); ret } @@ -1748,7 +1748,7 @@ pub extern "C" fn ChannelManager_claim_funds(this_arg: &ChannelManager, mut paym /// Gets the node_id held by this ChannelManager #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_get_our_node_id(this_arg: &ChannelManager) -> crate::c_types::PublicKey { +pub extern "C" fn ChannelManager_get_our_node_id(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::PublicKey { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_our_node_id(); crate::c_types::PublicKey::from_rust(&ret) } @@ -1766,7 +1766,7 @@ pub extern "C" fn ChannelManager_get_our_node_id(this_arg: &ChannelManager) -> c /// [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &ChannelManager, temporary_channel_id: *const [u8; 32], mut user_channel_id: u64) -> crate::c_types::derived::CResult_NoneAPIErrorZ { +pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut user_channel_id: u64) -> crate::c_types::derived::CResult_NoneAPIErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel(unsafe { &*temporary_channel_id}, user_channel_id); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_ret @@ -1800,7 +1800,7 @@ pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &ChannelManage /// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_create_inbound_payment(this_arg: &ChannelManager, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { +pub extern "C" fn ChannelManager_create_inbound_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment(local_min_value_msat, invoice_expiry_delta_secs); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.0 }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; @@ -1818,7 +1818,7 @@ pub extern "C" fn ChannelManager_create_inbound_payment(this_arg: &ChannelManage /// [`create_inbound_payment`]: Self::create_inbound_payment #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_create_inbound_payment_legacy(this_arg: &ChannelManager, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { +pub extern "C" fn ChannelManager_create_inbound_payment_legacy(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment_legacy(local_min_value_msat, invoice_expiry_delta_secs); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.0 }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; @@ -1870,7 +1870,7 @@ pub extern "C" fn ChannelManager_create_inbound_payment_legacy(this_arg: &Channe /// [`PaymentReceived`]: events::Event::PaymentReceived #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_create_inbound_payment_for_hash(this_arg: &ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_PaymentSecretNoneZ { +pub extern "C" fn ChannelManager_create_inbound_payment_for_hash(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_PaymentSecretNoneZ { let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment_for_hash(::lightning::ln::PaymentHash(payment_hash.data), local_min_value_msat, invoice_expiry_delta_secs); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; @@ -1888,7 +1888,7 @@ pub extern "C" fn ChannelManager_create_inbound_payment_for_hash(this_arg: &Chan /// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_create_inbound_payment_for_hash_legacy(this_arg: &ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_PaymentSecretAPIErrorZ { +pub extern "C" fn ChannelManager_create_inbound_payment_for_hash_legacy(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_PaymentSecretAPIErrorZ { let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment_for_hash_legacy(::lightning::ln::PaymentHash(payment_hash.data), local_min_value_msat, invoice_expiry_delta_secs); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; @@ -1901,7 +1901,7 @@ pub extern "C" fn ChannelManager_create_inbound_payment_for_hash_legacy(this_arg /// [`create_inbound_payment`]: Self::create_inbound_payment #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_get_payment_preimage(this_arg: &ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentPreimageAPIErrorZ { +pub extern "C" fn ChannelManager_get_payment_preimage(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentPreimageAPIErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_payment_preimage(::lightning::ln::PaymentHash(payment_hash.data), ::lightning::ln::PaymentSecret(payment_secret.data)); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_ret @@ -1913,7 +1913,7 @@ pub extern "C" fn ChannelManager_get_payment_preimage(this_arg: &ChannelManager, /// [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_get_phantom_scid(this_arg: &ChannelManager) -> u64 { +pub extern "C" fn ChannelManager_get_phantom_scid(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_phantom_scid(); ret } @@ -1923,7 +1923,7 @@ pub extern "C" fn ChannelManager_get_phantom_scid(this_arg: &ChannelManager) -> /// [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_get_phantom_route_hints(this_arg: &ChannelManager) -> crate::lightning::ln::channelmanager::PhantomRouteHints { +pub extern "C" fn ChannelManager_get_phantom_route_hints(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::lightning::ln::channelmanager::PhantomRouteHints { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_phantom_route_hints(); crate::lightning::ln::channelmanager::PhantomRouteHints { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -2059,7 +2059,7 @@ extern "C" fn ChannelManager_Confirm_transaction_unconfirmed(this_arg: *const c_ /// Note that this method is not available with the `no-std` feature. #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_await_persistable_update_timeout(this_arg: &ChannelManager, mut max_wait: u64) -> bool { +pub extern "C" fn ChannelManager_await_persistable_update_timeout(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut max_wait: u64) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.await_persistable_update_timeout(core::time::Duration::from_secs(max_wait)); ret } @@ -2068,7 +2068,7 @@ pub extern "C" fn ChannelManager_await_persistable_update_timeout(this_arg: &Cha /// `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken /// up. #[no_mangle] -pub extern "C" fn ChannelManager_await_persistable_update(this_arg: &ChannelManager) { +pub extern "C" fn ChannelManager_await_persistable_update(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.await_persistable_update() } @@ -2076,7 +2076,7 @@ pub extern "C" fn ChannelManager_await_persistable_update(this_arg: &ChannelMana /// [`chain::Confirm`] interfaces. #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_current_best_block(this_arg: &ChannelManager) -> crate::lightning::chain::BestBlock { +pub extern "C" fn ChannelManager_current_best_block(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::lightning::chain::BestBlock { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.current_best_block(); crate::lightning::chain::BestBlock { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -2189,7 +2189,7 @@ extern "C" fn ChannelManager_ChannelMessageHandler_handle_error(this_arg: *const #[no_mangle] /// Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read -pub extern "C" fn CounterpartyForwardingInfo_write(obj: &CounterpartyForwardingInfo) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn CounterpartyForwardingInfo_write(obj: &crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -2205,7 +2205,7 @@ pub extern "C" fn CounterpartyForwardingInfo_read(ser: crate::c_types::u8slice) } #[no_mangle] /// Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read -pub extern "C" fn ChannelCounterparty_write(obj: &ChannelCounterparty) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelCounterparty_write(obj: &crate::lightning::ln::channelmanager::ChannelCounterparty) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -2221,7 +2221,7 @@ pub extern "C" fn ChannelCounterparty_read(ser: crate::c_types::u8slice) -> crat } #[no_mangle] /// Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read -pub extern "C" fn ChannelDetails_write(obj: &ChannelDetails) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelDetails_write(obj: &crate::lightning::ln::channelmanager::ChannelDetails) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -2237,7 +2237,7 @@ pub extern "C" fn ChannelDetails_read(ser: crate::c_types::u8slice) -> crate::c_ } #[no_mangle] /// Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read -pub extern "C" fn PhantomRouteHints_write(obj: &PhantomRouteHints) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn PhantomRouteHints_write(obj: &crate::lightning::ln::channelmanager::PhantomRouteHints) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -2253,7 +2253,7 @@ pub extern "C" fn PhantomRouteHints_read(ser: crate::c_types::u8slice) -> crate: } #[no_mangle] /// Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read -pub extern "C" fn ChannelManager_write(obj: &ChannelManager) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelManager_write(obj: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -2437,10 +2437,10 @@ pub extern "C" fn ChannelManagerReadArgs_set_default_config(this_ptr: &mut Chann /// populate a HashMap directly from C. #[must_use] #[no_mangle] -pub extern "C" fn ChannelManagerReadArgs_new(mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::lightning::chain::Watch, mut tx_broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut logger: crate::lightning::util::logger::Logger, mut default_config: crate::lightning::util::config::UserConfig, mut channel_monitors: crate::c_types::derived::CVec_ChannelMonitorZ) -> ChannelManagerReadArgs { +pub extern "C" fn ChannelManagerReadArgs_new(mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::lightning::chain::Watch, mut tx_broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut logger: crate::lightning::util::logger::Logger, mut default_config: crate::lightning::util::config::UserConfig, mut channel_monitors: crate::c_types::derived::CVec_ChannelMonitorZ) -> crate::lightning::ln::channelmanager::ChannelManagerReadArgs { let mut local_channel_monitors = Vec::new(); for mut item in channel_monitors.into_rust().drain(..) { local_channel_monitors.push( { item.get_native_mut_ref() }); }; let mut ret = lightning::ln::channelmanager::ChannelManagerReadArgs::new(keys_manager, fee_estimator, chain_monitor, tx_broadcaster, logger, *unsafe { Box::from_raw(default_config.take_inner()) }, local_channel_monitors); - ChannelManagerReadArgs { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::channelmanager::ChannelManagerReadArgs { inner: ObjOps::heap_alloc(ret), is_owned: true } } #[no_mangle] diff --git a/lightning-c-bindings/src/lightning/ln/features.rs b/lightning-c-bindings/src/lightning/ln/features.rs index b7829a4..3061444 100644 --- a/lightning-c-bindings/src/lightning/ln/features.rs +++ b/lightning-c-bindings/src/lightning/ln/features.rs @@ -39,6 +39,754 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_data_loss_protect_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_data_loss_protect_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_data_loss_protect_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_data_loss_protect_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_data_loss_protect(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_data_loss_protect(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_data_loss_protect_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_data_loss_protect_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_data_loss_protect_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_data_loss_protect_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_data_loss_protect(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_data_loss_protect(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_data_loss_protect(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_data_loss_protect(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_data_loss_protect(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_data_loss_protect(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_initial_routing_sync_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_initial_routing_sync_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_initial_routing_sync_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_initial_routing_sync_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_initial_routing_sync(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.initial_routing_sync(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_upfront_shutdown_script_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_upfront_shutdown_script_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_upfront_shutdown_script_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_upfront_shutdown_script_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_upfront_shutdown_script(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_upfront_shutdown_script(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_upfront_shutdown_script_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_upfront_shutdown_script_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_upfront_shutdown_script_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_upfront_shutdown_script_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_upfront_shutdown_script(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_upfront_shutdown_script(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_upfront_shutdown_script(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_upfront_shutdown_script(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_upfront_shutdown_script(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_upfront_shutdown_script(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_gossip_queries_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_gossip_queries_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_gossip_queries_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_gossip_queries_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_gossip_queries(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_gossip_queries(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_gossip_queries_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_gossip_queries_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_gossip_queries_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_gossip_queries_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_gossip_queries(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_gossip_queries(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_gossip_queries(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_gossip_queries(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_gossip_queries(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_gossip_queries(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_variable_length_onion_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_variable_length_onion_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_variable_length_onion_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_variable_length_onion_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_variable_length_onion(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_variable_length_onion(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_variable_length_onion_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_variable_length_onion_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_variable_length_onion_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_variable_length_onion_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_variable_length_onion(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_variable_length_onion(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InvoiceFeatures_set_variable_length_onion_optional(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_variable_length_onion_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InvoiceFeatures_set_variable_length_onion_required(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_variable_length_onion_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceFeatures_supports_variable_length_onion(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_variable_length_onion(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_variable_length_onion(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_variable_length_onion(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_variable_length_onion(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_variable_length_onion(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceFeatures_requires_variable_length_onion(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_variable_length_onion(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_static_remote_key_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_static_remote_key_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_static_remote_key_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_static_remote_key_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_static_remote_key(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_static_remote_key(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_static_remote_key_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_static_remote_key_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_static_remote_key_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_static_remote_key_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_static_remote_key(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_static_remote_key(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_set_static_remote_key_optional(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_static_remote_key_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_set_static_remote_key_required(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_static_remote_key_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_supports_static_remote_key(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_static_remote_key(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_static_remote_key(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_static_remote_key(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_static_remote_key(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_static_remote_key(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_requires_static_remote_key(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_static_remote_key(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_payment_secret_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_payment_secret_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_payment_secret_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_payment_secret_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_payment_secret(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_payment_secret_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_payment_secret_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_payment_secret_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_payment_secret_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_payment_secret(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InvoiceFeatures_set_payment_secret_optional(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_payment_secret_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InvoiceFeatures_set_payment_secret_required(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_payment_secret_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceFeatures_supports_payment_secret(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_payment_secret(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_payment_secret(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_payment_secret(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_payment_secret(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceFeatures_requires_payment_secret(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_payment_secret(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_basic_mpp_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_basic_mpp_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_basic_mpp_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_basic_mpp_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_basic_mpp(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_basic_mpp(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_basic_mpp_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_basic_mpp_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_basic_mpp_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_basic_mpp_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_basic_mpp(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_basic_mpp(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InvoiceFeatures_set_basic_mpp_optional(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_basic_mpp_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InvoiceFeatures_set_basic_mpp_required(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_basic_mpp_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceFeatures_supports_basic_mpp(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_basic_mpp(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_basic_mpp(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_basic_mpp(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_basic_mpp(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_basic_mpp(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceFeatures_requires_basic_mpp(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_basic_mpp(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_shutdown_any_segwit_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_shutdown_any_segwit_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_shutdown_any_segwit_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_shutdown_any_segwit_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_shutdown_anysegwit(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_shutdown_anysegwit(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_shutdown_any_segwit_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_shutdown_any_segwit_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_shutdown_any_segwit_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_shutdown_any_segwit_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_shutdown_anysegwit(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_shutdown_anysegwit(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_shutdown_anysegwit(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_shutdown_anysegwit(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_shutdown_anysegwit(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_shutdown_anysegwit(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_channel_type_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_channel_type_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_channel_type_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_channel_type_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_channel_type(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_channel_type(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_channel_type_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_channel_type_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_channel_type_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_channel_type_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_channel_type(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_channel_type(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_channel_type(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_channel_type(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_channel_type(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_channel_type(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_scid_privacy_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_scid_privacy_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_scid_privacy_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_scid_privacy_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_scid_privacy(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_scid_privacy_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_scid_privacy_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_scid_privacy_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_scid_privacy_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_scid_privacy(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_set_scid_privacy_optional(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_scid_privacy_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_set_scid_privacy_required(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_scid_privacy_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_supports_scid_privacy(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_scid_privacy(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_scid_privacy(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_requires_scid_privacy(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_keysend_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_keysend_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_keysend_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_keysend_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_keysend(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_keysend(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_keysend(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_keysend(); + ret +} + } /// Checks if two InitFeaturess contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. @@ -447,24 +1195,24 @@ impl ChannelTypeFeatures { /// Create a blank Features with no features set #[must_use] #[no_mangle] -pub extern "C" fn InitFeatures_empty() -> InitFeatures { +pub extern "C" fn InitFeatures_empty() -> crate::lightning::ln::features::InitFeatures { let mut ret = lightning::ln::features::InitFeatures::empty(); - InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Creates a Features with the bits set which are known by the implementation #[must_use] #[no_mangle] -pub extern "C" fn InitFeatures_known() -> InitFeatures { +pub extern "C" fn InitFeatures_known() -> crate::lightning::ln::features::InitFeatures { let mut ret = lightning::ln::features::InitFeatures::known(); - InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Returns true if this `Features` object contains unknown feature flags which are set as /// \"required\". #[must_use] #[no_mangle] -pub extern "C" fn InitFeatures_requires_unknown_bits(this_arg: &InitFeatures) -> bool { +pub extern "C" fn InitFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits(); ret } @@ -472,24 +1220,24 @@ pub extern "C" fn InitFeatures_requires_unknown_bits(this_arg: &InitFeatures) -> /// Create a blank Features with no features set #[must_use] #[no_mangle] -pub extern "C" fn NodeFeatures_empty() -> NodeFeatures { +pub extern "C" fn NodeFeatures_empty() -> crate::lightning::ln::features::NodeFeatures { let mut ret = lightning::ln::features::NodeFeatures::empty(); - NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Creates a Features with the bits set which are known by the implementation #[must_use] #[no_mangle] -pub extern "C" fn NodeFeatures_known() -> NodeFeatures { +pub extern "C" fn NodeFeatures_known() -> crate::lightning::ln::features::NodeFeatures { let mut ret = lightning::ln::features::NodeFeatures::known(); - NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Returns true if this `Features` object contains unknown feature flags which are set as /// \"required\". #[must_use] #[no_mangle] -pub extern "C" fn NodeFeatures_requires_unknown_bits(this_arg: &NodeFeatures) -> bool { +pub extern "C" fn NodeFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits(); ret } @@ -497,24 +1245,24 @@ pub extern "C" fn NodeFeatures_requires_unknown_bits(this_arg: &NodeFeatures) -> /// Create a blank Features with no features set #[must_use] #[no_mangle] -pub extern "C" fn ChannelFeatures_empty() -> ChannelFeatures { +pub extern "C" fn ChannelFeatures_empty() -> crate::lightning::ln::features::ChannelFeatures { let mut ret = lightning::ln::features::ChannelFeatures::empty(); - ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Creates a Features with the bits set which are known by the implementation #[must_use] #[no_mangle] -pub extern "C" fn ChannelFeatures_known() -> ChannelFeatures { +pub extern "C" fn ChannelFeatures_known() -> crate::lightning::ln::features::ChannelFeatures { let mut ret = lightning::ln::features::ChannelFeatures::known(); - ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Returns true if this `Features` object contains unknown feature flags which are set as /// \"required\". #[must_use] #[no_mangle] -pub extern "C" fn ChannelFeatures_requires_unknown_bits(this_arg: &ChannelFeatures) -> bool { +pub extern "C" fn ChannelFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::ChannelFeatures) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits(); ret } @@ -522,24 +1270,24 @@ pub extern "C" fn ChannelFeatures_requires_unknown_bits(this_arg: &ChannelFeatur /// Create a blank Features with no features set #[must_use] #[no_mangle] -pub extern "C" fn InvoiceFeatures_empty() -> InvoiceFeatures { +pub extern "C" fn InvoiceFeatures_empty() -> crate::lightning::ln::features::InvoiceFeatures { let mut ret = lightning::ln::features::InvoiceFeatures::empty(); - InvoiceFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Creates a Features with the bits set which are known by the implementation #[must_use] #[no_mangle] -pub extern "C" fn InvoiceFeatures_known() -> InvoiceFeatures { +pub extern "C" fn InvoiceFeatures_known() -> crate::lightning::ln::features::InvoiceFeatures { let mut ret = lightning::ln::features::InvoiceFeatures::known(); - InvoiceFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Returns true if this `Features` object contains unknown feature flags which are set as /// \"required\". #[must_use] #[no_mangle] -pub extern "C" fn InvoiceFeatures_requires_unknown_bits(this_arg: &InvoiceFeatures) -> bool { +pub extern "C" fn InvoiceFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits(); ret } @@ -547,31 +1295,31 @@ pub extern "C" fn InvoiceFeatures_requires_unknown_bits(this_arg: &InvoiceFeatur /// Create a blank Features with no features set #[must_use] #[no_mangle] -pub extern "C" fn ChannelTypeFeatures_empty() -> ChannelTypeFeatures { +pub extern "C" fn ChannelTypeFeatures_empty() -> crate::lightning::ln::features::ChannelTypeFeatures { let mut ret = lightning::ln::features::ChannelTypeFeatures::empty(); - ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Creates a Features with the bits set which are known by the implementation #[must_use] #[no_mangle] -pub extern "C" fn ChannelTypeFeatures_known() -> ChannelTypeFeatures { +pub extern "C" fn ChannelTypeFeatures_known() -> crate::lightning::ln::features::ChannelTypeFeatures { let mut ret = lightning::ln::features::ChannelTypeFeatures::known(); - ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Returns true if this `Features` object contains unknown feature flags which are set as /// \"required\". #[must_use] #[no_mangle] -pub extern "C" fn ChannelTypeFeatures_requires_unknown_bits(this_arg: &ChannelTypeFeatures) -> bool { +pub extern "C" fn ChannelTypeFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits(); ret } #[no_mangle] /// Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read -pub extern "C" fn InitFeatures_write(obj: &InitFeatures) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn InitFeatures_write(obj: &crate::lightning::ln::features::InitFeatures) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -587,7 +1335,7 @@ pub extern "C" fn InitFeatures_read(ser: crate::c_types::u8slice) -> crate::c_ty } #[no_mangle] /// Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read -pub extern "C" fn ChannelFeatures_write(obj: &ChannelFeatures) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelFeatures_write(obj: &crate::lightning::ln::features::ChannelFeatures) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -603,7 +1351,7 @@ pub extern "C" fn ChannelFeatures_read(ser: crate::c_types::u8slice) -> crate::c } #[no_mangle] /// Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read -pub extern "C" fn NodeFeatures_write(obj: &NodeFeatures) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn NodeFeatures_write(obj: &crate::lightning::ln::features::NodeFeatures) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -619,7 +1367,7 @@ pub extern "C" fn NodeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_ty } #[no_mangle] /// Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read -pub extern "C" fn InvoiceFeatures_write(obj: &InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn InvoiceFeatures_write(obj: &crate::lightning::ln::features::InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -635,7 +1383,7 @@ pub extern "C" fn InvoiceFeatures_read(ser: crate::c_types::u8slice) -> crate::c } #[no_mangle] /// Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read -pub extern "C" fn ChannelTypeFeatures_write(obj: &ChannelTypeFeatures) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelTypeFeatures_write(obj: &crate::lightning::ln::features::ChannelTypeFeatures) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] diff --git a/lightning-c-bindings/src/lightning/ln/msgs.rs b/lightning-c-bindings/src/lightning/ln/msgs.rs index 32b5f87..55b1c03 100644 --- a/lightning-c-bindings/src/lightning/ln/msgs.rs +++ b/lightning-c-bindings/src/lightning/ln/msgs.rs @@ -3165,7 +3165,7 @@ pub extern "C" fn NetAddress_onion_v3(ed25519_pubkey: crate::c_types::ThirtyTwoB } #[no_mangle] /// Serialize the NetAddress object into a byte array which can be read by NetAddress_read -pub extern "C" fn NetAddress_write(obj: &NetAddress) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn NetAddress_write(obj: &crate::lightning::ln::msgs::NetAddress) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) } #[no_mangle] @@ -5382,7 +5382,7 @@ use alloc::{vec::Vec, boxed::Box}; } #[no_mangle] /// Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read -pub extern "C" fn AcceptChannel_write(obj: &AcceptChannel) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn AcceptChannel_write(obj: &crate::lightning::ln::msgs::AcceptChannel) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5398,7 +5398,7 @@ pub extern "C" fn AcceptChannel_read(ser: crate::c_types::u8slice) -> crate::c_t } #[no_mangle] /// Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read -pub extern "C" fn AnnouncementSignatures_write(obj: &AnnouncementSignatures) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn AnnouncementSignatures_write(obj: &crate::lightning::ln::msgs::AnnouncementSignatures) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5414,7 +5414,7 @@ pub extern "C" fn AnnouncementSignatures_read(ser: crate::c_types::u8slice) -> c } #[no_mangle] /// Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read -pub extern "C" fn ChannelReestablish_write(obj: &ChannelReestablish) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelReestablish_write(obj: &crate::lightning::ln::msgs::ChannelReestablish) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5430,7 +5430,7 @@ pub extern "C" fn ChannelReestablish_read(ser: crate::c_types::u8slice) -> crate } #[no_mangle] /// Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read -pub extern "C" fn ClosingSigned_write(obj: &ClosingSigned) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ClosingSigned_write(obj: &crate::lightning::ln::msgs::ClosingSigned) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5446,7 +5446,7 @@ pub extern "C" fn ClosingSigned_read(ser: crate::c_types::u8slice) -> crate::c_t } #[no_mangle] /// Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read -pub extern "C" fn ClosingSignedFeeRange_write(obj: &ClosingSignedFeeRange) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ClosingSignedFeeRange_write(obj: &crate::lightning::ln::msgs::ClosingSignedFeeRange) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5462,7 +5462,7 @@ pub extern "C" fn ClosingSignedFeeRange_read(ser: crate::c_types::u8slice) -> cr } #[no_mangle] /// Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read -pub extern "C" fn CommitmentSigned_write(obj: &CommitmentSigned) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn CommitmentSigned_write(obj: &crate::lightning::ln::msgs::CommitmentSigned) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5478,7 +5478,7 @@ pub extern "C" fn CommitmentSigned_read(ser: crate::c_types::u8slice) -> crate:: } #[no_mangle] /// Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read -pub extern "C" fn FundingCreated_write(obj: &FundingCreated) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn FundingCreated_write(obj: &crate::lightning::ln::msgs::FundingCreated) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5494,7 +5494,7 @@ pub extern "C" fn FundingCreated_read(ser: crate::c_types::u8slice) -> crate::c_ } #[no_mangle] /// Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read -pub extern "C" fn FundingSigned_write(obj: &FundingSigned) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn FundingSigned_write(obj: &crate::lightning::ln::msgs::FundingSigned) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5510,7 +5510,7 @@ pub extern "C" fn FundingSigned_read(ser: crate::c_types::u8slice) -> crate::c_t } #[no_mangle] /// Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read -pub extern "C" fn FundingLocked_write(obj: &FundingLocked) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn FundingLocked_write(obj: &crate::lightning::ln::msgs::FundingLocked) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5526,7 +5526,7 @@ pub extern "C" fn FundingLocked_read(ser: crate::c_types::u8slice) -> crate::c_t } #[no_mangle] /// Serialize the Init object into a byte array which can be read by Init_read -pub extern "C" fn Init_write(obj: &Init) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn Init_write(obj: &crate::lightning::ln::msgs::Init) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5542,7 +5542,7 @@ pub extern "C" fn Init_read(ser: crate::c_types::u8slice) -> crate::c_types::der } #[no_mangle] /// Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read -pub extern "C" fn OpenChannel_write(obj: &OpenChannel) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn OpenChannel_write(obj: &crate::lightning::ln::msgs::OpenChannel) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5558,7 +5558,7 @@ pub extern "C" fn OpenChannel_read(ser: crate::c_types::u8slice) -> crate::c_typ } #[no_mangle] /// Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read -pub extern "C" fn RevokeAndACK_write(obj: &RevokeAndACK) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn RevokeAndACK_write(obj: &crate::lightning::ln::msgs::RevokeAndACK) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5574,7 +5574,7 @@ pub extern "C" fn RevokeAndACK_read(ser: crate::c_types::u8slice) -> crate::c_ty } #[no_mangle] /// Serialize the Shutdown object into a byte array which can be read by Shutdown_read -pub extern "C" fn Shutdown_write(obj: &Shutdown) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn Shutdown_write(obj: &crate::lightning::ln::msgs::Shutdown) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5590,7 +5590,7 @@ pub extern "C" fn Shutdown_read(ser: crate::c_types::u8slice) -> crate::c_types: } #[no_mangle] /// Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read -pub extern "C" fn UpdateFailHTLC_write(obj: &UpdateFailHTLC) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn UpdateFailHTLC_write(obj: &crate::lightning::ln::msgs::UpdateFailHTLC) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5606,7 +5606,7 @@ pub extern "C" fn UpdateFailHTLC_read(ser: crate::c_types::u8slice) -> crate::c_ } #[no_mangle] /// Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read -pub extern "C" fn UpdateFailMalformedHTLC_write(obj: &UpdateFailMalformedHTLC) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn UpdateFailMalformedHTLC_write(obj: &crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5622,7 +5622,7 @@ pub extern "C" fn UpdateFailMalformedHTLC_read(ser: crate::c_types::u8slice) -> } #[no_mangle] /// Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read -pub extern "C" fn UpdateFee_write(obj: &UpdateFee) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn UpdateFee_write(obj: &crate::lightning::ln::msgs::UpdateFee) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5638,7 +5638,7 @@ pub extern "C" fn UpdateFee_read(ser: crate::c_types::u8slice) -> crate::c_types } #[no_mangle] /// Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read -pub extern "C" fn UpdateFulfillHTLC_write(obj: &UpdateFulfillHTLC) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn UpdateFulfillHTLC_write(obj: &crate::lightning::ln::msgs::UpdateFulfillHTLC) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5654,7 +5654,7 @@ pub extern "C" fn UpdateFulfillHTLC_read(ser: crate::c_types::u8slice) -> crate: } #[no_mangle] /// Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read -pub extern "C" fn UpdateAddHTLC_write(obj: &UpdateAddHTLC) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn UpdateAddHTLC_write(obj: &crate::lightning::ln::msgs::UpdateAddHTLC) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5670,7 +5670,7 @@ pub extern "C" fn UpdateAddHTLC_read(ser: crate::c_types::u8slice) -> crate::c_t } #[no_mangle] /// Serialize the Ping object into a byte array which can be read by Ping_read -pub extern "C" fn Ping_write(obj: &Ping) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn Ping_write(obj: &crate::lightning::ln::msgs::Ping) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5686,7 +5686,7 @@ pub extern "C" fn Ping_read(ser: crate::c_types::u8slice) -> crate::c_types::der } #[no_mangle] /// Serialize the Pong object into a byte array which can be read by Pong_read -pub extern "C" fn Pong_write(obj: &Pong) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn Pong_write(obj: &crate::lightning::ln::msgs::Pong) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5702,7 +5702,7 @@ pub extern "C" fn Pong_read(ser: crate::c_types::u8slice) -> crate::c_types::der } #[no_mangle] /// Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read -pub extern "C" fn UnsignedChannelAnnouncement_write(obj: &UnsignedChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn UnsignedChannelAnnouncement_write(obj: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5718,7 +5718,7 @@ pub extern "C" fn UnsignedChannelAnnouncement_read(ser: crate::c_types::u8slice) } #[no_mangle] /// Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read -pub extern "C" fn ChannelAnnouncement_write(obj: &ChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelAnnouncement_write(obj: &crate::lightning::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5734,7 +5734,7 @@ pub extern "C" fn ChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crat } #[no_mangle] /// Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read -pub extern "C" fn UnsignedChannelUpdate_write(obj: &UnsignedChannelUpdate) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn UnsignedChannelUpdate_write(obj: &crate::lightning::ln::msgs::UnsignedChannelUpdate) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5750,7 +5750,7 @@ pub extern "C" fn UnsignedChannelUpdate_read(ser: crate::c_types::u8slice) -> cr } #[no_mangle] /// Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read -pub extern "C" fn ChannelUpdate_write(obj: &ChannelUpdate) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelUpdate_write(obj: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5766,7 +5766,7 @@ pub extern "C" fn ChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_t } #[no_mangle] /// Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read -pub extern "C" fn ErrorMessage_write(obj: &ErrorMessage) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ErrorMessage_write(obj: &crate::lightning::ln::msgs::ErrorMessage) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5782,7 +5782,7 @@ pub extern "C" fn ErrorMessage_read(ser: crate::c_types::u8slice) -> crate::c_ty } #[no_mangle] /// Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read -pub extern "C" fn WarningMessage_write(obj: &WarningMessage) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn WarningMessage_write(obj: &crate::lightning::ln::msgs::WarningMessage) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5798,7 +5798,7 @@ pub extern "C" fn WarningMessage_read(ser: crate::c_types::u8slice) -> crate::c_ } #[no_mangle] /// Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read -pub extern "C" fn UnsignedNodeAnnouncement_write(obj: &UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn UnsignedNodeAnnouncement_write(obj: &crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5814,7 +5814,7 @@ pub extern "C" fn UnsignedNodeAnnouncement_read(ser: crate::c_types::u8slice) -> } #[no_mangle] /// Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read -pub extern "C" fn NodeAnnouncement_write(obj: &NodeAnnouncement) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn NodeAnnouncement_write(obj: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5837,7 +5837,7 @@ pub extern "C" fn QueryShortChannelIds_read(ser: crate::c_types::u8slice) -> cra } #[no_mangle] /// Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read -pub extern "C" fn QueryShortChannelIds_write(obj: &QueryShortChannelIds) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn QueryShortChannelIds_write(obj: &crate::lightning::ln::msgs::QueryShortChannelIds) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5846,7 +5846,7 @@ pub(crate) extern "C" fn QueryShortChannelIds_write_void(obj: *const c_void) -> } #[no_mangle] /// Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read -pub extern "C" fn ReplyShortChannelIdsEnd_write(obj: &ReplyShortChannelIdsEnd) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ReplyShortChannelIdsEnd_write(obj: &crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5863,14 +5863,14 @@ pub extern "C" fn ReplyShortChannelIdsEnd_read(ser: crate::c_types::u8slice) -> ///\n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t #[must_use] #[no_mangle] -pub extern "C" fn QueryChannelRange_end_blocknum(this_arg: &QueryChannelRange) -> u32 { +pub extern "C" fn QueryChannelRange_end_blocknum(this_arg: &crate::lightning::ln::msgs::QueryChannelRange) -> u32 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.end_blocknum(); ret } #[no_mangle] /// Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read -pub extern "C" fn QueryChannelRange_write(obj: &QueryChannelRange) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn QueryChannelRange_write(obj: &crate::lightning::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5893,7 +5893,7 @@ pub extern "C" fn ReplyChannelRange_read(ser: crate::c_types::u8slice) -> crate: } #[no_mangle] /// Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read -pub extern "C" fn ReplyChannelRange_write(obj: &ReplyChannelRange) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ReplyChannelRange_write(obj: &crate::lightning::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -5902,7 +5902,7 @@ pub(crate) extern "C" fn ReplyChannelRange_write_void(obj: *const c_void) -> cra } #[no_mangle] /// Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read -pub extern "C" fn GossipTimestampFilter_write(obj: &GossipTimestampFilter) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn GossipTimestampFilter_write(obj: &crate::lightning::ln::msgs::GossipTimestampFilter) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] diff --git a/lightning-c-bindings/src/lightning/ln/peer_handler.rs b/lightning-c-bindings/src/lightning/ln/peer_handler.rs index bf6bd14..941d85b 100644 --- a/lightning-c-bindings/src/lightning/ln/peer_handler.rs +++ b/lightning-c-bindings/src/lightning/ln/peer_handler.rs @@ -405,9 +405,9 @@ impl ErroringMessageHandler { /// Constructs a new ErroringMessageHandler #[must_use] #[no_mangle] -pub extern "C" fn ErroringMessageHandler_new() -> ErroringMessageHandler { +pub extern "C" fn ErroringMessageHandler_new() -> crate::lightning::ln::peer_handler::ErroringMessageHandler { let mut ret = lightning::ln::peer_handler::ErroringMessageHandler::new(); - ErroringMessageHandler { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::peer_handler::ErroringMessageHandler { inner: ObjOps::heap_alloc(ret), is_owned: true } } impl From for crate::lightning::util::events::MessageSendEventsProvider { @@ -925,9 +925,9 @@ impl PeerManager { /// cryptographically secure random bytes. #[must_use] #[no_mangle] -pub extern "C" fn PeerManager_new(mut message_handler: crate::lightning::ln::peer_handler::MessageHandler, mut our_node_secret: crate::c_types::SecretKey, ephemeral_random_data: *const [u8; 32], mut logger: crate::lightning::util::logger::Logger, mut custom_message_handler: crate::lightning::ln::peer_handler::CustomMessageHandler) -> PeerManager { +pub extern "C" fn PeerManager_new(mut message_handler: crate::lightning::ln::peer_handler::MessageHandler, mut our_node_secret: crate::c_types::SecretKey, ephemeral_random_data: *const [u8; 32], mut logger: crate::lightning::util::logger::Logger, mut custom_message_handler: crate::lightning::ln::peer_handler::CustomMessageHandler) -> crate::lightning::ln::peer_handler::PeerManager { let mut ret = lightning::ln::peer_handler::PeerManager::new(*unsafe { Box::from_raw(message_handler.take_inner()) }, our_node_secret.into_rust(), unsafe { &*ephemeral_random_data}, logger, custom_message_handler); - PeerManager { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::peer_handler::PeerManager { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Get the list of node ids for peers which have completed the initial handshake. @@ -937,7 +937,7 @@ pub extern "C" fn PeerManager_new(mut message_handler: crate::lightning::ln::pee /// completed and we are sure the remote peer has the private key for the given node_id. #[must_use] #[no_mangle] -pub extern "C" fn PeerManager_get_peer_node_ids(this_arg: &PeerManager) -> crate::c_types::derived::CVec_PublicKeyZ { +pub extern "C" fn PeerManager_get_peer_node_ids(this_arg: &crate::lightning::ln::peer_handler::PeerManager) -> crate::c_types::derived::CVec_PublicKeyZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_peer_node_ids(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::PublicKey::from_rust(&item) }); }; local_ret.into() @@ -961,7 +961,7 @@ pub extern "C" fn PeerManager_get_peer_node_ids(this_arg: &PeerManager) -> crate /// [`socket_disconnected()`]: PeerManager::socket_disconnected #[must_use] #[no_mangle] -pub extern "C" fn PeerManager_new_outbound_connection(this_arg: &PeerManager, mut their_node_id: crate::c_types::PublicKey, mut descriptor: crate::lightning::ln::peer_handler::SocketDescriptor, mut remote_network_address: crate::c_types::derived::COption_NetAddressZ) -> crate::c_types::derived::CResult_CVec_u8ZPeerHandleErrorZ { +pub extern "C" fn PeerManager_new_outbound_connection(this_arg: &crate::lightning::ln::peer_handler::PeerManager, mut their_node_id: crate::c_types::PublicKey, mut descriptor: crate::lightning::ln::peer_handler::SocketDescriptor, mut remote_network_address: crate::c_types::derived::COption_NetAddressZ) -> crate::c_types::derived::CResult_CVec_u8ZPeerHandleErrorZ { let mut local_remote_network_address = { /* remote_network_address*/ let remote_network_address_opt = remote_network_address; { } if remote_network_address_opt.is_none() { None } else { Some({ remote_network_address_opt.take().into_native() }) } }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.new_outbound_connection(their_node_id.into_rust(), descriptor, local_remote_network_address); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = Vec::new(); for mut item in o.drain(..) { local_ret_0.push( { item }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::peer_handler::PeerHandleError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; @@ -986,7 +986,7 @@ pub extern "C" fn PeerManager_new_outbound_connection(this_arg: &PeerManager, mu /// [`socket_disconnected()`]: PeerManager::socket_disconnected #[must_use] #[no_mangle] -pub extern "C" fn PeerManager_new_inbound_connection(this_arg: &PeerManager, mut descriptor: crate::lightning::ln::peer_handler::SocketDescriptor, mut remote_network_address: crate::c_types::derived::COption_NetAddressZ) -> crate::c_types::derived::CResult_NonePeerHandleErrorZ { +pub extern "C" fn PeerManager_new_inbound_connection(this_arg: &crate::lightning::ln::peer_handler::PeerManager, mut descriptor: crate::lightning::ln::peer_handler::SocketDescriptor, mut remote_network_address: crate::c_types::derived::COption_NetAddressZ) -> crate::c_types::derived::CResult_NonePeerHandleErrorZ { let mut local_remote_network_address = { /* remote_network_address*/ let remote_network_address_opt = remote_network_address; { } if remote_network_address_opt.is_none() { None } else { Some({ remote_network_address_opt.take().into_native() }) } }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.new_inbound_connection(descriptor, local_remote_network_address); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::peer_handler::PeerHandleError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; @@ -1007,7 +1007,7 @@ pub extern "C" fn PeerManager_new_inbound_connection(this_arg: &PeerManager, mut /// [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail #[must_use] #[no_mangle] -pub extern "C" fn PeerManager_write_buffer_space_avail(this_arg: &PeerManager, descriptor: &mut crate::lightning::ln::peer_handler::SocketDescriptor) -> crate::c_types::derived::CResult_NonePeerHandleErrorZ { +pub extern "C" fn PeerManager_write_buffer_space_avail(this_arg: &crate::lightning::ln::peer_handler::PeerManager, descriptor: &mut crate::lightning::ln::peer_handler::SocketDescriptor) -> crate::c_types::derived::CResult_NonePeerHandleErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.write_buffer_space_avail(descriptor); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::peer_handler::PeerHandleError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret @@ -1029,7 +1029,7 @@ pub extern "C" fn PeerManager_write_buffer_space_avail(this_arg: &PeerManager, d /// [`process_events`]: PeerManager::process_events #[must_use] #[no_mangle] -pub extern "C" fn PeerManager_read_event(this_arg: &PeerManager, peer_descriptor: &mut crate::lightning::ln::peer_handler::SocketDescriptor, mut data: crate::c_types::u8slice) -> crate::c_types::derived::CResult_boolPeerHandleErrorZ { +pub extern "C" fn PeerManager_read_event(this_arg: &crate::lightning::ln::peer_handler::PeerManager, peer_descriptor: &mut crate::lightning::ln::peer_handler::SocketDescriptor, mut data: crate::c_types::u8slice) -> crate::c_types::derived::CResult_boolPeerHandleErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.read_event(peer_descriptor, data.to_slice()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::peer_handler::PeerHandleError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret @@ -1049,13 +1049,13 @@ pub extern "C" fn PeerManager_read_event(this_arg: &PeerManager, peer_descriptor /// [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards /// [`send_data`]: SocketDescriptor::send_data #[no_mangle] -pub extern "C" fn PeerManager_process_events(this_arg: &PeerManager) { +pub extern "C" fn PeerManager_process_events(this_arg: &crate::lightning::ln::peer_handler::PeerManager) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.process_events() } /// Indicates that the given socket descriptor's connection is now closed. #[no_mangle] -pub extern "C" fn PeerManager_socket_disconnected(this_arg: &PeerManager, descriptor: &crate::lightning::ln::peer_handler::SocketDescriptor) { +pub extern "C" fn PeerManager_socket_disconnected(this_arg: &crate::lightning::ln::peer_handler::PeerManager, descriptor: &crate::lightning::ln::peer_handler::SocketDescriptor) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.socket_disconnected(descriptor) } @@ -1069,7 +1069,7 @@ pub extern "C" fn PeerManager_socket_disconnected(this_arg: &PeerManager, descri /// /// [`disconnect_socket`]: SocketDescriptor::disconnect_socket #[no_mangle] -pub extern "C" fn PeerManager_disconnect_by_node_id(this_arg: &PeerManager, mut node_id: crate::c_types::PublicKey, mut no_connection_possible: bool) { +pub extern "C" fn PeerManager_disconnect_by_node_id(this_arg: &crate::lightning::ln::peer_handler::PeerManager, mut node_id: crate::c_types::PublicKey, mut no_connection_possible: bool) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.disconnect_by_node_id(node_id.into_rust(), no_connection_possible) } @@ -1077,7 +1077,7 @@ pub extern "C" fn PeerManager_disconnect_by_node_id(this_arg: &PeerManager, mut /// an indication that TCP sockets have stalled even if we weren't around to time them out /// using regular ping/pongs. #[no_mangle] -pub extern "C" fn PeerManager_disconnect_all_peers(this_arg: &PeerManager) { +pub extern "C" fn PeerManager_disconnect_all_peers(this_arg: &crate::lightning::ln::peer_handler::PeerManager) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.disconnect_all_peers() } @@ -1093,7 +1093,7 @@ pub extern "C" fn PeerManager_disconnect_all_peers(this_arg: &PeerManager) { /// /// [`send_data`]: SocketDescriptor::send_data #[no_mangle] -pub extern "C" fn PeerManager_timer_tick_occurred(this_arg: &PeerManager) { +pub extern "C" fn PeerManager_timer_tick_occurred(this_arg: &crate::lightning::ln::peer_handler::PeerManager) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.timer_tick_occurred() } diff --git a/lightning-c-bindings/src/lightning/ln/script.rs b/lightning-c-bindings/src/lightning/ln/script.rs index fe5c681..a092b6f 100644 --- a/lightning-c-bindings/src/lightning/ln/script.rs +++ b/lightning-c-bindings/src/lightning/ln/script.rs @@ -183,7 +183,7 @@ pub extern "C" fn InvalidShutdownScript_clone(orig: &InvalidShutdownScript) -> I } #[no_mangle] /// Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read -pub extern "C" fn ShutdownScript_write(obj: &ShutdownScript) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ShutdownScript_write(obj: &crate::lightning::ln::script::ShutdownScript) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -200,17 +200,17 @@ pub extern "C" fn ShutdownScript_read(ser: crate::c_types::u8slice) -> crate::c_ /// Generates a P2WPKH script pubkey from the given [`WPubkeyHash`]. #[must_use] #[no_mangle] -pub extern "C" fn ShutdownScript_new_p2wpkh(pubkey_hash: *const [u8; 20]) -> ShutdownScript { +pub extern "C" fn ShutdownScript_new_p2wpkh(pubkey_hash: *const [u8; 20]) -> crate::lightning::ln::script::ShutdownScript { let mut ret = lightning::ln::script::ShutdownScript::new_p2wpkh(&bitcoin::hash_types::WPubkeyHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *pubkey_hash }.clone()))); - ShutdownScript { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::script::ShutdownScript { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Generates a P2WSH script pubkey from the given [`WScriptHash`]. #[must_use] #[no_mangle] -pub extern "C" fn ShutdownScript_new_p2wsh(script_hash: *const [u8; 32]) -> ShutdownScript { +pub extern "C" fn ShutdownScript_new_p2wsh(script_hash: *const [u8; 32]) -> crate::lightning::ln::script::ShutdownScript { let mut ret = lightning::ln::script::ShutdownScript::new_p2wsh(&bitcoin::hash_types::WScriptHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *script_hash }.clone()))); - ShutdownScript { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::ln::script::ShutdownScript { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Generates a witness script pubkey from the given segwit version and program. @@ -232,7 +232,7 @@ pub extern "C" fn ShutdownScript_new_witness_program(mut version: u8, mut progra /// Converts the shutdown script into the underlying [`Script`]. #[must_use] #[no_mangle] -pub extern "C" fn ShutdownScript_into_inner(mut this_arg: ShutdownScript) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ShutdownScript_into_inner(mut this_arg: crate::lightning::ln::script::ShutdownScript) -> crate::c_types::derived::CVec_u8Z { let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).into_inner(); ret.into_bytes().into() } @@ -242,7 +242,7 @@ pub extern "C" fn ShutdownScript_into_inner(mut this_arg: ShutdownScript) -> cra /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn ShutdownScript_as_legacy_pubkey(this_arg: &ShutdownScript) -> crate::c_types::PublicKey { +pub extern "C" fn ShutdownScript_as_legacy_pubkey(this_arg: &crate::lightning::ln::script::ShutdownScript) -> crate::c_types::PublicKey { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_legacy_pubkey(); let mut local_ret = if ret.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(ret.unwrap())) } }; local_ret @@ -253,7 +253,7 @@ pub extern "C" fn ShutdownScript_as_legacy_pubkey(this_arg: &ShutdownScript) -> /// Specifically, checks for compliance with feature `option_shutdown_anysegwit`. #[must_use] #[no_mangle] -pub extern "C" fn ShutdownScript_is_compatible(this_arg: &ShutdownScript, features: &crate::lightning::ln::features::InitFeatures) -> bool { +pub extern "C" fn ShutdownScript_is_compatible(this_arg: &crate::lightning::ln::script::ShutdownScript, features: &crate::lightning::ln::features::InitFeatures) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_compatible(features.get_native_ref()); ret } diff --git a/lightning-c-bindings/src/lightning/routing/network_graph.rs b/lightning-c-bindings/src/lightning/routing/network_graph.rs index a3fce9e..8f509c4 100644 --- a/lightning-c-bindings/src/lightning/routing/network_graph.rs +++ b/lightning-c-bindings/src/lightning/routing/network_graph.rs @@ -89,15 +89,15 @@ pub extern "C" fn NodeId_clone(orig: &NodeId) -> NodeId { /// Create a new NodeId from a public key #[must_use] #[no_mangle] -pub extern "C" fn NodeId_from_pubkey(mut pubkey: crate::c_types::PublicKey) -> NodeId { +pub extern "C" fn NodeId_from_pubkey(mut pubkey: crate::c_types::PublicKey) -> crate::lightning::routing::network_graph::NodeId { let mut ret = lightning::routing::network_graph::NodeId::from_pubkey(&pubkey.into_rust()); - NodeId { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::routing::network_graph::NodeId { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Get the public key slice from this NodeId #[must_use] #[no_mangle] -pub extern "C" fn NodeId_as_slice(this_arg: &NodeId) -> crate::c_types::u8slice { +pub extern "C" fn NodeId_as_slice(this_arg: &crate::lightning::routing::network_graph::NodeId) -> crate::c_types::u8slice { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_slice(); let mut local_ret = crate::c_types::u8slice::from_slice(ret); local_ret @@ -115,7 +115,7 @@ pub extern "C" fn NodeId_hash(o: &NodeId) -> u64 { } #[no_mangle] /// Serialize the NodeId object into a byte array which can be read by NodeId_read -pub extern "C" fn NodeId_write(obj: &NodeId) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn NodeId_write(obj: &crate::lightning::routing::network_graph::NodeId) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -417,7 +417,7 @@ pub extern "C" fn NetworkUpdate_node_failure(node_id: crate::c_types::PublicKey, } #[no_mangle] /// Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read -pub extern "C" fn NetworkUpdate_write(obj: &NetworkUpdate) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn NetworkUpdate_write(obj: &crate::lightning::routing::network_graph::NetworkUpdate) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) } #[no_mangle] @@ -517,19 +517,19 @@ impl NetGraphMsgHandler { /// channel owners' keys. #[must_use] #[no_mangle] -pub extern "C" fn NetGraphMsgHandler_new(network_graph: &crate::lightning::routing::network_graph::NetworkGraph, mut chain_access: crate::c_types::derived::COption_AccessZ, mut logger: crate::lightning::util::logger::Logger) -> NetGraphMsgHandler { +pub extern "C" fn NetGraphMsgHandler_new(network_graph: &crate::lightning::routing::network_graph::NetworkGraph, mut chain_access: crate::c_types::derived::COption_AccessZ, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::routing::network_graph::NetGraphMsgHandler { let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } }; let mut ret = lightning::routing::network_graph::NetGraphMsgHandler::new(network_graph.get_native_ref(), local_chain_access, logger); - NetGraphMsgHandler { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::routing::network_graph::NetGraphMsgHandler { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Adds a provider used to check new announcements. Does not affect /// existing announcements unless they are updated. /// Add, update or remove the provider would replace the current one. #[no_mangle] -pub extern "C" fn NetGraphMsgHandler_add_chain_access(this_arg: &mut NetGraphMsgHandler, mut chain_access: crate::c_types::derived::COption_AccessZ) { +pub extern "C" fn NetGraphMsgHandler_add_chain_access(this_arg: &mut crate::lightning::routing::network_graph::NetGraphMsgHandler, mut chain_access: crate::c_types::derived::COption_AccessZ) { let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } }; - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut nativeNetGraphMsgHandler)) }.add_chain_access(local_chain_access) + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::routing::network_graph::nativeNetGraphMsgHandler)) }.add_chain_access(local_chain_access) } impl From for crate::lightning::ln::msgs::RoutingMessageHandler { @@ -835,7 +835,7 @@ pub extern "C" fn ChannelUpdateInfo_clone(orig: &ChannelUpdateInfo) -> ChannelUp } #[no_mangle] /// Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read -pub extern "C" fn ChannelUpdateInfo_write(obj: &ChannelUpdateInfo) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelUpdateInfo_write(obj: &crate::lightning::routing::network_graph::ChannelUpdateInfo) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1025,7 +1025,7 @@ pub extern "C" fn ChannelInfo_clone(orig: &ChannelInfo) -> ChannelInfo { } #[no_mangle] /// Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read -pub extern "C" fn ChannelInfo_write(obj: &ChannelInfo) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelInfo_write(obj: &crate::lightning::routing::network_graph::ChannelInfo) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1113,7 +1113,7 @@ pub extern "C" fn DirectedChannelInfo_clone(orig: &DirectedChannelInfo) -> Direc /// Returns information for the channel. #[must_use] #[no_mangle] -pub extern "C" fn DirectedChannelInfo_channel(this_arg: &DirectedChannelInfo) -> crate::lightning::routing::network_graph::ChannelInfo { +pub extern "C" fn DirectedChannelInfo_channel(this_arg: &crate::lightning::routing::network_graph::DirectedChannelInfo) -> crate::lightning::routing::network_graph::ChannelInfo { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel(); crate::lightning::routing::network_graph::ChannelInfo { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::routing::network_graph::ChannelInfo<>) as *mut _) }, is_owned: false } } @@ -1123,7 +1123,7 @@ pub extern "C" fn DirectedChannelInfo_channel(this_arg: &DirectedChannelInfo) -> /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn DirectedChannelInfo_direction(this_arg: &DirectedChannelInfo) -> crate::lightning::routing::network_graph::ChannelUpdateInfo { +pub extern "C" fn DirectedChannelInfo_direction(this_arg: &crate::lightning::routing::network_graph::DirectedChannelInfo) -> crate::lightning::routing::network_graph::ChannelUpdateInfo { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.direction(); let mut local_ret = crate::lightning::routing::network_graph::ChannelUpdateInfo { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::routing::network_graph::ChannelUpdateInfo<>) as *mut _ }, is_owned: false }; local_ret @@ -1136,7 +1136,7 @@ pub extern "C" fn DirectedChannelInfo_direction(this_arg: &DirectedChannelInfo) /// whichever is smaller. #[must_use] #[no_mangle] -pub extern "C" fn DirectedChannelInfo_effective_capacity(this_arg: &DirectedChannelInfo) -> crate::lightning::routing::network_graph::EffectiveCapacity { +pub extern "C" fn DirectedChannelInfo_effective_capacity(this_arg: &crate::lightning::routing::network_graph::DirectedChannelInfo) -> crate::lightning::routing::network_graph::EffectiveCapacity { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.effective_capacity(); crate::lightning::routing::network_graph::EffectiveCapacity::native_into(ret) } @@ -1315,7 +1315,7 @@ pub static UNKNOWN_CHANNEL_CAPACITY_MSAT: u64 = lightning::routing::network_grap /// Returns the effective capacity denominated in millisatoshi. #[must_use] #[no_mangle] -pub extern "C" fn EffectiveCapacity_as_msat(this_arg: &EffectiveCapacity) -> u64 { +pub extern "C" fn EffectiveCapacity_as_msat(this_arg: &crate::lightning::routing::network_graph::EffectiveCapacity) -> u64 { let mut ret = this_arg.to_native().as_msat(); ret } @@ -1444,7 +1444,7 @@ pub extern "C" fn RoutingFees_hash(o: &RoutingFees) -> u64 { } #[no_mangle] /// Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read -pub extern "C" fn RoutingFees_write(obj: &RoutingFees) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn RoutingFees_write(obj: &crate::lightning::routing::network_graph::RoutingFees) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1624,7 +1624,7 @@ pub extern "C" fn NodeAnnouncementInfo_clone(orig: &NodeAnnouncementInfo) -> Nod } #[no_mangle] /// Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read -pub extern "C" fn NodeAnnouncementInfo_write(obj: &NodeAnnouncementInfo) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn NodeAnnouncementInfo_write(obj: &crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1771,7 +1771,7 @@ pub extern "C" fn NodeInfo_clone(orig: &NodeInfo) -> NodeInfo { } #[no_mangle] /// Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read -pub extern "C" fn NodeInfo_write(obj: &NodeInfo) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn NodeInfo_write(obj: &crate::lightning::routing::network_graph::NodeInfo) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1787,7 +1787,7 @@ pub extern "C" fn NodeInfo_read(ser: crate::c_types::u8slice) -> crate::c_types: } #[no_mangle] /// Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read -pub extern "C" fn NetworkGraph_write(obj: &NetworkGraph) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn NetworkGraph_write(obj: &crate::lightning::routing::network_graph::NetworkGraph) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1812,7 +1812,7 @@ pub extern "C" fn NetworkGraph_new(mut genesis_hash: crate::c_types::ThirtyTwoBy /// Returns a read-only view of the network graph. #[must_use] #[no_mangle] -pub extern "C" fn NetworkGraph_read_only(this_arg: &NetworkGraph) -> crate::lightning::routing::network_graph::ReadOnlyNetworkGraph { +pub extern "C" fn NetworkGraph_read_only(this_arg: &crate::lightning::routing::network_graph::NetworkGraph) -> crate::lightning::routing::network_graph::ReadOnlyNetworkGraph { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.read_only(); crate::lightning::routing::network_graph::ReadOnlyNetworkGraph { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -1825,7 +1825,7 @@ pub extern "C" fn NetworkGraph_read_only(this_arg: &NetworkGraph) -> crate::ligh /// routing messages from a source using a protocol other than the lightning P2P protocol. #[must_use] #[no_mangle] -pub extern "C" fn NetworkGraph_update_node_from_announcement(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_NoneLightningErrorZ { +pub extern "C" fn NetworkGraph_update_node_from_announcement(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_NoneLightningErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_node_from_announcement(msg.get_native_ref(), secp256k1::SECP256K1); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret @@ -1837,7 +1837,7 @@ pub extern "C" fn NetworkGraph_update_node_from_announcement(this_arg: &NetworkG /// peers. #[must_use] #[no_mangle] -pub extern "C" fn NetworkGraph_update_node_from_unsigned_announcement(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> crate::c_types::derived::CResult_NoneLightningErrorZ { +pub extern "C" fn NetworkGraph_update_node_from_unsigned_announcement(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> crate::c_types::derived::CResult_NoneLightningErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_node_from_unsigned_announcement(msg.get_native_ref()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret @@ -1853,7 +1853,7 @@ pub extern "C" fn NetworkGraph_update_node_from_unsigned_announcement(this_arg: /// the corresponding UTXO exists on chain and is correctly-formatted. #[must_use] #[no_mangle] -pub extern "C" fn NetworkGraph_update_channel_from_announcement(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::ChannelAnnouncement, mut chain_access: crate::c_types::derived::COption_AccessZ) -> crate::c_types::derived::CResult_NoneLightningErrorZ { +pub extern "C" fn NetworkGraph_update_channel_from_announcement(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::ChannelAnnouncement, mut chain_access: crate::c_types::derived::COption_AccessZ) -> crate::c_types::derived::CResult_NoneLightningErrorZ { let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_from_announcement(msg.get_native_ref(), &local_chain_access, secp256k1::SECP256K1); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; @@ -1868,7 +1868,7 @@ pub extern "C" fn NetworkGraph_update_channel_from_announcement(this_arg: &Netwo /// the corresponding UTXO exists on chain and is correctly-formatted. #[must_use] #[no_mangle] -pub extern "C" fn NetworkGraph_update_channel_from_unsigned_announcement(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement, mut chain_access: crate::c_types::derived::COption_AccessZ) -> crate::c_types::derived::CResult_NoneLightningErrorZ { +pub extern "C" fn NetworkGraph_update_channel_from_unsigned_announcement(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement, mut chain_access: crate::c_types::derived::COption_AccessZ) -> crate::c_types::derived::CResult_NoneLightningErrorZ { let mut local_chain_access = { /* chain_access*/ let chain_access_opt = chain_access; { } if chain_access_opt.is_none() { None } else { Some({ chain_access_opt.take() }) } }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_from_unsigned_announcement(msg.get_native_ref(), &local_chain_access); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; @@ -1880,13 +1880,13 @@ pub extern "C" fn NetworkGraph_update_channel_from_unsigned_announcement(this_ar /// May cause the removal of nodes too, if this was their last channel. /// If not permanent, makes channels unavailable for routing. #[no_mangle] -pub extern "C" fn NetworkGraph_close_channel_from_update(this_arg: &NetworkGraph, mut short_channel_id: u64, mut is_permanent: bool) { +pub extern "C" fn NetworkGraph_close_channel_from_update(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, mut short_channel_id: u64, mut is_permanent: bool) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.close_channel_from_update(short_channel_id, is_permanent) } /// Marks a node in the graph as failed. #[no_mangle] -pub extern "C" fn NetworkGraph_fail_node(this_arg: &NetworkGraph, mut _node_id: crate::c_types::PublicKey, mut is_permanent: bool) { +pub extern "C" fn NetworkGraph_fail_node(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, mut _node_id: crate::c_types::PublicKey, mut is_permanent: bool) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fail_node(&_node_id.into_rust(), is_permanent) } @@ -1904,7 +1904,7 @@ pub extern "C" fn NetworkGraph_fail_node(this_arg: &NetworkGraph, mut _node_id: /// This method is only available with the `std` feature. See /// [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use. #[no_mangle] -pub extern "C" fn NetworkGraph_remove_stale_channels(this_arg: &NetworkGraph) { +pub extern "C" fn NetworkGraph_remove_stale_channels(this_arg: &crate::lightning::routing::network_graph::NetworkGraph) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels() } @@ -1919,7 +1919,7 @@ pub extern "C" fn NetworkGraph_remove_stale_channels(this_arg: &NetworkGraph) { /// This function takes the current unix time as an argument. For users with the `std` feature /// enabled, [`NetworkGraph::remove_stale_channels`] may be preferable. #[no_mangle] -pub extern "C" fn NetworkGraph_remove_stale_channels_with_time(this_arg: &NetworkGraph, mut current_time_unix: u64) { +pub extern "C" fn NetworkGraph_remove_stale_channels_with_time(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, mut current_time_unix: u64) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels_with_time(current_time_unix) } @@ -1934,7 +1934,7 @@ pub extern "C" fn NetworkGraph_remove_stale_channels_with_time(this_arg: &Networ /// materially in the future will be rejected. #[must_use] #[no_mangle] -pub extern "C" fn NetworkGraph_update_channel(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ { +pub extern "C" fn NetworkGraph_update_channel(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel(msg.get_native_ref(), secp256k1::SECP256K1); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret @@ -1948,7 +1948,7 @@ pub extern "C" fn NetworkGraph_update_channel(this_arg: &NetworkGraph, msg: &cra /// materially in the future will be rejected. #[must_use] #[no_mangle] -pub extern "C" fn NetworkGraph_update_channel_unsigned(this_arg: &NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ { +pub extern "C" fn NetworkGraph_update_channel_unsigned(this_arg: &crate::lightning::routing::network_graph::NetworkGraph, msg: &crate::lightning::ln::msgs::UnsignedChannelUpdate) -> crate::c_types::derived::CResult_NoneLightningErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_unsigned(msg.get_native_ref()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret @@ -1959,7 +1959,7 @@ pub extern "C" fn NetworkGraph_update_channel_unsigned(this_arg: &NetworkGraph, /// or if node announcement for the node was never received. #[must_use] #[no_mangle] -pub extern "C" fn ReadOnlyNetworkGraph_get_addresses(this_arg: &ReadOnlyNetworkGraph, mut pubkey: crate::c_types::PublicKey) -> crate::c_types::derived::COption_CVec_NetAddressZZ { +pub extern "C" fn ReadOnlyNetworkGraph_get_addresses(this_arg: &crate::lightning::routing::network_graph::ReadOnlyNetworkGraph, mut pubkey: crate::c_types::PublicKey) -> crate::c_types::derived::COption_CVec_NetAddressZZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_addresses(&pubkey.into_rust()); let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_NetAddressZZ::None } else { crate::c_types::derived::COption_CVec_NetAddressZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::lightning::ln::msgs::NetAddress::native_into(item) }); }; local_ret_0.into() }) }; local_ret diff --git a/lightning-c-bindings/src/lightning/routing/router.rs b/lightning-c-bindings/src/lightning/routing/router.rs index 6ba1106..df374d9 100644 --- a/lightning-c-bindings/src/lightning/routing/router.rs +++ b/lightning-c-bindings/src/lightning/routing/router.rs @@ -199,7 +199,7 @@ pub extern "C" fn RouteHop_eq(a: &RouteHop, b: &RouteHop) -> bool { } #[no_mangle] /// Serialize the RouteHop object into a byte array which can be read by RouteHop_read -pub extern "C" fn RouteHop_write(obj: &RouteHop) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn RouteHop_write(obj: &crate::lightning::routing::router::RouteHop) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -368,7 +368,7 @@ pub extern "C" fn Route_eq(a: &Route, b: &Route) -> bool { /// the amount passed to [`find_route`]'s `params.final_value_msat`. #[must_use] #[no_mangle] -pub extern "C" fn Route_get_total_fees(this_arg: &Route) -> u64 { +pub extern "C" fn Route_get_total_fees(this_arg: &crate::lightning::routing::router::Route) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_total_fees(); ret } @@ -376,14 +376,14 @@ pub extern "C" fn Route_get_total_fees(this_arg: &Route) -> u64 { /// Returns the total amount paid on this [`Route`], excluding the fees. #[must_use] #[no_mangle] -pub extern "C" fn Route_get_total_amount(this_arg: &Route) -> u64 { +pub extern "C" fn Route_get_total_amount(this_arg: &crate::lightning::routing::router::Route) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_total_amount(); ret } #[no_mangle] /// Serialize the Route object into a byte array which can be read by Route_read -pub extern "C" fn Route_write(obj: &Route) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn Route_write(obj: &crate::lightning::routing::router::Route) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -517,7 +517,7 @@ pub extern "C" fn RouteParameters_clone(orig: &RouteParameters) -> RouteParamete } #[no_mangle] /// Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read -pub extern "C" fn RouteParameters_write(obj: &RouteParameters) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn RouteParameters_write(obj: &crate::lightning::routing::router::RouteParameters) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -716,7 +716,7 @@ pub extern "C" fn PaymentParameters_eq(a: &PaymentParameters, b: &PaymentParamet } #[no_mangle] /// Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read -pub extern "C" fn PaymentParameters_write(obj: &PaymentParameters) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn PaymentParameters_write(obj: &crate::lightning::routing::router::PaymentParameters) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -733,17 +733,17 @@ pub extern "C" fn PaymentParameters_read(ser: crate::c_types::u8slice) -> crate: /// Creates a payee with the node id of the given `pubkey`. #[must_use] #[no_mangle] -pub extern "C" fn PaymentParameters_from_node_id(mut payee_pubkey: crate::c_types::PublicKey) -> PaymentParameters { +pub extern "C" fn PaymentParameters_from_node_id(mut payee_pubkey: crate::c_types::PublicKey) -> crate::lightning::routing::router::PaymentParameters { let mut ret = lightning::routing::router::PaymentParameters::from_node_id(payee_pubkey.into_rust()); - PaymentParameters { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::routing::router::PaymentParameters { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Creates a payee with the node id of the given `pubkey` to use for keysend payments. #[must_use] #[no_mangle] -pub extern "C" fn PaymentParameters_for_keysend(mut payee_pubkey: crate::c_types::PublicKey) -> PaymentParameters { +pub extern "C" fn PaymentParameters_for_keysend(mut payee_pubkey: crate::c_types::PublicKey) -> crate::lightning::routing::router::PaymentParameters { let mut ret = lightning::routing::router::PaymentParameters::for_keysend(payee_pubkey.into_rust()); - PaymentParameters { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::routing::router::PaymentParameters { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -857,7 +857,7 @@ pub extern "C" fn RouteHint_eq(a: &RouteHint, b: &RouteHint) -> bool { } #[no_mangle] /// Serialize the RouteHint object into a byte array which can be read by RouteHint_read -pub extern "C" fn RouteHint_write(obj: &RouteHint) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn RouteHint_write(obj: &crate::lightning::routing::router::RouteHint) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1047,7 +1047,7 @@ pub extern "C" fn RouteHintHop_eq(a: &RouteHintHop, b: &RouteHintHop) -> bool { } #[no_mangle] /// Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read -pub extern "C" fn RouteHintHop_write(obj: &RouteHintHop) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn RouteHintHop_write(obj: &crate::lightning::routing::router::RouteHintHop) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] diff --git a/lightning-c-bindings/src/lightning/routing/scoring.rs b/lightning-c-bindings/src/lightning/routing/scoring.rs index 85def69..0923a55 100644 --- a/lightning-c-bindings/src/lightning/routing/scoring.rs +++ b/lightning-c-bindings/src/lightning/routing/scoring.rs @@ -255,9 +255,9 @@ impl MultiThreadedLockableScore { /// Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. #[must_use] #[no_mangle] -pub extern "C" fn MultiThreadedLockableScore_new(mut score: crate::lightning::routing::scoring::Score) -> MultiThreadedLockableScore { +pub extern "C" fn MultiThreadedLockableScore_new(mut score: crate::lightning::routing::scoring::Score) -> crate::lightning::routing::scoring::MultiThreadedLockableScore { let mut ret = lightning::routing::scoring::MultiThreadedLockableScore::new(score); - MultiThreadedLockableScore { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::routing::scoring::MultiThreadedLockableScore { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -333,9 +333,9 @@ pub extern "C" fn FixedPenaltyScorer_clone(orig: &FixedPenaltyScorer) -> FixedPe /// Creates a new scorer using `penalty_msat`. #[must_use] #[no_mangle] -pub extern "C" fn FixedPenaltyScorer_with_penalty(mut penalty_msat: u64) -> FixedPenaltyScorer { +pub extern "C" fn FixedPenaltyScorer_with_penalty(mut penalty_msat: u64) -> crate::lightning::routing::scoring::FixedPenaltyScorer { let mut ret = lightning::routing::scoring::FixedPenaltyScorer::with_penalty(penalty_msat); - FixedPenaltyScorer { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::routing::scoring::FixedPenaltyScorer { inner: ObjOps::heap_alloc(ret), is_owned: true } } impl From for crate::lightning::routing::scoring::Score { @@ -378,7 +378,7 @@ extern "C" fn FixedPenaltyScorer_Score_payment_path_successful(this_arg: *mut c_ #[no_mangle] /// Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read -pub extern "C" fn FixedPenaltyScorer_write(obj: &FixedPenaltyScorer) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn FixedPenaltyScorer_write(obj: &crate::lightning::routing::scoring::FixedPenaltyScorer) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -659,7 +659,7 @@ pub extern "C" fn ScoringParameters_clone(orig: &ScoringParameters) -> ScoringPa } #[no_mangle] /// Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read -pub extern "C" fn ScoringParameters_write(obj: &ScoringParameters) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ScoringParameters_write(obj: &crate::lightning::routing::scoring::ScoringParameters) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -676,9 +676,9 @@ pub extern "C" fn ScoringParameters_read(ser: crate::c_types::u8slice) -> crate: /// Creates a new scorer using the given scoring parameters. #[must_use] #[no_mangle] -pub extern "C" fn Scorer_new(mut params: crate::lightning::routing::scoring::ScoringParameters) -> Scorer { +pub extern "C" fn Scorer_new(mut params: crate::lightning::routing::scoring::ScoringParameters) -> crate::lightning::routing::scoring::Scorer { let mut ret = lightning::routing::scoring::Scorer::new(*unsafe { Box::from_raw(params.take_inner()) }); - Scorer { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::routing::scoring::Scorer { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used. @@ -733,7 +733,7 @@ extern "C" fn Scorer_Score_payment_path_successful(this_arg: *mut c_void, mut pa #[no_mangle] /// Serialize the Scorer object into a byte array which can be read by Scorer_read -pub extern "C" fn Scorer_write(obj: &Scorer) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn Scorer_write(obj: &crate::lightning::routing::scoring::Scorer) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] @@ -1035,9 +1035,9 @@ pub extern "C" fn ProbabilisticScoringParameters_clone(orig: &ProbabilisticScori /// through a network graph. #[must_use] #[no_mangle] -pub extern "C" fn ProbabilisticScorer_new(mut params: crate::lightning::routing::scoring::ProbabilisticScoringParameters, network_graph: &crate::lightning::routing::network_graph::NetworkGraph) -> ProbabilisticScorer { +pub extern "C" fn ProbabilisticScorer_new(mut params: crate::lightning::routing::scoring::ProbabilisticScoringParameters, network_graph: &crate::lightning::routing::network_graph::NetworkGraph) -> crate::lightning::routing::scoring::ProbabilisticScorer { let mut ret = lightning::routing::scoring::ProbabilisticScorer::new(*unsafe { Box::from_raw(params.take_inner()) }, network_graph.get_native_ref()); - ProbabilisticScorer { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning::routing::scoring::ProbabilisticScorer { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used. @@ -1097,7 +1097,7 @@ use alloc::{vec::Vec, boxed::Box}; } #[no_mangle] /// Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read -pub extern "C" fn ProbabilisticScorer_write(obj: &ProbabilisticScorer) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ProbabilisticScorer_write(obj: &crate::lightning::routing::scoring::ProbabilisticScorer) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] diff --git a/lightning-c-bindings/src/lightning/util/config.rs b/lightning-c-bindings/src/lightning/util/config.rs index 13485b9..12a96f7 100644 --- a/lightning-c-bindings/src/lightning/util/config.rs +++ b/lightning-c-bindings/src/lightning/util/config.rs @@ -843,7 +843,7 @@ pub extern "C" fn ChannelConfig_default() -> ChannelConfig { } #[no_mangle] /// Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read -pub extern "C" fn ChannelConfig_write(obj: &ChannelConfig) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ChannelConfig_write(obj: &crate::lightning::util::config::ChannelConfig) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[no_mangle] diff --git a/lightning-c-bindings/src/lightning/util/events.rs b/lightning-c-bindings/src/lightning/util/events.rs index 02fd0ed..2d9104e 100644 --- a/lightning-c-bindings/src/lightning/util/events.rs +++ b/lightning-c-bindings/src/lightning/util/events.rs @@ -336,7 +336,7 @@ pub extern "C" fn ClosureReason_outdated_channel_manager() -> ClosureReason { ClosureReason::OutdatedChannelManager} #[no_mangle] /// Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read -pub extern "C" fn ClosureReason_write(obj: &ClosureReason) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn ClosureReason_write(obj: &crate::lightning::util::events::ClosureReason) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) } #[no_mangle] @@ -1260,7 +1260,7 @@ pub extern "C" fn Event_open_channel_request(temporary_channel_id: crate::c_type } #[no_mangle] /// Serialize the Event object into a byte array which can be read by Event_read -pub extern "C" fn Event_write(obj: &Event) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn Event_write(obj: &crate::lightning::util::events::Event) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) } #[no_mangle] diff --git a/lightning-c-bindings/src/lightning_background_processor.rs b/lightning-c-bindings/src/lightning_background_processor.rs index ba51e42..d6b7b82 100644 --- a/lightning-c-bindings/src/lightning_background_processor.rs +++ b/lightning-c-bindings/src/lightning_background_processor.rs @@ -196,10 +196,10 @@ impl Drop for Persister { /// Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn BackgroundProcessor_start(mut persister: crate::lightning_background_processor::Persister, mut event_handler: crate::lightning::util::events::EventHandler, chain_monitor: &crate::lightning::chain::chainmonitor::ChainMonitor, channel_manager: &crate::lightning::ln::channelmanager::ChannelManager, mut net_graph_msg_handler: crate::lightning::routing::network_graph::NetGraphMsgHandler, peer_manager: &crate::lightning::ln::peer_handler::PeerManager, mut logger: crate::lightning::util::logger::Logger) -> BackgroundProcessor { +pub extern "C" fn BackgroundProcessor_start(mut persister: crate::lightning_background_processor::Persister, mut event_handler: crate::lightning::util::events::EventHandler, chain_monitor: &crate::lightning::chain::chainmonitor::ChainMonitor, channel_manager: &crate::lightning::ln::channelmanager::ChannelManager, mut net_graph_msg_handler: crate::lightning::routing::network_graph::NetGraphMsgHandler, peer_manager: &crate::lightning::ln::peer_handler::PeerManager, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning_background_processor::BackgroundProcessor { let mut local_net_graph_msg_handler = if net_graph_msg_handler.inner.is_null() { None } else { Some( { net_graph_msg_handler.get_native_ref() }) }; let mut ret = lightning_background_processor::BackgroundProcessor::start(persister, event_handler, chain_monitor.get_native_ref(), channel_manager.get_native_ref(), local_net_graph_msg_handler, peer_manager.get_native_ref(), logger); - BackgroundProcessor { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning_background_processor::BackgroundProcessor { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting @@ -213,7 +213,7 @@ pub extern "C" fn BackgroundProcessor_start(mut persister: crate::lightning_back /// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager #[must_use] #[no_mangle] -pub extern "C" fn BackgroundProcessor_join(mut this_arg: BackgroundProcessor) -> crate::c_types::derived::CResult_NoneErrorZ { +pub extern "C" fn BackgroundProcessor_join(mut this_arg: crate::lightning_background_processor::BackgroundProcessor) -> crate::c_types::derived::CResult_NoneErrorZ { let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).join(); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::IOError::from_rust(e) }).into() }; local_ret @@ -230,7 +230,7 @@ pub extern "C" fn BackgroundProcessor_join(mut this_arg: BackgroundProcessor) -> /// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager #[must_use] #[no_mangle] -pub extern "C" fn BackgroundProcessor_stop(mut this_arg: BackgroundProcessor) -> crate::c_types::derived::CResult_NoneErrorZ { +pub extern "C" fn BackgroundProcessor_stop(mut this_arg: crate::lightning_background_processor::BackgroundProcessor) -> crate::c_types::derived::CResult_NoneErrorZ { let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).stop(); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::IOError::from_rust(e) }).into() }; local_ret diff --git a/lightning-c-bindings/src/lightning_invoice/mod.rs b/lightning-c-bindings/src/lightning_invoice/mod.rs index 4afdd97..e8840bf 100644 --- a/lightning-c-bindings/src/lightning_invoice/mod.rs +++ b/lightning-c-bindings/src/lightning_invoice/mod.rs @@ -1105,7 +1105,7 @@ pub extern "C" fn SiPrefix_eq(a: &SiPrefix, b: &SiPrefix) -> bool { /// This is effectively 10^12 * the prefix multiplier #[must_use] #[no_mangle] -pub extern "C" fn SiPrefix_multiplier(this_arg: &SiPrefix) -> u64 { +pub extern "C" fn SiPrefix_multiplier(this_arg: &crate::lightning_invoice::SiPrefix) -> u64 { let mut ret = this_arg.to_native().multiplier(); ret } @@ -2022,7 +2022,7 @@ pub extern "C" fn PrivateRoute_eq(a: &PrivateRoute, b: &PrivateRoute) -> bool { /// 3. signature #[must_use] #[no_mangle] -pub extern "C" fn SignedRawInvoice_into_parts(mut this_arg: SignedRawInvoice) -> crate::c_types::derived::C3Tuple_RawInvoice_u832InvoiceSignatureZ { +pub extern "C" fn SignedRawInvoice_into_parts(mut this_arg: crate::lightning_invoice::SignedRawInvoice) -> crate::c_types::derived::C3Tuple_RawInvoice_u832InvoiceSignatureZ { let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).into_parts(); let (mut orig_ret_0, mut orig_ret_1, mut orig_ret_2) = ret; let mut local_ret = (crate::lightning_invoice::RawInvoice { inner: ObjOps::heap_alloc(orig_ret_0), is_owned: true }, crate::c_types::ThirtyTwoBytes { data: orig_ret_1 }, crate::lightning_invoice::InvoiceSignature { inner: ObjOps::heap_alloc(orig_ret_2), is_owned: true }).into(); local_ret @@ -2031,7 +2031,7 @@ pub extern "C" fn SignedRawInvoice_into_parts(mut this_arg: SignedRawInvoice) -> /// The `RawInvoice` which was signed. #[must_use] #[no_mangle] -pub extern "C" fn SignedRawInvoice_raw_invoice(this_arg: &SignedRawInvoice) -> crate::lightning_invoice::RawInvoice { +pub extern "C" fn SignedRawInvoice_raw_invoice(this_arg: &crate::lightning_invoice::SignedRawInvoice) -> crate::lightning_invoice::RawInvoice { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.raw_invoice(); crate::lightning_invoice::RawInvoice { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning_invoice::RawInvoice<>) as *mut _) }, is_owned: false } } @@ -2039,7 +2039,7 @@ pub extern "C" fn SignedRawInvoice_raw_invoice(this_arg: &SignedRawInvoice) -> c /// The hash of the `RawInvoice` that was signed. #[must_use] #[no_mangle] -pub extern "C" fn SignedRawInvoice_hash(this_arg: &SignedRawInvoice) -> *const [u8; 32] { +pub extern "C" fn SignedRawInvoice_hash(this_arg: &crate::lightning_invoice::SignedRawInvoice) -> *const [u8; 32] { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.hash(); ret } @@ -2047,7 +2047,7 @@ pub extern "C" fn SignedRawInvoice_hash(this_arg: &SignedRawInvoice) -> *const [ /// InvoiceSignature for the invoice. #[must_use] #[no_mangle] -pub extern "C" fn SignedRawInvoice_signature(this_arg: &SignedRawInvoice) -> crate::lightning_invoice::InvoiceSignature { +pub extern "C" fn SignedRawInvoice_signature(this_arg: &crate::lightning_invoice::SignedRawInvoice) -> crate::lightning_invoice::InvoiceSignature { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signature(); crate::lightning_invoice::InvoiceSignature { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning_invoice::InvoiceSignature<>) as *mut _) }, is_owned: false } } @@ -2055,7 +2055,7 @@ pub extern "C" fn SignedRawInvoice_signature(this_arg: &SignedRawInvoice) -> cra /// Recovers the public key used for signing the invoice from the recoverable signature. #[must_use] #[no_mangle] -pub extern "C" fn SignedRawInvoice_recover_payee_pub_key(this_arg: &SignedRawInvoice) -> crate::c_types::derived::CResult_PayeePubKeyErrorZ { +pub extern "C" fn SignedRawInvoice_recover_payee_pub_key(this_arg: &crate::lightning_invoice::SignedRawInvoice) -> crate::c_types::derived::CResult_PayeePubKeyErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.recover_payee_pub_key(); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::PayeePubKey { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() }; local_ret @@ -2065,7 +2065,7 @@ pub extern "C" fn SignedRawInvoice_recover_payee_pub_key(this_arg: &SignedRawInv /// valid for the recovered signature (which should always be true?). #[must_use] #[no_mangle] -pub extern "C" fn SignedRawInvoice_check_signature(this_arg: &SignedRawInvoice) -> bool { +pub extern "C" fn SignedRawInvoice_check_signature(this_arg: &crate::lightning_invoice::SignedRawInvoice) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.check_signature(); ret } @@ -2073,7 +2073,7 @@ pub extern "C" fn SignedRawInvoice_check_signature(this_arg: &SignedRawInvoice) /// Calculate the hash of the encoded `RawInvoice` #[must_use] #[no_mangle] -pub extern "C" fn RawInvoice_hash(this_arg: &RawInvoice) -> crate::c_types::ThirtyTwoBytes { +pub extern "C" fn RawInvoice_hash(this_arg: &crate::lightning_invoice::RawInvoice) -> crate::c_types::ThirtyTwoBytes { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.hash(); crate::c_types::ThirtyTwoBytes { data: ret } } @@ -2082,7 +2082,7 @@ pub extern "C" fn RawInvoice_hash(this_arg: &RawInvoice) -> crate::c_types::Thir /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn RawInvoice_payment_hash(this_arg: &RawInvoice) -> crate::lightning_invoice::Sha256 { +pub extern "C" fn RawInvoice_payment_hash(this_arg: &crate::lightning_invoice::RawInvoice) -> crate::lightning_invoice::Sha256 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_hash(); let mut local_ret = crate::lightning_invoice::Sha256 { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning_invoice::Sha256<>) as *mut _ }, is_owned: false }; local_ret @@ -2092,7 +2092,7 @@ pub extern "C" fn RawInvoice_payment_hash(this_arg: &RawInvoice) -> crate::light /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn RawInvoice_description(this_arg: &RawInvoice) -> crate::lightning_invoice::Description { +pub extern "C" fn RawInvoice_description(this_arg: &crate::lightning_invoice::RawInvoice) -> crate::lightning_invoice::Description { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description(); let mut local_ret = crate::lightning_invoice::Description { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning_invoice::Description<>) as *mut _ }, is_owned: false }; local_ret @@ -2102,7 +2102,7 @@ pub extern "C" fn RawInvoice_description(this_arg: &RawInvoice) -> crate::lightn /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn RawInvoice_payee_pub_key(this_arg: &RawInvoice) -> crate::lightning_invoice::PayeePubKey { +pub extern "C" fn RawInvoice_payee_pub_key(this_arg: &crate::lightning_invoice::RawInvoice) -> crate::lightning_invoice::PayeePubKey { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payee_pub_key(); let mut local_ret = crate::lightning_invoice::PayeePubKey { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning_invoice::PayeePubKey<>) as *mut _ }, is_owned: false }; local_ret @@ -2112,7 +2112,7 @@ pub extern "C" fn RawInvoice_payee_pub_key(this_arg: &RawInvoice) -> crate::ligh /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn RawInvoice_description_hash(this_arg: &RawInvoice) -> crate::lightning_invoice::Sha256 { +pub extern "C" fn RawInvoice_description_hash(this_arg: &crate::lightning_invoice::RawInvoice) -> crate::lightning_invoice::Sha256 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description_hash(); let mut local_ret = crate::lightning_invoice::Sha256 { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning_invoice::Sha256<>) as *mut _ }, is_owned: false }; local_ret @@ -2122,7 +2122,7 @@ pub extern "C" fn RawInvoice_description_hash(this_arg: &RawInvoice) -> crate::l /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn RawInvoice_expiry_time(this_arg: &RawInvoice) -> crate::lightning_invoice::ExpiryTime { +pub extern "C" fn RawInvoice_expiry_time(this_arg: &crate::lightning_invoice::RawInvoice) -> crate::lightning_invoice::ExpiryTime { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.expiry_time(); let mut local_ret = crate::lightning_invoice::ExpiryTime { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning_invoice::ExpiryTime<>) as *mut _ }, is_owned: false }; local_ret @@ -2132,7 +2132,7 @@ pub extern "C" fn RawInvoice_expiry_time(this_arg: &RawInvoice) -> crate::lightn /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn RawInvoice_min_final_cltv_expiry(this_arg: &RawInvoice) -> crate::lightning_invoice::MinFinalCltvExpiry { +pub extern "C" fn RawInvoice_min_final_cltv_expiry(this_arg: &crate::lightning_invoice::RawInvoice) -> crate::lightning_invoice::MinFinalCltvExpiry { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.min_final_cltv_expiry(); let mut local_ret = crate::lightning_invoice::MinFinalCltvExpiry { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning_invoice::MinFinalCltvExpiry<>) as *mut _ }, is_owned: false }; local_ret @@ -2142,7 +2142,7 @@ pub extern "C" fn RawInvoice_min_final_cltv_expiry(this_arg: &RawInvoice) -> cra /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn RawInvoice_payment_secret(this_arg: &RawInvoice) -> crate::c_types::ThirtyTwoBytes { +pub extern "C" fn RawInvoice_payment_secret(this_arg: &crate::lightning_invoice::RawInvoice) -> crate::c_types::ThirtyTwoBytes { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_secret(); let mut local_ret = if ret.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (ret.unwrap()).0 } } }; local_ret @@ -2152,7 +2152,7 @@ pub extern "C" fn RawInvoice_payment_secret(this_arg: &RawInvoice) -> crate::c_t /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn RawInvoice_features(this_arg: &RawInvoice) -> crate::lightning::ln::features::InvoiceFeatures { +pub extern "C" fn RawInvoice_features(this_arg: &crate::lightning_invoice::RawInvoice) -> crate::lightning::ln::features::InvoiceFeatures { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.features(); let mut local_ret = crate::lightning::ln::features::InvoiceFeatures { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::ln::features::InvoiceFeatures<>) as *mut _ }, is_owned: false }; local_ret @@ -2160,7 +2160,7 @@ pub extern "C" fn RawInvoice_features(this_arg: &RawInvoice) -> crate::lightning #[must_use] #[no_mangle] -pub extern "C" fn RawInvoice_private_routes(this_arg: &RawInvoice) -> crate::c_types::derived::CVec_PrivateRouteZ { +pub extern "C" fn RawInvoice_private_routes(this_arg: &crate::lightning_invoice::RawInvoice) -> crate::c_types::derived::CVec_PrivateRouteZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.private_routes(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning_invoice::PrivateRoute { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning_invoice::PrivateRoute<>) as *mut _) }, is_owned: false } }); }; local_ret.into() @@ -2168,7 +2168,7 @@ pub extern "C" fn RawInvoice_private_routes(this_arg: &RawInvoice) -> crate::c_t #[must_use] #[no_mangle] -pub extern "C" fn RawInvoice_amount_pico_btc(this_arg: &RawInvoice) -> crate::c_types::derived::COption_u64Z { +pub extern "C" fn RawInvoice_amount_pico_btc(this_arg: &crate::lightning_invoice::RawInvoice) -> crate::c_types::derived::COption_u64Z { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_pico_btc(); let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) }; local_ret @@ -2176,7 +2176,7 @@ pub extern "C" fn RawInvoice_amount_pico_btc(this_arg: &RawInvoice) -> crate::c_ #[must_use] #[no_mangle] -pub extern "C" fn RawInvoice_currency(this_arg: &RawInvoice) -> crate::lightning_invoice::Currency { +pub extern "C" fn RawInvoice_currency(this_arg: &crate::lightning_invoice::RawInvoice) -> crate::lightning_invoice::Currency { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.currency(); crate::lightning_invoice::Currency::native_into(ret) } @@ -2219,7 +2219,7 @@ pub extern "C" fn PositiveTimestamp_from_duration_since_epoch(mut duration: u64) /// Returns the Unix timestamp representing the stored time #[must_use] #[no_mangle] -pub extern "C" fn PositiveTimestamp_as_unix_timestamp(this_arg: &PositiveTimestamp) -> u64 { +pub extern "C" fn PositiveTimestamp_as_unix_timestamp(this_arg: &crate::lightning_invoice::PositiveTimestamp) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_unix_timestamp(); ret } @@ -2227,7 +2227,7 @@ pub extern "C" fn PositiveTimestamp_as_unix_timestamp(this_arg: &PositiveTimesta /// Returns the duration of the stored time since the Unix epoch #[must_use] #[no_mangle] -pub extern "C" fn PositiveTimestamp_as_duration_since_epoch(this_arg: &PositiveTimestamp) -> u64 { +pub extern "C" fn PositiveTimestamp_as_duration_since_epoch(this_arg: &crate::lightning_invoice::PositiveTimestamp) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_duration_since_epoch(); ret.as_secs() } @@ -2235,7 +2235,7 @@ pub extern "C" fn PositiveTimestamp_as_duration_since_epoch(this_arg: &PositiveT /// Returns the [`SystemTime`] representing the stored time #[must_use] #[no_mangle] -pub extern "C" fn PositiveTimestamp_as_time(this_arg: &PositiveTimestamp) -> u64 { +pub extern "C" fn PositiveTimestamp_as_time(this_arg: &crate::lightning_invoice::PositiveTimestamp) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_time(); ret.duration_since(::std::time::SystemTime::UNIX_EPOCH).expect("Times must be post-1970").as_secs() } @@ -2243,7 +2243,7 @@ pub extern "C" fn PositiveTimestamp_as_time(this_arg: &PositiveTimestamp) -> u64 /// Transform the `Invoice` into it's unchecked version #[must_use] #[no_mangle] -pub extern "C" fn Invoice_into_signed_raw(mut this_arg: Invoice) -> crate::lightning_invoice::SignedRawInvoice { +pub extern "C" fn Invoice_into_signed_raw(mut this_arg: crate::lightning_invoice::Invoice) -> crate::lightning_invoice::SignedRawInvoice { let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).into_signed_raw(); crate::lightning_invoice::SignedRawInvoice { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -2251,7 +2251,7 @@ pub extern "C" fn Invoice_into_signed_raw(mut this_arg: Invoice) -> crate::light /// Check that the invoice is signed correctly and that key recovery works #[must_use] #[no_mangle] -pub extern "C" fn Invoice_check_signature(this_arg: &Invoice) -> crate::c_types::derived::CResult_NoneSemanticErrorZ { +pub extern "C" fn Invoice_check_signature(this_arg: &crate::lightning_invoice::Invoice) -> crate::c_types::derived::CResult_NoneSemanticErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.check_signature(); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SemanticError::native_into(e) }).into() }; local_ret @@ -2288,7 +2288,7 @@ pub extern "C" fn Invoice_from_signed(mut signed_invoice: crate::lightning_invoi /// Returns the `Invoice`'s timestamp (should equal its creation time) #[must_use] #[no_mangle] -pub extern "C" fn Invoice_timestamp(this_arg: &Invoice) -> u64 { +pub extern "C" fn Invoice_timestamp(this_arg: &crate::lightning_invoice::Invoice) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.timestamp(); ret.duration_since(::std::time::SystemTime::UNIX_EPOCH).expect("Times must be post-1970").as_secs() } @@ -2296,7 +2296,7 @@ pub extern "C" fn Invoice_timestamp(this_arg: &Invoice) -> u64 { /// Returns the `Invoice`'s timestamp as a duration since the Unix epoch #[must_use] #[no_mangle] -pub extern "C" fn Invoice_duration_since_epoch(this_arg: &Invoice) -> u64 { +pub extern "C" fn Invoice_duration_since_epoch(this_arg: &crate::lightning_invoice::Invoice) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.duration_since_epoch(); ret.as_secs() } @@ -2304,7 +2304,7 @@ pub extern "C" fn Invoice_duration_since_epoch(this_arg: &Invoice) -> u64 { /// Returns the hash to which we will receive the preimage on completion of the payment #[must_use] #[no_mangle] -pub extern "C" fn Invoice_payment_hash(this_arg: &Invoice) -> *const [u8; 32] { +pub extern "C" fn Invoice_payment_hash(this_arg: &crate::lightning_invoice::Invoice) -> *const [u8; 32] { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_hash(); ret.as_inner() } @@ -2314,7 +2314,7 @@ pub extern "C" fn Invoice_payment_hash(this_arg: &Invoice) -> *const [u8; 32] { /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn Invoice_payee_pub_key(this_arg: &Invoice) -> crate::c_types::PublicKey { +pub extern "C" fn Invoice_payee_pub_key(this_arg: &crate::lightning_invoice::Invoice) -> crate::c_types::PublicKey { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payee_pub_key(); let mut local_ret = if ret.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(ret.unwrap())) } }; local_ret @@ -2323,7 +2323,7 @@ pub extern "C" fn Invoice_payee_pub_key(this_arg: &Invoice) -> crate::c_types::P /// Get the payment secret if one was included in the invoice #[must_use] #[no_mangle] -pub extern "C" fn Invoice_payment_secret(this_arg: &Invoice) -> *const [u8; 32] { +pub extern "C" fn Invoice_payment_secret(this_arg: &crate::lightning_invoice::Invoice) -> *const [u8; 32] { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_secret(); &ret.0 } @@ -2333,7 +2333,7 @@ pub extern "C" fn Invoice_payment_secret(this_arg: &Invoice) -> *const [u8; 32] /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn Invoice_features(this_arg: &Invoice) -> crate::lightning::ln::features::InvoiceFeatures { +pub extern "C" fn Invoice_features(this_arg: &crate::lightning_invoice::Invoice) -> crate::lightning::ln::features::InvoiceFeatures { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.features(); let mut local_ret = crate::lightning::ln::features::InvoiceFeatures { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::ln::features::InvoiceFeatures<>) as *mut _ }, is_owned: false }; local_ret @@ -2342,7 +2342,7 @@ pub extern "C" fn Invoice_features(this_arg: &Invoice) -> crate::lightning::ln:: /// Recover the payee's public key (only to be used if none was included in the invoice) #[must_use] #[no_mangle] -pub extern "C" fn Invoice_recover_payee_pub_key(this_arg: &Invoice) -> crate::c_types::PublicKey { +pub extern "C" fn Invoice_recover_payee_pub_key(this_arg: &crate::lightning_invoice::Invoice) -> crate::c_types::PublicKey { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.recover_payee_pub_key(); crate::c_types::PublicKey::from_rust(&ret) } @@ -2350,7 +2350,7 @@ pub extern "C" fn Invoice_recover_payee_pub_key(this_arg: &Invoice) -> crate::c_ /// Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`]. #[must_use] #[no_mangle] -pub extern "C" fn Invoice_expiry_time(this_arg: &Invoice) -> u64 { +pub extern "C" fn Invoice_expiry_time(this_arg: &crate::lightning_invoice::Invoice) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.expiry_time(); ret.as_secs() } @@ -2358,7 +2358,7 @@ pub extern "C" fn Invoice_expiry_time(this_arg: &Invoice) -> u64 { /// Returns whether the invoice has expired. #[must_use] #[no_mangle] -pub extern "C" fn Invoice_is_expired(this_arg: &Invoice) -> bool { +pub extern "C" fn Invoice_is_expired(this_arg: &crate::lightning_invoice::Invoice) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_expired(); ret } @@ -2367,7 +2367,7 @@ pub extern "C" fn Invoice_is_expired(this_arg: &Invoice) -> bool { /// `at_time` is the timestamp as a duration since the Unix epoch. #[must_use] #[no_mangle] -pub extern "C" fn Invoice_would_expire(this_arg: &Invoice, mut at_time: u64) -> bool { +pub extern "C" fn Invoice_would_expire(this_arg: &crate::lightning_invoice::Invoice, mut at_time: u64) -> bool { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.would_expire(core::time::Duration::from_secs(at_time)); ret } @@ -2376,7 +2376,7 @@ pub extern "C" fn Invoice_would_expire(this_arg: &Invoice, mut at_time: u64) -> /// [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`]. #[must_use] #[no_mangle] -pub extern "C" fn Invoice_min_final_cltv_expiry(this_arg: &Invoice) -> u64 { +pub extern "C" fn Invoice_min_final_cltv_expiry(this_arg: &crate::lightning_invoice::Invoice) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.min_final_cltv_expiry(); ret } @@ -2384,7 +2384,7 @@ pub extern "C" fn Invoice_min_final_cltv_expiry(this_arg: &Invoice) -> u64 { /// Returns a list of all routes included in the invoice #[must_use] #[no_mangle] -pub extern "C" fn Invoice_private_routes(this_arg: &Invoice) -> crate::c_types::derived::CVec_PrivateRouteZ { +pub extern "C" fn Invoice_private_routes(this_arg: &crate::lightning_invoice::Invoice) -> crate::c_types::derived::CVec_PrivateRouteZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.private_routes(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning_invoice::PrivateRoute { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning_invoice::PrivateRoute<>) as *mut _) }, is_owned: false } }); }; local_ret.into() @@ -2393,7 +2393,7 @@ pub extern "C" fn Invoice_private_routes(this_arg: &Invoice) -> crate::c_types:: /// Returns a list of all routes included in the invoice as the underlying hints #[must_use] #[no_mangle] -pub extern "C" fn Invoice_route_hints(this_arg: &Invoice) -> crate::c_types::derived::CVec_RouteHintZ { +pub extern "C" fn Invoice_route_hints(this_arg: &crate::lightning_invoice::Invoice) -> crate::c_types::derived::CVec_RouteHintZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.route_hints(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::routing::router::RouteHint { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret.into() @@ -2402,7 +2402,7 @@ pub extern "C" fn Invoice_route_hints(this_arg: &Invoice) -> crate::c_types::der /// Returns the currency for which the invoice was issued #[must_use] #[no_mangle] -pub extern "C" fn Invoice_currency(this_arg: &Invoice) -> crate::lightning_invoice::Currency { +pub extern "C" fn Invoice_currency(this_arg: &crate::lightning_invoice::Invoice) -> crate::lightning_invoice::Currency { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.currency(); crate::lightning_invoice::Currency::native_into(ret) } @@ -2410,7 +2410,7 @@ pub extern "C" fn Invoice_currency(this_arg: &Invoice) -> crate::lightning_invoi /// Returns the amount if specified in the invoice as millisatoshis. #[must_use] #[no_mangle] -pub extern "C" fn Invoice_amount_milli_satoshis(this_arg: &Invoice) -> crate::c_types::derived::COption_u64Z { +pub extern "C" fn Invoice_amount_milli_satoshis(this_arg: &crate::lightning_invoice::Invoice) -> crate::c_types::derived::COption_u64Z { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_milli_satoshis(); let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) }; local_ret @@ -2431,7 +2431,7 @@ pub extern "C" fn Description_new(mut description: crate::c_types::Str) -> crate /// Returns the underlying description `String` #[must_use] #[no_mangle] -pub extern "C" fn Description_into_inner(mut this_arg: Description) -> crate::c_types::Str { +pub extern "C" fn Description_into_inner(mut this_arg: crate::lightning_invoice::Description) -> crate::c_types::Str { let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).into_inner(); ret.into() } @@ -2455,7 +2455,7 @@ pub extern "C" fn ExpiryTime_from_duration(mut duration: u64) -> crate::lightnin /// Returns the expiry time in seconds #[must_use] #[no_mangle] -pub extern "C" fn ExpiryTime_as_seconds(this_arg: &ExpiryTime) -> u64 { +pub extern "C" fn ExpiryTime_as_seconds(this_arg: &crate::lightning_invoice::ExpiryTime) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_seconds(); ret } @@ -2463,7 +2463,7 @@ pub extern "C" fn ExpiryTime_as_seconds(this_arg: &ExpiryTime) -> u64 { /// Returns a reference to the underlying `Duration` (=expiry time) #[must_use] #[no_mangle] -pub extern "C" fn ExpiryTime_as_duration(this_arg: &ExpiryTime) -> u64 { +pub extern "C" fn ExpiryTime_as_duration(this_arg: &crate::lightning_invoice::ExpiryTime) -> u64 { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_duration(); ret.as_secs() } @@ -2480,7 +2480,7 @@ pub extern "C" fn PrivateRoute_new(mut hops: crate::lightning::routing::router:: /// Returns the underlying list of hops #[must_use] #[no_mangle] -pub extern "C" fn PrivateRoute_into_inner(mut this_arg: PrivateRoute) -> crate::lightning::routing::router::RouteHint { +pub extern "C" fn PrivateRoute_into_inner(mut this_arg: crate::lightning_invoice::PrivateRoute) -> crate::lightning::routing::router::RouteHint { let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).into_inner(); crate::lightning::routing::router::RouteHint { inner: ObjOps::heap_alloc(ret), is_owned: true } } diff --git a/lightning-c-bindings/src/lightning_invoice/payment.rs b/lightning-c-bindings/src/lightning_invoice/payment.rs index 037ab49..5dd6f16 100644 --- a/lightning-c-bindings/src/lightning_invoice/payment.rs +++ b/lightning-c-bindings/src/lightning_invoice/payment.rs @@ -584,9 +584,9 @@ pub extern "C" fn PaymentError_sending(a: crate::lightning::ln::channelmanager:: /// `retry_attempts` has been exceeded for a given [`Invoice`]. #[must_use] #[no_mangle] -pub extern "C" fn InvoicePayer_new(mut payer: crate::lightning_invoice::payment::Payer, mut router: crate::lightning_invoice::payment::Router, scorer: &crate::lightning::routing::scoring::MultiThreadedLockableScore, mut logger: crate::lightning::util::logger::Logger, mut event_handler: crate::lightning::util::events::EventHandler, mut retry_attempts: crate::lightning_invoice::payment::RetryAttempts) -> InvoicePayer { +pub extern "C" fn InvoicePayer_new(mut payer: crate::lightning_invoice::payment::Payer, mut router: crate::lightning_invoice::payment::Router, scorer: &crate::lightning::routing::scoring::MultiThreadedLockableScore, mut logger: crate::lightning::util::logger::Logger, mut event_handler: crate::lightning::util::events::EventHandler, mut retry_attempts: crate::lightning_invoice::payment::RetryAttempts) -> crate::lightning_invoice::payment::InvoicePayer { let mut ret = lightning_invoice::payment::InvoicePayer::new(payer, router, scorer.get_native_ref(), logger, event_handler, *unsafe { Box::from_raw(retry_attempts.take_inner()) }); - InvoicePayer { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning_invoice::payment::InvoicePayer { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Pays the given [`Invoice`], caching it for later use in case a retry is needed. @@ -596,7 +596,7 @@ pub extern "C" fn InvoicePayer_new(mut payer: crate::lightning_invoice::payment: /// for you. #[must_use] #[no_mangle] -pub extern "C" fn InvoicePayer_pay_invoice(this_arg: &InvoicePayer, invoice: &crate::lightning_invoice::Invoice) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ { +pub extern "C" fn InvoicePayer_pay_invoice(this_arg: &crate::lightning_invoice::payment::InvoicePayer, invoice: &crate::lightning_invoice::Invoice) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_invoice(invoice.get_native_ref()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::payment::PaymentError::native_into(e) }).into() }; local_ret @@ -610,7 +610,7 @@ pub extern "C" fn InvoicePayer_pay_invoice(this_arg: &InvoicePayer, invoice: &cr /// for you. #[must_use] #[no_mangle] -pub extern "C" fn InvoicePayer_pay_zero_value_invoice(this_arg: &InvoicePayer, invoice: &crate::lightning_invoice::Invoice, mut amount_msats: u64) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ { +pub extern "C" fn InvoicePayer_pay_zero_value_invoice(this_arg: &crate::lightning_invoice::payment::InvoicePayer, invoice: &crate::lightning_invoice::Invoice, mut amount_msats: u64) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_zero_value_invoice(invoice.get_native_ref(), amount_msats); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::payment::PaymentError::native_into(e) }).into() }; local_ret @@ -623,7 +623,7 @@ pub extern "C" fn InvoicePayer_pay_zero_value_invoice(this_arg: &InvoicePayer, i /// been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you. #[must_use] #[no_mangle] -pub extern "C" fn InvoicePayer_pay_pubkey(this_arg: &InvoicePayer, mut pubkey: crate::c_types::PublicKey, mut payment_preimage: crate::c_types::ThirtyTwoBytes, mut amount_msats: u64, mut final_cltv_expiry_delta: u32) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ { +pub extern "C" fn InvoicePayer_pay_pubkey(this_arg: &crate::lightning_invoice::payment::InvoicePayer, mut pubkey: crate::c_types::PublicKey, mut payment_preimage: crate::c_types::ThirtyTwoBytes, mut amount_msats: u64, mut final_cltv_expiry_delta: u32) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_pubkey(pubkey.into_rust(), ::lightning::ln::PaymentPreimage(payment_preimage.data), amount_msats, final_cltv_expiry_delta); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::payment::PaymentError::native_into(e) }).into() }; local_ret @@ -634,7 +634,7 @@ pub extern "C" fn InvoicePayer_pay_pubkey(this_arg: &InvoicePayer, mut pubkey: c /// Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an /// [`EventHandler`]. Otherwise, calling this method is unnecessary. #[no_mangle] -pub extern "C" fn InvoicePayer_remove_cached_payment(this_arg: &InvoicePayer, payment_hash: *const [u8; 32]) { +pub extern "C" fn InvoicePayer_remove_cached_payment(this_arg: &crate::lightning_invoice::payment::InvoicePayer, payment_hash: *const [u8; 32]) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_cached_payment(&::lightning::ln::PaymentHash(unsafe { *payment_hash })) } diff --git a/lightning-c-bindings/src/lightning_invoice/utils.rs b/lightning-c-bindings/src/lightning_invoice/utils.rs index 4e18272..b3edba5 100644 --- a/lightning-c-bindings/src/lightning_invoice/utils.rs +++ b/lightning-c-bindings/src/lightning_invoice/utils.rs @@ -188,9 +188,9 @@ impl DefaultRouter { /// `random_seed_bytes`. #[must_use] #[no_mangle] -pub extern "C" fn DefaultRouter_new(network_graph: &crate::lightning::routing::network_graph::NetworkGraph, mut logger: crate::lightning::util::logger::Logger, mut random_seed_bytes: crate::c_types::ThirtyTwoBytes) -> DefaultRouter { +pub extern "C" fn DefaultRouter_new(network_graph: &crate::lightning::routing::network_graph::NetworkGraph, mut logger: crate::lightning::util::logger::Logger, mut random_seed_bytes: crate::c_types::ThirtyTwoBytes) -> crate::lightning_invoice::utils::DefaultRouter { let mut ret = lightning_invoice::utils::DefaultRouter::new(network_graph.get_native_ref(), logger, random_seed_bytes.data); - DefaultRouter { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning_invoice::utils::DefaultRouter { inner: ObjOps::heap_alloc(ret), is_owned: true } } impl From for crate::lightning_invoice::payment::Router { diff --git a/lightning-c-bindings/src/lightning_persister.rs b/lightning-c-bindings/src/lightning_persister.rs index cd112e9..9478e30 100644 --- a/lightning-c-bindings/src/lightning_persister.rs +++ b/lightning-c-bindings/src/lightning_persister.rs @@ -93,15 +93,15 @@ impl FilesystemPersister { /// files. #[must_use] #[no_mangle] -pub extern "C" fn FilesystemPersister_new(mut path_to_channel_data: crate::c_types::Str) -> FilesystemPersister { +pub extern "C" fn FilesystemPersister_new(mut path_to_channel_data: crate::c_types::Str) -> crate::lightning_persister::FilesystemPersister { let mut ret = lightning_persister::FilesystemPersister::new(path_to_channel_data.into_string()); - FilesystemPersister { inner: ObjOps::heap_alloc(ret), is_owned: true } + crate::lightning_persister::FilesystemPersister { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Get the directory which was provided when this persister was initialized. #[must_use] #[no_mangle] -pub extern "C" fn FilesystemPersister_get_data_dir(this_arg: &FilesystemPersister) -> crate::c_types::Str { +pub extern "C" fn FilesystemPersister_get_data_dir(this_arg: &crate::lightning_persister::FilesystemPersister) -> crate::c_types::Str { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_data_dir(); ret.into() } @@ -129,7 +129,7 @@ pub extern "C" fn FilesystemPersister_persist_network_graph(mut data_dir: crate: /// Read `ChannelMonitor`s from disk. #[must_use] #[no_mangle] -pub extern "C" fn FilesystemPersister_read_channelmonitors(this_arg: &FilesystemPersister, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface) -> crate::c_types::derived::CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { +pub extern "C" fn FilesystemPersister_read_channelmonitors(this_arg: &crate::lightning_persister::FilesystemPersister, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface) -> crate::c_types::derived::CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.read_channelmonitors(keys_manager); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = Vec::new(); for mut item in o.drain(..) { local_ret_0.push( { let (mut orig_ret_0_0_0, mut orig_ret_0_0_1) = item; let mut local_ret_0_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0_0.into_inner() }, crate::lightning::chain::channelmonitor::ChannelMonitor { inner: ObjOps::heap_alloc(orig_ret_0_0_1), is_owned: true }).into(); local_ret_0_0 }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::IOError::from_rust(e) }).into() }; local_ret