diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9a7287e..1e042e1d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,14 +37,18 @@ jobs: run: | git clone https://github.com/rust-bitcoin/rust-lightning cd rust-lightning - git checkout 0.0.116-bindings + git checkout 0.0.117-bindings + # Pin memchr until we can remove it + cargo update -p memchr --precise "2.5.0" --verbose - name: Fix Github Actions to not be broken run: git config --global --add safe.directory /__w/ldk-c-bindings/ldk-c-bindings - - name: Pin proc-macro and quote to meet MSRV + - name: Pin proc-macro, quote and memchr to meet MSRV run: | cd c-bindings-gen cargo update -p quote --precise "1.0.30" --verbose cargo update -p proc-macro2 --precise "1.0.65" --verbose + cd ../lightning-c-bindings + cargo update -p memchr --precise "2.5.0" --verbose - name: Rebuild bindings without std, and check the sample app builds + links run: ./genbindings.sh ./rust-lightning false - name: Rebuild bindings, and check the sample app builds + links @@ -97,7 +101,7 @@ jobs: run: | git clone https://github.com/rust-bitcoin/rust-lightning cd rust-lightning - git checkout 0.0.116-bindings + git checkout 0.0.117-bindings - name: Fix Github Actions to not be broken run: git config --global --add safe.directory /__w/ldk-c-bindings/ldk-c-bindings - name: Fetch MacOS SDK @@ -144,7 +148,7 @@ jobs: run: | git clone https://github.com/rust-bitcoin/rust-lightning cd rust-lightning - git checkout 0.0.116-bindings + git checkout 0.0.117-bindings - name: Rebuild bindings using Apple clang, and check the sample app builds + links run: ./genbindings.sh ./rust-lightning true - name: Rebuild bindings using upstream clang, and check the sample app builds + links diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index ad2690ce..7c066875 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -36,6 +36,7 @@ use blocks::*; const DEFAULT_IMPORTS: &'static str = " use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -533,8 +534,7 @@ fn writeln_trait<'a, 'b, W: std::io::Write>(w: &mut W, t: &'a syn::ItemTrait, ty writeln!(w, "\ttype {} = crate::{};", t.ident, $type_resolver.resolve_path(&tr.path, Some(&gen_types))).unwrap(); for bound in bounds_iter { if let syn::TypeParamBound::Trait(t) = bound { - // We only allow for `?Sized` here. - if let syn::TraitBoundModifier::Maybe(_) = t.modifier {} else { panic!(); } + // We only allow for `Sized` here. assert_eq!(t.path.segments.len(), 1); assert_eq!(format!("{}", t.path.segments[0].ident), "Sized"); } @@ -554,8 +554,7 @@ fn writeln_trait<'a, 'b, W: std::io::Write>(w: &mut W, t: &'a syn::ItemTrait, ty writeln!(w, "unsafe impl Send for {} {{}}", trait_name).unwrap(); writeln!(w, "unsafe impl Sync for {} {{}}", trait_name).unwrap(); - writeln!(w, "#[no_mangle]").unwrap(); - writeln!(w, "pub(crate) extern \"C\" fn {}_clone_fields(orig: &{}) -> {} {{", trait_name, trait_name, trait_name).unwrap(); + writeln!(w, "pub(crate) fn {}_clone_fields(orig: &{}) -> {} {{", trait_name, trait_name, trait_name).unwrap(); writeln!(w, "\t{} {{", trait_name).unwrap(); writeln!(w, "\t\tthis_arg: orig.this_arg,").unwrap(); for (field, clone_fn, _) in generated_fields.iter() { @@ -647,6 +646,8 @@ fn writeln_trait<'a, 'b, W: std::io::Write>(w: &mut W, t: &'a syn::ItemTrait, ty writeln!(w, "// directly as a Deref trait in higher-level structs:").unwrap(); writeln!(w, "impl core::ops::Deref for {} {{\n\ttype Target = Self;", trait_name).unwrap(); writeln!(w, "\tfn deref(&self) -> &Self {{\n\t\tself\n\t}}\n}}").unwrap(); + writeln!(w, "impl core::ops::DerefMut for {} {{", trait_name).unwrap(); + writeln!(w, "\tfn deref_mut(&mut self) -> &mut Self {{\n\t\tself\n\t}}\n}}").unwrap(); } writeln!(w, "/// Calls the free function if one is set").unwrap(); @@ -811,6 +812,19 @@ fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct, if all_fields_settable { // Build a constructor! writeln!(w, "/// Constructs a new {} given each field", struct_name).unwrap(); + match &s.fields { + syn::Fields::Named(fields) => { + writeln_arg_docs(w, &[], "", types, Some(&gen_types), + fields.named.iter().map(|field| (format!("{}_arg", field.ident.as_ref().unwrap()), &field.ty)), + None); + }, + syn::Fields::Unnamed(fields) => { + writeln_arg_docs(w, &[], "", types, Some(&gen_types), + fields.unnamed.iter().enumerate().map(|(idx, field)| (format!("{}_arg", ('a' as u8 + idx as u8)), &field.ty)), + None); + }, + syn::Fields::Unit => {}, + } write!(w, "#[must_use]\n#[no_mangle]\npub extern \"C\" fn {}_new(", struct_name).unwrap(); match &s.fields { diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 0ff81f81..1cb7420e 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -225,7 +225,8 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> { if path == "Sized" { continue; } if non_lifetimes_processed { return false; } non_lifetimes_processed = true; - if path != "std::ops::Deref" && path != "core::ops::Deref" { + if path != "std::ops::Deref" && path != "core::ops::Deref" && + path != "std::ops::DerefMut" && path != "core::ops::DerefMut" { let p = string_path_to_syn_path(&path); let ref_ty = parse_quote!(&#p); let mut_ref_ty = parse_quote!(&mut #p); @@ -347,14 +348,29 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> { // implement Deref for relevant types). We don't // bother to implement it for associated types, however, so we just // ignore such bounds. - if path != "std::ops::Deref" && path != "core::ops::Deref" { + if path != "std::ops::Deref" && path != "core::ops::Deref" && + path != "std::ops::DerefMut" && path != "core::ops::DerefMut" { self.typed_generics.insert(&t.ident, path); + } else { + let last_seg_args = &tr.path.segments.last().unwrap().arguments; + if let syn::PathArguments::AngleBracketed(args) = last_seg_args { + assert_eq!(args.args.len(), 1); + if let syn::GenericArgument::Binding(binding) = &args.args[0] { + assert_eq!(format!("{}", binding.ident), "Target"); + if let syn::Type::Path(p) = &binding.ty { + // Note that we are assuming the order of type + // declarations here, but that should be easy + // to handle. + let real_path = self.maybe_resolve_path(&p.path).unwrap(); + self.typed_generics.insert(&t.ident, real_path.clone()); + } else { unimplemented!(); } + } else { unimplemented!(); } + } else { unimplemented!(); } } } else { unimplemented!(); } for bound in bounds_iter { if let syn::TypeParamBound::Trait(t) = bound { // We only allow for `?Sized` here. - if let syn::TraitBoundModifier::Maybe(_) = t.modifier {} else { panic!(); } assert_eq!(t.path.segments.len(), 1); assert_eq!(format!("{}", t.path.segments[0].ident), "Sized"); } @@ -549,6 +565,7 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr Self::insert_primitive(&mut imports, "bool"); Self::insert_primitive(&mut imports, "u128"); Self::insert_primitive(&mut imports, "i64"); + Self::insert_primitive(&mut imports, "f64"); Self::insert_primitive(&mut imports, "u64"); Self::insert_primitive(&mut imports, "u32"); Self::insert_primitive(&mut imports, "u16"); @@ -662,12 +679,41 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr Some(first_seg_str + &remaining) } else if first_seg_str == "crate" { Some(self.crate_name.to_owned() + &remaining) + } else if self.library.modules.get(&format!("{}::{}", self.module_path, first_seg.ident)).is_some() { + Some(format!("{}::{}{}", self.module_path, first_seg.ident, remaining)) } else { None } } } pub fn maybe_resolve_path(&self, p: &syn::Path, generics: Option<&GenericTypes>) -> Option { self.maybe_resolve_imported_path(p, generics).map(|mut path| { + if path == "core::ops::Deref" || path == "core::ops::DerefMut" { + let last_seg = p.segments.last().unwrap(); + if let syn::PathArguments::AngleBracketed(args) = &last_seg.arguments { + assert_eq!(args.args.len(), 1); + if let syn::GenericArgument::Binding(binding) = &args.args[0] { + if let syn::Type::Path(p) = &binding.ty { + if let Some(inner_ty) = self.maybe_resolve_path(&p.path, generics) { + let mut module_riter = inner_ty.rsplitn(2, "::"); + let ty_ident = module_riter.next().unwrap(); + let module_name = module_riter.next().unwrap(); + let module = self.library.modules.get(module_name).unwrap(); + for item in module.items.iter() { + match item { + syn::Item::Trait(t) => { + if t.ident == ty_ident { + path = inner_ty; + break; + } + }, + _ => {} + } + } + } + } else { unimplemented!(); } + } else { unimplemented!(); } + } + } loop { // Now that we've resolved the path to the path as-imported, check whether the path // is actually a pub(.*) use statement and map it to the real path. @@ -817,7 +863,8 @@ fn initial_clonable_types() -> HashSet { res.insert("crate::c_types::WitnessVersion".to_owned()); res.insert("crate::c_types::TxIn".to_owned()); res.insert("crate::c_types::TxOut".to_owned()); - res.insert("crate::c_types::Signature".to_owned()); + res.insert("crate::c_types::ECDSASignature".to_owned()); + res.insert("crate::c_types::SchnorrSignature".to_owned()); res.insert("crate::c_types::RecoverableSignature".to_owned()); res.insert("crate::c_types::BigEndianScalar".to_owned()); res.insert("crate::c_types::Bech32Error".to_owned()); @@ -951,6 +998,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { match full_path { "bool" => true, "i64" => true, + "f64" => true, "u64" => true, "u32" => true, "u16" => true, @@ -983,10 +1031,10 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "[u8; 12]" if !is_ref => Some("crate::c_types::TwelveBytes"), "[u8; 4]" if !is_ref => Some("crate::c_types::FourBytes"), "[u8; 3]" if !is_ref => Some("crate::c_types::ThreeBytes"), // Used for RGB values - "[u16; 8]" if !is_ref => Some("crate::c_types::EightU16s"), + "[u16; 32]" if !is_ref => Some("crate::c_types::ThirtyTwoU16s"), "str" if is_ref => Some("crate::c_types::Str"), - "alloc::string::String"|"String" => Some("crate::c_types::Str"), + "alloc::string::String"|"String"|"std::path::PathBuf" => Some("crate::c_types::Str"), "bitcoin::Address" => Some("crate::c_types::Str"), @@ -1010,7 +1058,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "core::num::NonZeroU8" => Some("u8"), "secp256k1::PublicKey"|"bitcoin::secp256k1::PublicKey" => Some("crate::c_types::PublicKey"), - "bitcoin::secp256k1::ecdsa::Signature" => Some("crate::c_types::Signature"), + "bitcoin::secp256k1::ecdsa::Signature" => Some("crate::c_types::ECDSASignature"), + "bitcoin::secp256k1::schnorr::Signature" => Some("crate::c_types::SchnorrSignature"), "bitcoin::secp256k1::ecdsa::RecoverableSignature" => Some("crate::c_types::RecoverableSignature"), "bitcoin::secp256k1::SecretKey" if is_ref => Some("*const [u8; 32]"), "bitcoin::secp256k1::SecretKey" if !is_ref => Some("crate::c_types::SecretKey"), @@ -1055,10 +1104,12 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "lightning::ln::PaymentHash"|"lightning::ln::PaymentPreimage"|"lightning::ln::PaymentSecret" |"lightning::ln::channelmanager::PaymentId"|"lightning::ln::channelmanager::InterceptId" |"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId" + |"lightning::ln::ChannelId"|"lightning::ln::channel_id::ChannelId" if is_ref => Some("*const [u8; 32]"), "lightning::ln::PaymentHash"|"lightning::ln::PaymentPreimage"|"lightning::ln::PaymentSecret" |"lightning::ln::channelmanager::PaymentId"|"lightning::ln::channelmanager::InterceptId" |"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId" + |"lightning::ln::ChannelId"|"lightning::ln::channel_id::ChannelId" if !is_ref => Some("crate::c_types::ThirtyTwoBytes"), "lightning::io::Read" => Some("crate::c_types::u8slice"), @@ -1087,13 +1138,13 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "[u8; 12]" if !is_ref => Some(""), "[u8; 4]" if !is_ref => Some(""), "[u8; 3]" if !is_ref => Some(""), - "[u16; 8]" if !is_ref => Some(""), + "[u16; 32]" if !is_ref => Some(""), "[u8]" if is_ref => Some(""), "[usize]" if is_ref => Some(""), "str" if is_ref => Some(""), - "alloc::string::String"|"String" => Some(""), + "alloc::string::String"|"String"|"std::path::PathBuf" => Some(""), "std::io::Error"|"lightning::io::Error"|"lightning::io::ErrorKind" => Some(""), // Note that we'll panic for String if is_ref, as we only have non-owned memory, we // cannot create a &String. @@ -1115,12 +1166,12 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "bitcoin::secp256k1::PublicKey"|"secp256k1::PublicKey" if is_ref => Some("&"), "bitcoin::secp256k1::PublicKey"|"secp256k1::PublicKey" => Some(""), - "bitcoin::secp256k1::ecdsa::Signature" if is_ref => Some("&"), - "bitcoin::secp256k1::ecdsa::Signature" => Some(""), + "bitcoin::secp256k1::ecdsa::Signature"|"bitcoin::secp256k1::schnorr::Signature" if is_ref => Some("&"), + "bitcoin::secp256k1::ecdsa::Signature"|"bitcoin::secp256k1::schnorr::Signature" => Some(""), "bitcoin::secp256k1::ecdsa::RecoverableSignature" => Some(""), "bitcoin::secp256k1::SecretKey" if is_ref => Some("&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *"), "bitcoin::secp256k1::SecretKey" if !is_ref => Some(""), - "bitcoin::secp256k1::KeyPair" if !is_ref => Some("::bitcoin::secp256k1::KeyPair::new("), + "bitcoin::secp256k1::KeyPair" if !is_ref => Some("::bitcoin::secp256k1::KeyPair::from_secret_key(&secp256k1::global::SECP256K1, &"), "bitcoin::secp256k1::Scalar" if is_ref => Some("&"), "bitcoin::secp256k1::Scalar" if !is_ref => Some(""), "bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some("::bitcoin::secp256k1::ecdh::SharedSecret::from_bytes("), @@ -1170,6 +1221,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "lightning::ln::channelmanager::PaymentId" if is_ref=> Some("&::lightning::ln::channelmanager::PaymentId( unsafe { *"), "lightning::ln::channelmanager::InterceptId" if !is_ref => Some("::lightning::ln::channelmanager::InterceptId("), "lightning::ln::channelmanager::InterceptId" if is_ref=> Some("&::lightning::ln::channelmanager::InterceptId( unsafe { *"), + "lightning::ln::ChannelId"|"lightning::ln::channel_id::ChannelId" if !is_ref => Some("::lightning::ln::ChannelId("), + "lightning::ln::ChannelId"|"lightning::ln::channel_id::ChannelId" if is_ref => Some("&::lightning::ln::ChannelId(unsafe { *"), "lightning::sign::KeyMaterial" if !is_ref => Some("::lightning::sign::KeyMaterial("), "lightning::sign::KeyMaterial" if is_ref=> Some("&::lightning::sign::KeyMaterial( unsafe { *"), "lightning::chain::ClaimId" if !is_ref => Some("::lightning::chain::ClaimId("), @@ -1197,13 +1250,14 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "[u8; 12]" if !is_ref => Some(".data"), "[u8; 4]" if !is_ref => Some(".data"), "[u8; 3]" if !is_ref => Some(".data"), - "[u16; 8]" if !is_ref => Some(".data"), + "[u16; 32]" if !is_ref => Some(".data"), "[u8]" if is_ref => Some(".to_slice()"), "[usize]" if is_ref => Some(".to_slice()"), "str" if is_ref => Some(".into_str()"), "alloc::string::String"|"String" => Some(".into_string()"), + "std::path::PathBuf" => Some(".into_pathbuf()"), "std::io::Error"|"lightning::io::Error" => Some(".to_rust()"), "lightning::io::ErrorKind" => Some(".to_rust_kind()"), @@ -1223,7 +1277,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "core::num::NonZeroU8" => Some(").expect(\"Value must be non-zero\")"), "bitcoin::secp256k1::PublicKey"|"secp256k1::PublicKey" => Some(".into_rust()"), - "bitcoin::secp256k1::ecdsa::Signature" => Some(".into_rust()"), + "bitcoin::secp256k1::ecdsa::Signature"|"bitcoin::secp256k1::schnorr::Signature" => Some(".into_rust()"), "bitcoin::secp256k1::ecdsa::RecoverableSignature" => Some(".into_rust()"), "bitcoin::secp256k1::SecretKey" if !is_ref => Some(".into_rust()"), "bitcoin::secp256k1::SecretKey" if is_ref => Some("}[..]).unwrap()"), @@ -1264,10 +1318,12 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "lightning::ln::PaymentHash"|"lightning::ln::PaymentPreimage"|"lightning::ln::PaymentSecret" |"lightning::ln::channelmanager::PaymentId"|"lightning::ln::channelmanager::InterceptId" |"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId" + |"lightning::ln::ChannelId"|"lightning::ln::channel_id::ChannelId" if !is_ref => Some(".data)"), "lightning::ln::PaymentHash"|"lightning::ln::PaymentPreimage"|"lightning::ln::PaymentSecret" |"lightning::ln::channelmanager::PaymentId"|"lightning::ln::channelmanager::InterceptId" |"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId" + |"lightning::ln::ChannelId"|"lightning::ln::channel_id::ChannelId" if is_ref => Some(" })"), // List of traits we map (possibly during processing of other files): @@ -1308,13 +1364,13 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "[u8; 12]" if !is_ref => Some("crate::c_types::TwelveBytes { data: "), "[u8; 4]" if !is_ref => Some("crate::c_types::FourBytes { data: "), "[u8; 3]" if is_ref => Some(""), - "[u16; 8]" if !is_ref => Some("crate::c_types::EightU16s { data: "), + "[u16; 32]" if !is_ref => Some("crate::c_types::ThirtyTwoU16s { data: "), "[u8]" if is_ref => Some("local_"), "[usize]" if is_ref => Some("local_"), "str" if is_ref => Some(""), - "alloc::string::String"|"String" => Some(""), + "alloc::string::String"|"String"|"std::path::PathBuf" => Some(""), "bitcoin::Address" => Some("alloc::string::ToString::to_string(&"), @@ -1338,7 +1394,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "u128" => Some(""), "bitcoin::secp256k1::PublicKey"|"secp256k1::PublicKey" => Some("crate::c_types::PublicKey::from_rust(&"), - "bitcoin::secp256k1::ecdsa::Signature" => Some("crate::c_types::Signature::from_rust(&"), + "bitcoin::secp256k1::ecdsa::Signature" => Some("crate::c_types::ECDSASignature::from_rust(&"), + "bitcoin::secp256k1::schnorr::Signature" => Some("crate::c_types::SchnorrSignature::from_rust(&"), "bitcoin::secp256k1::ecdsa::RecoverableSignature" => Some("crate::c_types::RecoverableSignature::from_rust(&"), "bitcoin::secp256k1::SecretKey" if is_ref => Some(""), "bitcoin::secp256k1::SecretKey" if !is_ref => Some("crate::c_types::SecretKey::from_rust("), @@ -1382,10 +1439,12 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "lightning::ln::PaymentHash"|"lightning::ln::PaymentPreimage"|"lightning::ln::PaymentSecret" |"lightning::ln::channelmanager::PaymentId"|"lightning::ln::channelmanager::InterceptId" |"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId" + |"lightning::ln::ChannelId"|"lightning::ln::channel_id::ChannelId" if is_ref => Some("&"), "lightning::ln::PaymentHash"|"lightning::ln::PaymentPreimage"|"lightning::ln::PaymentSecret" |"lightning::ln::channelmanager::PaymentId"|"lightning::ln::channelmanager::InterceptId" |"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId" + |"lightning::ln::ChannelId"|"lightning::ln::channel_id::ChannelId" if !is_ref => Some("crate::c_types::ThirtyTwoBytes { data: "), "lightning::io::Read" => Some("crate::c_types::u8slice::from_vec(&crate::c_types::reader_to_vec("), @@ -1409,14 +1468,14 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "[u8; 12]" if !is_ref => Some(" }"), "[u8; 4]" if !is_ref => Some(" }"), "[u8; 3]" if is_ref => Some(""), - "[u16; 8]" if !is_ref => Some(" }"), + "[u16; 32]" if !is_ref => Some(" }"), "[u8]" if is_ref => Some(""), "[usize]" if is_ref => Some(""), "str" if is_ref => Some(".into()"), - "alloc::string::String"|"String" if is_ref => Some(".as_str().into()"), - "alloc::string::String"|"String" => Some(".into()"), + "alloc::string::String"|"String"|"std::path::PathBuf" if is_ref => Some(".as_str().into()"), + "alloc::string::String"|"String"|"std::path::PathBuf" => Some(".into()"), "bitcoin::Address" => Some(").into()"), @@ -1439,7 +1498,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "u128" => Some(".into()"), "bitcoin::secp256k1::PublicKey"|"secp256k1::PublicKey" => Some(")"), - "bitcoin::secp256k1::ecdsa::Signature" => Some(")"), + "bitcoin::secp256k1::ecdsa::Signature"|"bitcoin::secp256k1::schnorr::Signature" => Some(")"), "bitcoin::secp256k1::ecdsa::RecoverableSignature" => Some(")"), "bitcoin::secp256k1::SecretKey" if !is_ref => Some(")"), "bitcoin::secp256k1::SecretKey" if is_ref => Some(".as_ref()"), @@ -1481,10 +1540,12 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "lightning::ln::PaymentHash"|"lightning::ln::PaymentPreimage"|"lightning::ln::PaymentSecret" |"lightning::ln::channelmanager::PaymentId"|"lightning::ln::channelmanager::InterceptId" |"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId" + |"lightning::ln::ChannelId"|"lightning::ln::channel_id::ChannelId" if is_ref => Some(".0"), "lightning::ln::PaymentHash"|"lightning::ln::PaymentPreimage"|"lightning::ln::PaymentSecret" |"lightning::ln::channelmanager::PaymentId"|"lightning::ln::channelmanager::InterceptId" |"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId" + |"lightning::ln::ChannelId"|"lightning::ln::channel_id::ChannelId" if !is_ref => Some(".0 }"), "lightning::io::Read" => Some("))"), @@ -1496,7 +1557,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { fn empty_val_check_suffix_from_path(&self, full_path: &str) -> Option<&str> { match full_path { "secp256k1::PublicKey"|"bitcoin::secp256k1::PublicKey" => Some(".is_null()"), - "bitcoin::secp256k1::ecdsa::Signature" => Some(".is_null()"), _ => None } } @@ -2855,7 +2915,14 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { generics, &subtype, is_ref, is_mut, ptr_for_ref, true); } } else { - let id = subtype.rsplitn(2, ':').next().unwrap(); // Get the "Base" name of the resolved type + let mut resolved = Vec::new(); + let id = + if self.write_c_path_intern(&mut resolved, &$p_arg.path, generics, false, false, false, false, false) { + let inner = std::str::from_utf8(&resolved).unwrap(); + inner.rsplitn(2, "::").next().unwrap() + } else { + subtype.rsplitn(2, "::").next().unwrap() + }; write!(w, "{}", id).unwrap(); write!(mangled_type, "{}", id).unwrap(); if let Some(w2) = $extra_write as Option<&mut Vec> { @@ -2889,9 +2956,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { } else { return false; } } else if let syn::Type::Array(_) = elem { let mut resolved = Vec::new(); - if !self.write_c_type_intern(&mut resolved, &elem, generics, false, false, true, false, true) { return false; } + if !self.write_c_type_intern(&mut resolved, &elem, generics, false, false, false, false, false) { return false; } let array_inner = String::from_utf8(resolved).unwrap(); - let arr_name = array_inner.split("::").last().unwrap(); + let arr_name = array_inner.rsplitn(2, "::").next().unwrap(); write!(w, "{}", arr_name).unwrap(); write!(mangled_type, "{}", arr_name).unwrap(); } else { return false; } @@ -3018,7 +3085,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { // If this is a no-export'd crate and there's only one implementation in the // whole crate, just treat it as a reference to whatever the implementor is. if with_ref_lifetime { - write!(w, "&'static crate::{}", trait_impls[0]).unwrap(); + // Hope we're being printed in function generics and let rustc derive the + // type. + write!(w, "_").unwrap(); } else { write!(w, "&crate::{}", trait_impls[0]).unwrap(); } diff --git a/genbindings.sh b/genbindings.sh index 34982335..dcfc5ac9 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -353,13 +353,33 @@ if [ "$2" = "true" ]; then ls -lha a.out fi +function REALLY_PIN_CC { + # -Zbuild-std fails if we have any dependencies of build-deps, which + # cc added in 1.0.80, thus we pin back to 1.0.79 to avoid that. + cargo update -p cc --precise "1.0.79" --verbose + ( cargo build --features=std -v --release -Zbuild-std=std,panic_abort > /dev/null 2>&1 ) || echo -n + ( cargo build --features=std -v --release --target aarch64-apple-darwin -Zbuild-std=std,panic_abort > /dev/null 2>&1 ) || echo -n + # Sadly, std also depends on cc, and we can't pin it in that tree + # directly. Instead, we have to delete the file out of the cargo + # registry and build --offline to avoid it using the latest version. + NEW_CC_DEP="$CARGO_HOME" + [ "$NEW_CC_DEP" = "" ] && NEW_CC_DEP="$HOME" + if [ -f "$NEW_CC_DEP/.cargo/registry/cache/github.com-"*/cc-1.0.79.crate ]; then + mv "$NEW_CC_DEP/.cargo/registry/cache/github.com-"*/cc-1.0.79.crate ./ + fi + rm -f "$NEW_CC_DEP/.cargo/registry/cache/github.com-"*/cc-*.crate + [ -f ./cc-1.0.79.crate ] && mv ./cc-1.0.79.crate "$NEW_CC_DEP/.cargo/registry/cache/github.com-"*/ +} + # Then, check with memory sanitizer, if we're on Linux and have rustc nightly if [ "$HOST_PLATFORM" = "x86_64-unknown-linux-gnu" ]; then if cargo +nightly --version >/dev/null 2>&1; then LLVM_V=$(rustc +nightly --version --verbose | grep "LLVM version" | awk '{ print substr($3, 0, 2); }') if [ -x "$(which clang-$LLVM_V)" ]; then cargo +nightly clean - cargo +nightly rustc $CARGO_BUILD_ARGS -Zbuild-std=std,panic_abort --target x86_64-unknown-linux-gnu -v -- -Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes + + REALLY_PIN_CC + cargo +nightly rustc --offline $CARGO_BUILD_ARGS -Zbuild-std=std,panic_abort --target x86_64-unknown-linux-gnu -v -- -Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes mv target/x86_64-unknown-linux-gnu/debug/libldk.* target/debug/ # Sadly, std doesn't seem to compile into something that is memsan-safe as of Aug 2020, @@ -552,12 +572,13 @@ if [ "$CLANGPP" != "" -a "$LLD" != "" ]; then LINK_ARG_FLAGS="-C link-arg=-fuse-ld=$LLD" export LDK_CLANG_PATH=$(which $CLANG) if [ "$MACOS_SDK" != "" ]; then + REALLY_PIN_CC export CLANG="$(pwd)/../deterministic-build-wrappers/clang-lto-link-osx" for ARG in $CFLAGS_aarch64_apple_darwin; do MANUAL_LINK_CFLAGS="$MANUAL_LINK_CFLAGS -C link-arg=$ARG" done export CFLAGS_aarch64_apple_darwin="$CFLAGS_aarch64_apple_darwin -O3 -fPIC -fembed-bitcode" - RUSTC_BOOTSTRAP=1 RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=apple-a14 -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $MANUAL_LINK_CFLAGS $LINK_ARG_FLAGS -C link-arg=-mcpu=apple-a14" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS -v --release --target aarch64-apple-darwin -Zbuild-std=std,panic_abort + RUSTC_BOOTSTRAP=1 RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=apple-a14 -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $MANUAL_LINK_CFLAGS $LINK_ARG_FLAGS -C link-arg=-mcpu=apple-a14" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS --offline -v --release --target aarch64-apple-darwin -Zbuild-std=std,panic_abort if [ "$HOST_OSX" != "true" ]; then # If we're not on OSX but can build OSX binaries, build the x86_64 OSX release now MANUAL_LINK_CFLAGS="" @@ -565,7 +586,7 @@ if [ "$CLANGPP" != "" -a "$LLD" != "" ]; then MANUAL_LINK_CFLAGS="$MANUAL_LINK_CFLAGS -C link-arg=$ARG" done export CFLAGS_x86_64_apple_darwin="$CFLAGS_x86_64_apple_darwin -O3 -fPIC -fembed-bitcode" - RUSTC_BOOTSTRAP=1 RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=sandybridge -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $MANUAL_LINK_CFLAGS $LINK_ARG_FLAGS -C link-arg=-mcpu=sandybridge -C link-arg=-mtune=sandybridge" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS -v --release --target x86_64-apple-darwin -Zbuild-std=std,panic_abort + RUSTC_BOOTSTRAP=1 RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=sandybridge -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $MANUAL_LINK_CFLAGS $LINK_ARG_FLAGS -C link-arg=-mcpu=sandybridge -C link-arg=-mtune=sandybridge" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS --offline -v --release --target x86_64-apple-darwin -Zbuild-std=std,panic_abort fi fi # If we're on an M1 don't bother building X86 binaries diff --git a/ldk-net/ldk_net.c b/ldk-net/ldk_net.c index 6e858b0e..fcc0e527 100644 --- a/ldk-net/ldk_net.c +++ b/ldk-net/ldk_net.c @@ -168,11 +168,11 @@ static inline LDKSocketDescriptor get_descriptor(struct SocketHandler *handler, return ret; } -static LDKCOption_NetAddressZ get_remote_network_address(int fd) { +static LDKCOption_SocketAddressZ get_remote_network_address(int fd) { struct sockaddr_storage sockaddr; socklen_t remote_addr_len = sizeof(sockaddr); if (getpeername(fd, (struct sockaddr*)&sockaddr, &remote_addr_len) == -1) { - return COption_NetAddressZ_none(); + return COption_SocketAddressZ_none(); } switch (sockaddr.ss_family) { @@ -180,16 +180,16 @@ static LDKCOption_NetAddressZ get_remote_network_address(int fd) { const struct sockaddr_in *remote_addr = (struct sockaddr_in*)&sockaddr; LDKFourBytes addr; memcpy(&addr, &remote_addr->sin_addr.s_addr, 4); - return COption_NetAddressZ_some(NetAddress_ipv4(addr, ntohs(remote_addr->sin_port))); + return COption_SocketAddressZ_some(SocketAddress_tcp_ip_v4(addr, ntohs(remote_addr->sin_port))); } case AF_INET6: { const struct sockaddr_in6 *remote_addr = (struct sockaddr_in6*)&sockaddr; LDKSixteenBytes addr; memcpy(&addr, &remote_addr->sin6_addr.s6_addr, 16); - return COption_NetAddressZ_some(NetAddress_ipv6(addr, ntohs(remote_addr->sin6_port))); + return COption_SocketAddressZ_some(SocketAddress_tcp_ip_v6(addr, ntohs(remote_addr->sin6_port))); } default: - return COption_NetAddressZ_none(); + return COption_SocketAddressZ_none(); } } diff --git a/lightning-c-bindings/Cargo.toml b/lightning-c-bindings/Cargo.toml index 409c66dd..c440d677 100644 --- a/lightning-c-bindings/Cargo.toml +++ b/lightning-c-bindings/Cargo.toml @@ -22,11 +22,11 @@ std = ["bitcoin/std", "lightning/std", "lightning-invoice/std", "lightning-backg bitcoin = { version = "0.29", default-features = false } secp256k1 = { version = "0.24", features = ["global-context", "recovery"] } # Note that the following line is matched by genbindings to update the path -lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.0.116-bindings", default-features = false } -lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.0.116-bindings", default-features = false } -lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.0.116-bindings", default-features = false } -lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.0.116-bindings", default-features = false } -lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.0.116-bindings", default-features = false } +lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.0.117-bindings", default-features = false } +lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.0.117-bindings", default-features = false } +lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.0.117-bindings", default-features = false } +lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.0.117-bindings", default-features = false } +lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.0.117-bindings", default-features = false } core2 = { version = "0.3.0", optional = true, default-features = false } diff --git a/lightning-c-bindings/demo.c b/lightning-c-bindings/demo.c index 994adbf3..ed4e1afb 100644 --- a/lightning-c-bindings/demo.c +++ b/lightning-c-bindings/demo.c @@ -25,8 +25,8 @@ void broadcast_txn(const void *this_arg, LDKCVec_TransactionZ txn) { CVec_TransactionZ_free(txn); } -LDKChannelMonitorUpdateStatus add_channel_monitor(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) { - return ChannelMonitorUpdateStatus_completed(); +LDKCResult_ChannelMonitorUpdateStatusNoneZ add_channel_monitor(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) { + return CResult_ChannelMonitorUpdateStatusNoneZ_ok(ChannelMonitorUpdateStatus_completed()); } LDKChannelMonitorUpdateStatus update_channel_monitor(const void *this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate *monitor) { return ChannelMonitorUpdateStatus_completed(); diff --git a/lightning-c-bindings/demo.cpp b/lightning-c-bindings/demo.cpp index c5c4b691..a766e566 100644 --- a/lightning-c-bindings/demo.cpp +++ b/lightning-c-bindings/demo.cpp @@ -137,7 +137,7 @@ struct NodeMonitors { } }; -LDKChannelMonitorUpdateStatus add_channel_monitor(const void *this_arg, LDKOutPoint funding_txo_arg, LDKChannelMonitor monitor_arg) { +LDKCResult_ChannelMonitorUpdateStatusNoneZ add_channel_monitor(const void *this_arg, LDKOutPoint funding_txo_arg, LDKChannelMonitor monitor_arg) { // First bind the args to C++ objects so they auto-free LDK::ChannelMonitor mon(std::move(monitor_arg)); LDK::OutPoint funding_txo(std::move(funding_txo_arg)); @@ -146,7 +146,7 @@ LDKChannelMonitorUpdateStatus add_channel_monitor(const void *this_arg, LDKOutPo std::unique_lock l(arg->mut); arg->mons.push_back(std::make_pair(std::move(funding_txo), std::move(mon))); - return ChannelMonitorUpdateStatus_completed(); + return CResult_ChannelMonitorUpdateStatusNoneZ_ok(ChannelMonitorUpdateStatus_completed()); } static std::atomic_int mons_updated(0); LDKChannelMonitorUpdateStatus update_channel_monitor(const void *this_arg, LDKOutPoint funding_txo_arg, const LDKChannelMonitorUpdate *update) { @@ -164,7 +164,7 @@ LDKChannelMonitorUpdateStatus update_channel_monitor(const void *this_arg, LDKOu LDKBroadcasterInterface broadcaster = { .broadcast_transactions = broadcast_txn, }; - LDK::CResult_NoneNoneZ res = ChannelMonitor_update_monitor(&mon.second, update, &broadcaster, fee_est, arg->logger); + LDK::CResult_NoneNoneZ res = ChannelMonitor_update_monitor(&mon.second, update, &broadcaster, &fee_est, arg->logger); assert(res->result_ok); } } @@ -187,7 +187,7 @@ LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ monitors_pending_monitor_e // Rust Vecs to each other from C++ will require a bit of effort. assert(arg->mons.size() == 1); LDK::CVec_MonitorEventZ events = ChannelMonitor_get_and_clear_pending_monitor_events(&arg->mons[0].second); - LDK::C2Tuple_OutPointScriptZ funding_info = ChannelMonitor_get_funding_txo(&arg->mons[0].second); + LDK::C2Tuple_OutPointCVec_u8ZZ funding_info = ChannelMonitor_get_funding_txo(&arg->mons[0].second); LDK::OutPoint outpoint = std::move(funding_info->a); LDKPublicKey counterparty_node_id = ChannelMonitor_get_counterparty_node_id(&arg->mons[0].second); LDK::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ tuple = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(std::move(outpoint), std::move(events), std::move(counterparty_node_id)); @@ -229,8 +229,8 @@ class PeersConnection { std::cout << __FILE__ << ":" << __LINE__ << " - " << "Awaiting initial handshake completion..." << std::endl; while (true) { // Wait for the initial handshakes to complete... - LDK::CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ peers_1 = PeerManager_get_peer_node_ids(&net1); - LDK::CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ peers_2 = PeerManager_get_peer_node_ids(&net2); + LDK::CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ peers_1 = PeerManager_get_peer_node_ids(&net1); + LDK::CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ peers_2 = PeerManager_get_peer_node_ids(&net2); if (peers_1->datalen == 1 && peers_2->datalen == 1) { break; } std::this_thread::yield(); } @@ -247,8 +247,8 @@ class PeersConnection { std::cout << __FILE__ << ":" << __LINE__ << " - " << "Awaiting new connection handshake..." << std::endl; while (true) { // Wait for the new connection handshake... - LDK::CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ peers_1 = PeerManager_get_peer_node_ids(&net1); - LDK::CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ peers_2 = PeerManager_get_peer_node_ids(&net2); + LDK::CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ peers_1 = PeerManager_get_peer_node_ids(&net1); + LDK::CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ peers_2 = PeerManager_get_peer_node_ids(&net2); if (peers_1->datalen == 1 && peers_2->datalen == 1) { break; } std::this_thread::yield(); } @@ -259,8 +259,8 @@ class PeersConnection { while (true) { PeerManager_disconnect_by_node_id(&net1, ChannelManager_get_our_node_id(&cm2)); // Wait for the peers to disconnect... - LDK::CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ peers_1 = PeerManager_get_peer_node_ids(&net1); - LDK::CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ peers_2 = PeerManager_get_peer_node_ids(&net2); + LDK::CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ peers_1 = PeerManager_get_peer_node_ids(&net1); + LDK::CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ peers_2 = PeerManager_get_peer_node_ids(&net2); if (peers_1->datalen == 0 && peers_2->datalen == 0) { break; } std::this_thread::yield(); } @@ -275,8 +275,8 @@ class PeersConnection { std::cout << __FILE__ << ":" << __LINE__ << " - " << "Awaiting initial handshake completion..." << std::endl; while (true) { // Wait for the initial handshakes to complete... - LDK::CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ peers_1 = PeerManager_get_peer_node_ids(&net1); - LDK::CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ peers_2 = PeerManager_get_peer_node_ids(&net2); + LDK::CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ peers_1 = PeerManager_get_peer_node_ids(&net1); + LDK::CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ peers_2 = PeerManager_get_peer_node_ids(&net2); if (peers_1->datalen == 1 && peers_2->datalen == 1) { break; } std::this_thread::yield(); } @@ -354,9 +354,9 @@ class PeersConnection { t2 = std::thread(&sock_read_data_thread, pipefds_1_to_2[0], &sock2, &net2); // Note that we have to bind the result to a C++ class to make sure it gets free'd - LDK::CResult_CVec_u8ZPeerHandleErrorZ con_res = PeerManager_new_outbound_connection(&net1, ChannelManager_get_our_node_id(&cm2), sock1, COption_NetAddressZ_none()); + LDK::CResult_CVec_u8ZPeerHandleErrorZ con_res = PeerManager_new_outbound_connection(&net1, ChannelManager_get_our_node_id(&cm2), sock1, COption_SocketAddressZ_none()); assert(con_res->result_ok); - LDK::CResult_NonePeerHandleErrorZ con_res2 = PeerManager_new_inbound_connection(&net2, sock2, COption_NetAddressZ_none()); + LDK::CResult_NonePeerHandleErrorZ con_res2 = PeerManager_new_inbound_connection(&net2, sock2, COption_SocketAddressZ_none()); assert(con_res2->result_ok); auto writelen = write(pipefds_1_to_2[1], con_res->contents.result->data, con_res->contents.result->datalen); @@ -365,8 +365,8 @@ class PeersConnection { std::cout << __FILE__ << ":" << __LINE__ << " - " << "Awaiting initial handshake completion..." << std::endl; while (true) { // Wait for the initial handshakes to complete... - LDK::CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ peers_1 = PeerManager_get_peer_node_ids(&net1); - LDK::CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ peers_2 = PeerManager_get_peer_node_ids(&net2); + LDK::CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ peers_1 = PeerManager_get_peer_node_ids(&net1); + LDK::CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ peers_2 = PeerManager_get_peer_node_ids(&net2); if (peers_1->datalen == 1 && peers_2->datalen ==1) { break; } std::this_thread::yield(); } @@ -654,7 +654,7 @@ int main() { PeersConnection conn(cm1, cm2, net1, net2); // Note that we have to bind the result to a C++ class to make sure it gets free'd - LDK::CResult__u832APIErrorZ res = ChannelManager_create_channel(&cm1, ChannelManager_get_our_node_id(&cm2), 40000, 1000, U128_new(user_id_1), UserConfig_default()); + LDK::CResult_ThirtyTwoBytesAPIErrorZ res = ChannelManager_create_channel(&cm1, ChannelManager_get_our_node_id(&cm2), 40000, 1000, U128_new(user_id_1), UserConfig_default()); assert(res->result_ok); PeerManager_process_events(&net1); @@ -848,17 +848,15 @@ int main() { { LDK::CVec_ChannelDetailsZ outbound_channels = ChannelManager_list_usable_channels(&cm1); - LDK::Score chan_scorer = LDKScore { - .this_arg = NULL, .channel_penalty_msat = get_chan_score, - .payment_path_failed = NULL, .payment_path_successful = NULL, .probe_failed = NULL, - .probe_successful = NULL, .write = NULL, .free = NULL, + LDK::ScoreLookUp chan_scorer = LDKScoreLookUp { + .this_arg = NULL, .channel_penalty_msat = get_chan_score, .free = NULL, }; LDK::Payee payee = Payee_clear(ChannelManager_get_our_node_id(&cm2), Bolt11Invoice_route_hints(invoice->contents.result), LDKBolt11InvoiceFeatures { .inner = NULL, .is_owned = false }, Bolt11Invoice_min_final_cltv_expiry_delta(invoice->contents.result)); - LDK::RouteParameters route_params = RouteParameters_new(PaymentParameters_new( - std::move(payee), COption_u64Z_none(), 0xffffffff, 1, 2, + LDK::RouteParameters route_params = RouteParameters_from_payment_params_and_value( + PaymentParameters_new(std::move(payee), COption_u64Z_none(), 0xffffffff, 1, 2, LDKCVec_u64Z { .data = NULL, .datalen = 0 }), 5000); random_bytes = entropy_source1.get_secure_random_bytes(); @@ -918,7 +916,7 @@ int main() { assert(!memcmp(queue.events[0]->payment_claimable.purpose.invoice_payment.payment_secret.data, Bolt11Invoice_payment_secret(invoice->contents.result), 32)); assert(queue.events[0]->payment_claimable.amount_msat == 5000); - assert(queue.events[0]->payment_claimable.purpose.invoice_payment.payment_preimage.tag == LDKCOption_PaymentPreimageZ_Some); + assert(queue.events[0]->payment_claimable.purpose.invoice_payment.payment_preimage.tag == LDKCOption_ThirtyTwoBytesZ_Some); memcpy(payment_preimage.data, queue.events[0]->payment_claimable.purpose.invoice_payment.payment_preimage.some.data, 32); ChannelManager_claim_funds(&cm2, payment_preimage); @@ -931,11 +929,6 @@ int main() { } PeerManager_process_events(&net2); // Wait until we've passed through a full set of monitor updates (ie new preimage + CS/RAA messages) - std::cout << __FILE__ << ":" << __LINE__ << " - " << "Awaiting 5 updated monitors..." << std::endl; - while (mons_updated != 5) { - std::this_thread::yield(); - } - std::cout << __FILE__ << ":" << __LINE__ << " - " << "5 monitors updated!" << std::endl; { EventQueue queue; LDKEventHandler handler = { .this_arg = &queue, .handle_event = handle_event, .free = NULL }; @@ -949,9 +942,14 @@ int main() { assert(queue.events[0]->tag == LDKEvent_PaymentSent); assert(!memcmp(queue.events[0]->payment_sent.payment_preimage.data, payment_preimage.data, 32)); assert(queue.events[1]->tag == LDKEvent_PaymentPathSuccessful); - assert(queue.events[1]->payment_path_successful.payment_hash.tag == LDKCOption_PaymentHashZ_Some); + assert(queue.events[1]->payment_path_successful.payment_hash.tag == LDKCOption_ThirtyTwoBytesZ_Some); assert(!memcmp(queue.events[1]->payment_path_successful.payment_hash.some.data, payment_hash.data, 32)); } + std::cout << __FILE__ << ":" << __LINE__ << " - " << "Awaiting 5 updated monitors..." << std::endl; + while (mons_updated != 5) { + std::this_thread::yield(); + } + std::cout << __FILE__ << ":" << __LINE__ << " - " << "5 monitors updated!" << std::endl; conn.stop(); @@ -984,8 +982,8 @@ int main() { }; LDK::ChannelManagerReadArgs cm1_args = ChannelManagerReadArgs_new(KeysManager_as_EntropySource(&keys1), KeysManager_as_NodeSigner(&keys1), KeysManager_as_SignerProvider(&keys1), fee_est, mon1, broadcast, router1, logger1, UserConfig_default(), std::move(mons_list1)); - LDK::CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ cm1_read = - C2Tuple_BlockHashChannelManagerZ_read(LDKu8slice { .data = cm1_ser->data, .datalen = cm1_ser -> datalen}, std::move(cm1_args)); + LDK::CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ cm1_read = + C2Tuple_ThirtyTwoBytesChannelManagerZ_read(LDKu8slice { .data = cm1_ser->data, .datalen = cm1_ser -> datalen}, std::move(cm1_args)); assert(cm1_read->result_ok); LDK::ChannelManager cm1(std::move(cm1_read->contents.result->b)); @@ -1010,8 +1008,8 @@ int main() { LDK::SignerProvider signer_provider2 = KeysManager_as_SignerProvider(&keys2); LDK::ChannelManagerReadArgs cm2_args = ChannelManagerReadArgs_new(KeysManager_as_EntropySource(&keys2), KeysManager_as_NodeSigner(&keys2), KeysManager_as_SignerProvider(&keys2), fee_est, mon2, broadcast, panic_router, logger2, UserConfig_default(), std::move(mons_list2)); - LDK::CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ cm2_read = - C2Tuple_BlockHashChannelManagerZ_read(LDKu8slice { .data = cm2_ser->data, .datalen = cm2_ser -> datalen}, std::move(cm2_args)); + LDK::CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ cm2_read = + C2Tuple_ThirtyTwoBytesChannelManagerZ_read(LDKu8slice { .data = cm2_ser->data, .datalen = cm2_ser -> datalen}, std::move(cm2_args)); assert(cm2_read->result_ok); LDK::ChannelManager cm2(std::move(cm2_read->contents.result->b)); @@ -1093,7 +1091,7 @@ int main() { }, 3600, COption_u16Z_none()); assert(invoice_res2->result_ok); const LDKBolt11Invoice *invoice2 = invoice_res2->contents.result; - LDK::CResult_PaymentIdPaymentErrorZ invoice_pay_res = pay_invoice(invoice2, Retry_attempts(0), &cm1); + LDK::CResult_ThirtyTwoBytesPaymentErrorZ invoice_pay_res = pay_invoice(invoice2, Retry_attempts(0), &cm1); assert(invoice_pay_res->result_ok); PeerManager_process_events(&net1); @@ -1128,7 +1126,7 @@ int main() { assert(!memcmp(event_data->purpose.invoice_payment.payment_secret.data, Bolt11Invoice_payment_secret(invoice2), 32)); assert(event_data->amount_msat == 10000); - assert(event_data->purpose.invoice_payment.payment_preimage.tag == LDKCOption_PaymentPreimageZ_Some); + assert(event_data->purpose.invoice_payment.payment_preimage.tag == LDKCOption_ThirtyTwoBytesZ_Some); ChannelManager_claim_funds(&cm2, event_data->purpose.invoice_payment.payment_preimage.some); queue2.events.clear(); diff --git a/lightning-c-bindings/include/ldk_rust_types.h b/lightning-c-bindings/include/ldk_rust_types.h index 5e75a71c..a8f431a8 100644 --- a/lightning-c-bindings/include/ldk_rust_types.h +++ b/lightning-c-bindings/include/ldk_rust_types.h @@ -57,8 +57,10 @@ struct nativeRouteHintHopOpaque; typedef struct nativeRouteHintHopOpaque LDKnativeRouteHintHop; struct nativeMultiThreadedLockableScoreOpaque; typedef struct nativeMultiThreadedLockableScoreOpaque LDKnativeMultiThreadedLockableScore; -struct nativeMultiThreadedScoreLockOpaque; -typedef struct nativeMultiThreadedScoreLockOpaque LDKnativeMultiThreadedScoreLock; +struct nativeMultiThreadedScoreLockReadOpaque; +typedef struct nativeMultiThreadedScoreLockReadOpaque LDKnativeMultiThreadedScoreLockRead; +struct nativeMultiThreadedScoreLockWriteOpaque; +typedef struct nativeMultiThreadedScoreLockWriteOpaque LDKnativeMultiThreadedScoreLockWrite; struct nativeChannelUsageOpaque; typedef struct nativeChannelUsageOpaque LDKnativeChannelUsage; struct nativeFixedPenaltyScorerOpaque; @@ -159,6 +161,8 @@ struct nativeChannelConfigUpdateOpaque; typedef struct nativeChannelConfigUpdateOpaque LDKnativeChannelConfigUpdate; struct nativeUserConfigOpaque; typedef struct nativeUserConfigOpaque LDKnativeUserConfig; +struct nativeTaggedHashOpaque; +typedef struct nativeTaggedHashOpaque LDKnativeTaggedHash; struct nativeChannelMonitorUpdateOpaque; typedef struct nativeChannelMonitorUpdateOpaque LDKnativeChannelMonitorUpdate; struct nativeHTLCUpdateOpaque; @@ -179,10 +183,14 @@ struct nativePeerManagerOpaque; typedef struct nativePeerManagerOpaque LDKnativePeerManager; struct nativeRapidGossipSyncOpaque; typedef struct nativeRapidGossipSyncOpaque LDKnativeRapidGossipSync; +struct nativeMonitorUpdatingPersisterOpaque; +typedef struct nativeMonitorUpdatingPersisterOpaque LDKnativeMonitorUpdatingPersister; struct nativeUnsignedInvoiceRequestOpaque; typedef struct nativeUnsignedInvoiceRequestOpaque LDKnativeUnsignedInvoiceRequest; struct nativeInvoiceRequestOpaque; typedef struct nativeInvoiceRequestOpaque LDKnativeInvoiceRequest; +struct nativeVerifiedInvoiceRequestOpaque; +typedef struct nativeVerifiedInvoiceRequestOpaque LDKnativeVerifiedInvoiceRequest; struct nativeInitOpaque; typedef struct nativeInitOpaque LDKnativeInit; struct nativeErrorMessageOpaque; @@ -315,8 +323,10 @@ struct nativeInvalidShutdownScriptOpaque; typedef struct nativeInvalidShutdownScriptOpaque LDKnativeInvalidShutdownScript; struct nativeBolt12ParseErrorOpaque; typedef struct nativeBolt12ParseErrorOpaque LDKnativeBolt12ParseError; -struct nativeFilesystemPersisterOpaque; -typedef struct nativeFilesystemPersisterOpaque LDKnativeFilesystemPersister; +struct nativePacketOpaque; +typedef struct nativePacketOpaque LDKnativePacket; +struct nativeClaimedHTLCOpaque; +typedef struct nativeClaimedHTLCOpaque LDKnativeClaimedHTLC; struct nativeBolt11InvoiceOpaque; typedef struct nativeBolt11InvoiceOpaque LDKnativeBolt11Invoice; struct nativeSignedRawBolt11InvoiceOpaque; @@ -353,6 +363,16 @@ struct nativeUntrustedStringOpaque; typedef struct nativeUntrustedStringOpaque LDKnativeUntrustedString; struct nativePrintableStringOpaque; typedef struct nativePrintableStringOpaque LDKnativePrintableString; +struct nativeForwardNodeOpaque; +typedef struct nativeForwardNodeOpaque LDKnativeForwardNode; +struct nativeForwardTlvsOpaque; +typedef struct nativeForwardTlvsOpaque LDKnativeForwardTlvs; +struct nativeReceiveTlvsOpaque; +typedef struct nativeReceiveTlvsOpaque LDKnativeReceiveTlvs; +struct nativePaymentRelayOpaque; +typedef struct nativePaymentRelayOpaque LDKnativePaymentRelay; +struct nativePaymentConstraintsOpaque; +typedef struct nativePaymentConstraintsOpaque LDKnativePaymentConstraints; struct nativeUtxoFutureOpaque; typedef struct nativeUtxoFutureOpaque LDKnativeUtxoFuture; struct nativeOnionMessengerOpaque; @@ -361,6 +381,8 @@ struct nativeDefaultMessageRouterOpaque; typedef struct nativeDefaultMessageRouterOpaque LDKnativeDefaultMessageRouter; struct nativeOnionMessagePathOpaque; typedef struct nativeOnionMessagePathOpaque LDKnativeOnionMessagePath; +struct nativeFilesystemStoreOpaque; +typedef struct nativeFilesystemStoreOpaque LDKnativeFilesystemStore; struct nativeBlindedPathOpaque; typedef struct nativeBlindedPathOpaque LDKnativeBlindedPath; struct nativeBlindedHopOpaque; diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index bf4f3ddb..7c9183c3 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -1,7 +1,7 @@ #ifndef LDK_C_BINDINGS_H #define LDK_C_BINDINGS_H -/* Generated with cbindgen:0.24.3 */ +/* Generated with cbindgen:0.24.5 */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ @@ -196,6 +196,25 @@ typedef enum LDKCOption_NoneZ { /** * An enum representing the status of a channel monitor update persistence. + * + * These are generally used as the return value for an implementation of [`Persist`] which is used + * as the storage layer for a [`ChainMonitor`]. See the docs on [`Persist`] for a high-level + * explanation of how to handle different cases. + * + * While `UnrecoverableError` is provided as a failure variant, it is not truly \"handled\" on the + * calling side, and generally results in an immediate panic. For those who prefer to avoid + * panics, `InProgress` can be used and you can retry the update operation in the background or + * shut down cleanly. + * + * Note that channels should generally *not* be force-closed after a persistence failure. + * Force-closing with the latest [`ChannelMonitorUpdate`] applied may result in a transaction + * being broadcast which can only be spent by the latest [`ChannelMonitor`]! Thus, if the + * latest [`ChannelMonitor`] is not durably persisted anywhere and exists only in memory, naively + * calling [`ChannelManager::force_close_broadcasting_latest_txn`] *may result in loss of funds*! + * + * [`Persist`]: chainmonitor::Persist + * [`ChainMonitor`]: chainmonitor::ChainMonitor + * [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn */ typedef enum LDKChannelMonitorUpdateStatus { /** @@ -207,17 +226,13 @@ typedef enum LDKChannelMonitorUpdateStatus { */ LDKChannelMonitorUpdateStatus_Completed, /** - * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of - * our state failed, but is expected to succeed at some point in the future). - * - * Such a failure will \"freeze\" a channel, preventing us from revoking old states or - * submitting new commitment transactions to the counterparty. Once the update(s) which failed - * have been successfully applied, a [`MonitorEvent::Completed`] can be used to restore the - * channel to an operational state. + * Indicates that the update will happen asynchronously in the background or that a transient + * failure occurred which is being retried in the background and will eventually complete. * - * Note that a given [`ChannelManager`] will *never* re-generate a [`ChannelMonitorUpdate`]. - * If you return this error you must ensure that it is written to disk safely before writing - * the latest [`ChannelManager`] state, or you should return [`PermanentFailure`] instead. + * This will \"freeze\" a channel, preventing us from revoking old states or submitting a new + * commitment transaction to the counterparty. Once the update(s) which are `InProgress` have + * been completed, a [`MonitorEvent::Completed`] can be used to restore the channel to an + * operational state. * * Even when a channel has been \"frozen\", updates to the [`ChannelMonitor`] can continue to * occur (e.g. if an inbound HTLC which we forwarded was claimed upstream, resulting in us @@ -227,56 +242,31 @@ typedef enum LDKChannelMonitorUpdateStatus { * until a [`MonitorEvent::Completed`] is provided, even if you return no error on a later * monitor update for the same channel. * - * For deployments where a copy of ChannelMonitors and other local state are backed up in a - * remote location (with local copies persisted immediately), it is anticipated that all + * For deployments where a copy of [`ChannelMonitor`]s and other local state are backed up in + * a remote location (with local copies persisted immediately), it is anticipated that all * updates will return [`InProgress`] until the remote copies could be updated. * - * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure + * Note that while fully asynchronous persistence of [`ChannelMonitor`] data is generally + * reliable, this feature is considered beta, and a handful of edge-cases remain. Until the + * remaining cases are fixed, in rare cases, *using this feature may lead to funds loss*. + * * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ LDKChannelMonitorUpdateStatus_InProgress, /** - * Used to indicate no further channel monitor updates will be allowed (likely a disk failure - * or a remote copy of this [`ChannelMonitor`] is no longer reachable and thus not updatable). - * - * When this is returned, [`ChannelManager`] will force-close the channel but *not* broadcast - * our current commitment transaction. This avoids a dangerous case where a local disk failure - * (e.g. the Linux-default remounting of the disk as read-only) causes [`PermanentFailure`]s - * for all monitor updates. If we were to broadcast our latest commitment transaction and then - * restart, we could end up reading a previous [`ChannelMonitor`] and [`ChannelManager`], - * revoking our now-broadcasted state before seeing it confirm and losing all our funds. - * - * Note that this is somewhat of a tradeoff - if the disk is really gone and we may have lost - * the data permanently, we really should broadcast immediately. If the data can be recovered - * with manual intervention, we'd rather close the channel, rejecting future updates to it, - * and broadcast the latest state only if we have HTLCs to claim which are timing out (which - * we do as long as blocks are connected). - * - * In order to broadcast the latest local commitment transaction, you'll need to call - * [`ChannelMonitor::get_latest_holder_commitment_txn`] and broadcast the resulting - * transactions once you've safely ensured no further channel updates can be generated by your - * [`ChannelManager`]. - * - * Note that at least one final [`ChannelMonitorUpdate`] may still be provided, which must - * still be processed by a running [`ChannelMonitor`]. This final update will mark the - * [`ChannelMonitor`] as finalized, ensuring no further updates (e.g. revocation of the latest - * commitment transaction) are allowed. - * - * Note that even if you return a [`PermanentFailure`] due to unavailability of secondary - * [`ChannelMonitor`] copies, you should still make an attempt to store the update where - * possible to ensure you can claim HTLC outputs on the latest commitment transaction - * broadcasted later. - * - * In case of distributed watchtowers deployment, the new version must be written to disk, as - * state may have been stored but rejected due to a block forcing a commitment broadcast. This - * storage is used to claim outputs of rejected state confirmed onchain by another watchtower, - * lagging behind on block processing. - * - * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * Indicates that an update has failed and will not complete at any point in the future. + * + * Currently returning this variant will cause LDK to immediately panic to encourage immediate + * shutdown. In the future this may be updated to disconnect peers and refuse to continue + * normal operation without a panic. + * + * Applications which wish to perform an orderly shutdown after failure should consider + * returning [`InProgress`] instead and simply shut down without ever marking the update + * complete. + * + * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress */ - LDKChannelMonitorUpdateStatus_PermanentFailure, + LDKChannelMonitorUpdateStatus_UnrecoverableError, /** * Must be last for serialization purposes */ @@ -423,36 +413,6 @@ typedef enum LDKCurrency { LDKCurrency_Sentinel, } LDKCurrency; -/** - * This enum is used to specify which error data to send to peers when failing back an HTLC - * using [`ChannelManager::fail_htlc_backwards_with_reason`]. - * - * For more info on failure codes, see . - */ -typedef enum LDKFailureCode { - /** - * We had a temporary error processing the payment. Useful if no other error codes fit - * and you want to indicate that the payer may want to retry. - */ - LDKFailureCode_TemporaryNodeFailure, - /** - * We have a required feature which was not in this onion. For example, you may require - * some additional metadata that was not provided with this payment. - */ - LDKFailureCode_RequiredNodeFeatureMissing, - /** - * You may wish to use this when a `payment_preimage` is unknown, or the CLTV expiry of - * the HTLC is too close to the current block height for safe handling. - * Using this failure code in [`ChannelManager::fail_htlc_backwards_with_reason`] is - * equivalent to calling [`ChannelManager::fail_htlc_backwards`]. - */ - LDKFailureCode_IncorrectOrUnknownPaymentDetails, - /** - * Must be last for serialization purposes - */ - LDKFailureCode_Sentinel, -} LDKFailureCode; - /** * Describes the type of HTLC claim as determined by analyzing the witness. */ @@ -755,6 +715,32 @@ typedef enum LDKSiPrefix { LDKSiPrefix_Sentinel, } LDKSiPrefix; +/** + * [`SocketAddress`] error variants + */ +typedef enum LDKSocketAddressParseError { + /** + * Socket address (IPv4/IPv6) parsing error + */ + LDKSocketAddressParseError_SocketAddrParse, + /** + * Invalid input format + */ + LDKSocketAddressParseError_InvalidInput, + /** + * Invalid port + */ + LDKSocketAddressParseError_InvalidPort, + /** + * Invalid onion v3 address + */ + LDKSocketAddressParseError_InvalidOnionV3, + /** + * Must be last for serialization purposes + */ + LDKSocketAddressParseError_Sentinel, +} LDKSocketAddressParseError; + /** * An error when accessing the chain via [`UtxoLookup`]. */ @@ -1002,29 +988,29 @@ typedef struct LDKTxOut { /** * An enum which can either contain a u64 or not */ -typedef enum LDKCOption_DurationZ_Tag { +typedef enum LDKCOption_u64Z_Tag { /** - * When we're in this state, this COption_DurationZ contains a u64 + * When we're in this state, this COption_u64Z contains a u64 */ - LDKCOption_DurationZ_Some, + LDKCOption_u64Z_Some, /** - * When we're in this state, this COption_DurationZ contains nothing + * When we're in this state, this COption_u64Z contains nothing */ - LDKCOption_DurationZ_None, + LDKCOption_u64Z_None, /** * Must be last for serialization purposes */ - LDKCOption_DurationZ_Sentinel, -} LDKCOption_DurationZ_Tag; + LDKCOption_u64Z_Sentinel, +} LDKCOption_u64Z_Tag; -typedef struct LDKCOption_DurationZ { - LDKCOption_DurationZ_Tag tag; +typedef struct LDKCOption_u64Z { + LDKCOption_u64Z_Tag tag; union { struct { uint64_t some; }; }; -} LDKCOption_DurationZ; +} LDKCOption_u64Z; @@ -1063,33 +1049,6 @@ typedef struct LDKCVec_BlindedPathZ { uintptr_t datalen; } LDKCVec_BlindedPathZ; -/** - * An enum which can either contain a u64 or not - */ -typedef enum LDKCOption_u64Z_Tag { - /** - * When we're in this state, this COption_u64Z contains a u64 - */ - LDKCOption_u64Z_Some, - /** - * When we're in this state, this COption_u64Z contains nothing - */ - LDKCOption_u64Z_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_u64Z_Sentinel, -} LDKCOption_u64Z_Tag; - -typedef struct LDKCOption_u64Z { - LDKCOption_u64Z_Tag tag; - union { - struct { - uint64_t some; - }; - }; -} LDKCOption_u64Z; - /** @@ -1170,6 +1129,129 @@ typedef struct LDKCResult_RefundBolt12ParseErrorZ { bool result_ok; } LDKCResult_RefundBolt12ParseErrorZ; +/** + * Strategies available to retry payment path failures. + */ +typedef enum LDKRetry_Tag { + /** + * Max number of attempts to retry payment. + * + * Each attempt may be multiple HTLCs along multiple paths if the router decides to split up a + * retry, and may retry multiple failed HTLCs at once if they failed around the same time and + * were retried along a route from a single call to [`Router::find_route_with_id`]. + */ + LDKRetry_Attempts, + /** + * Time elapsed before abandoning retries for a payment. At least one attempt at payment is made; + * see [`PaymentParameters::expiry_time`] to avoid any attempt at payment after a specific time. + * + * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time + */ + LDKRetry_Timeout, + /** + * Must be last for serialization purposes + */ + LDKRetry_Sentinel, +} LDKRetry_Tag; + +typedef struct MUST_USE_STRUCT LDKRetry { + LDKRetry_Tag tag; + union { + struct { + uint32_t attempts; + }; + struct { + uint64_t timeout; + }; + }; +} LDKRetry; + +/** + * An error in decoding a message or struct. + */ +typedef enum LDKDecodeError_Tag { + /** + * A version byte specified something we don't know how to handle. + * + * Includes unknown realm byte in an onion hop data packet. + */ + LDKDecodeError_UnknownVersion, + /** + * Unknown feature mandating we fail to parse message (e.g., TLV with an even, unknown type) + */ + LDKDecodeError_UnknownRequiredFeature, + /** + * Value was invalid. + * + * For example, a byte which was supposed to be a bool was something other than a 0 + * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was + * syntactically incorrect, etc. + */ + LDKDecodeError_InvalidValue, + /** + * The buffer to be read was too short. + */ + LDKDecodeError_ShortRead, + /** + * A length descriptor in the packet didn't describe the later data correctly. + */ + LDKDecodeError_BadLengthDescriptor, + /** + * Error from [`std::io`]. + */ + LDKDecodeError_Io, + /** + * The message included zlib-compressed values, which we don't support. + */ + LDKDecodeError_UnsupportedCompression, + /** + * Must be last for serialization purposes + */ + LDKDecodeError_Sentinel, +} LDKDecodeError_Tag; + +typedef struct MUST_USE_STRUCT LDKDecodeError { + LDKDecodeError_Tag tag; + union { + struct { + enum LDKIOError io; + }; + }; +} LDKDecodeError; + +/** + * The contents of CResult_RetryDecodeErrorZ + */ +typedef union LDKCResult_RetryDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRetry *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_RetryDecodeErrorZPtr; + +/** + * A CResult_RetryDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::outbound_payment::Retry on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RetryDecodeErrorZ { + /** + * The contents of this CResult_RetryDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RetryDecodeErrorZPtr contents; + /** + * Whether this CResult_RetryDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RetryDecodeErrorZ; + /** @@ -1364,29 +1446,29 @@ typedef struct LDKCVec_APIErrorZ { /** * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not */ -typedef enum LDKCOption_PaymentSecretZ_Tag { +typedef enum LDKCOption_ThirtyTwoBytesZ_Tag { /** - * When we're in this state, this COption_PaymentSecretZ contains a crate::c_types::ThirtyTwoBytes + * When we're in this state, this COption_ThirtyTwoBytesZ contains a crate::c_types::ThirtyTwoBytes */ - LDKCOption_PaymentSecretZ_Some, + LDKCOption_ThirtyTwoBytesZ_Some, /** - * When we're in this state, this COption_PaymentSecretZ contains nothing + * When we're in this state, this COption_ThirtyTwoBytesZ contains nothing */ - LDKCOption_PaymentSecretZ_None, + LDKCOption_ThirtyTwoBytesZ_None, /** * Must be last for serialization purposes */ - LDKCOption_PaymentSecretZ_Sentinel, -} LDKCOption_PaymentSecretZ_Tag; + LDKCOption_ThirtyTwoBytesZ_Sentinel, +} LDKCOption_ThirtyTwoBytesZ_Tag; -typedef struct LDKCOption_PaymentSecretZ { - LDKCOption_PaymentSecretZ_Tag tag; +typedef struct LDKCOption_ThirtyTwoBytesZ { + LDKCOption_ThirtyTwoBytesZ_Tag tag; union { struct { struct LDKThirtyTwoBytes some; }; }; -} LDKCOption_PaymentSecretZ; +} LDKCOption_ThirtyTwoBytesZ; /** * An enum which can either contain a crate::c_types::derived::CVec_u8Z or not @@ -1439,90 +1521,174 @@ typedef struct MUST_USE_STRUCT LDKRecipientOnionFields { } LDKRecipientOnionFields; /** - * An error in decoding a message or struct. + * The contents of CResult_RecipientOnionFieldsDecodeErrorZ */ -typedef enum LDKDecodeError_Tag { +typedef union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr { /** - * A version byte specified something we don't know how to handle. - * - * Includes unknown realm byte in an onion hop data packet. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKDecodeError_UnknownVersion, + struct LDKRecipientOnionFields *result; /** - * Unknown feature mandating we fail to parse message (e.g., TLV with an even, unknown type) + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKDecodeError_UnknownRequiredFeature, + struct LDKDecodeError *err; +} LDKCResult_RecipientOnionFieldsDecodeErrorZPtr; + +/** + * A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RecipientOnionFieldsDecodeErrorZ { /** - * Value was invalid. - * - * For example, a byte which was supposed to be a bool was something other than a 0 - * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was - * syntactically incorrect, etc. + * The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKDecodeError_InvalidValue, + union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr contents; /** - * The buffer to be read was too short. + * Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state. */ - LDKDecodeError_ShortRead, + bool result_ok; +} LDKCResult_RecipientOnionFieldsDecodeErrorZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_u64CVec_u8ZZ { /** - * A length descriptor in the packet didn't describe the later data correctly. + * The element at position 0 */ - LDKDecodeError_BadLengthDescriptor, + uint64_t a; /** - * Error from [`std::io`]. + * The element at position 1 */ - LDKDecodeError_Io, + struct LDKCVec_u8Z b; +} LDKC2Tuple_u64CVec_u8ZZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u64CVec_u8ZZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_u64CVec_u8ZZZ { /** - * The message included zlib-compressed values, which we don't support. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKDecodeError_UnsupportedCompression, + struct LDKC2Tuple_u64CVec_u8ZZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_u64CVec_u8ZZZ; + +/** + * The contents of CResult_RecipientOnionFieldsNoneZ + */ +typedef union LDKCResult_RecipientOnionFieldsNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRecipientOnionFields *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_RecipientOnionFieldsNoneZPtr; + +/** + * A CResult_RecipientOnionFieldsNoneZ represents the result of a fallible operation, + * containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RecipientOnionFieldsNoneZ { + /** + * The contents of this CResult_RecipientOnionFieldsNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RecipientOnionFieldsNoneZPtr contents; + /** + * Whether this CResult_RecipientOnionFieldsNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_RecipientOnionFieldsNoneZ; + +/** + * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_ThirtyTwoBytesZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKThirtyTwoBytes *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_ThirtyTwoBytesZ; + +/** + * An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not + */ +typedef enum LDKCOption_CVec_ThirtyTwoBytesZZ_Tag { + /** + * When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ + */ + LDKCOption_CVec_ThirtyTwoBytesZZ_Some, + /** + * When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing + */ + LDKCOption_CVec_ThirtyTwoBytesZZ_None, /** * Must be last for serialization purposes */ - LDKDecodeError_Sentinel, -} LDKDecodeError_Tag; + LDKCOption_CVec_ThirtyTwoBytesZZ_Sentinel, +} LDKCOption_CVec_ThirtyTwoBytesZZ_Tag; -typedef struct MUST_USE_STRUCT LDKDecodeError { - LDKDecodeError_Tag tag; +typedef struct LDKCOption_CVec_ThirtyTwoBytesZZ { + LDKCOption_CVec_ThirtyTwoBytesZZ_Tag tag; union { struct { - enum LDKIOError io; + struct LDKCVec_ThirtyTwoBytesZ some; }; }; -} LDKDecodeError; +} LDKCOption_CVec_ThirtyTwoBytesZZ; /** - * The contents of CResult_RecipientOnionFieldsDecodeErrorZ + * The contents of CResult_ThirtyTwoBytesNoneZ */ -typedef union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr { +typedef union LDKCResult_ThirtyTwoBytesNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKRecipientOnionFields *result; + struct LDKThirtyTwoBytes *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - struct LDKDecodeError *err; -} LDKCResult_RecipientOnionFieldsDecodeErrorZPtr; + void *err; +} LDKCResult_ThirtyTwoBytesNoneZPtr; /** - * A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_ThirtyTwoBytesNoneZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_RecipientOnionFieldsDecodeErrorZ { +typedef struct LDKCResult_ThirtyTwoBytesNoneZ { /** - * The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either + * The contents of this CResult_ThirtyTwoBytesNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr contents; + union LDKCResult_ThirtyTwoBytesNoneZPtr contents; /** - * Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state. + * Whether this CResult_ThirtyTwoBytesNoneZ represents a success state. */ bool result_ok; -} LDKCResult_RecipientOnionFieldsDecodeErrorZ; +} LDKCResult_ThirtyTwoBytesNoneZ; @@ -1775,15 +1941,23 @@ typedef enum LDKSpendableOutputDescriptor_Tag { */ LDKSpendableOutputDescriptor_DelayedPaymentOutput, /** - * An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key - * which corresponds to the `payment_point` in [`ChannelSigner::pubkeys`]). The witness - * in the spending input is, thus, simply: + * An output spendable exclusively by our payment key (i.e., the private key that corresponds + * to the `payment_point` in [`ChannelSigner::pubkeys`]). The output type depends on the + * channel type negotiated. + * + * On an anchor outputs channel, the witness in the spending input is: + * ```bitcoin + * + * ``` + * + * Otherwise, it is: * ```bitcoin * * ``` * * These are generally the result of our counterparty having broadcast the current state, - * allowing us to claim the non-HTLC-encumbered outputs immediately. + * allowing us to claim the non-HTLC-encumbered outputs immediately, or after one confirmation + * in the case of anchor outputs channels. */ LDKSpendableOutputDescriptor_StaticPaymentOutput, /** @@ -1884,34 +2058,34 @@ typedef struct LDKCVec_TxOutZ { /** * An enum which can either contain a u32 or not */ -typedef enum LDKCOption_PackedLockTimeZ_Tag { +typedef enum LDKCOption_u32Z_Tag { /** - * When we're in this state, this COption_PackedLockTimeZ contains a u32 + * When we're in this state, this COption_u32Z contains a u32 */ - LDKCOption_PackedLockTimeZ_Some, + LDKCOption_u32Z_Some, /** - * When we're in this state, this COption_PackedLockTimeZ contains nothing + * When we're in this state, this COption_u32Z contains nothing */ - LDKCOption_PackedLockTimeZ_None, + LDKCOption_u32Z_None, /** * Must be last for serialization purposes */ - LDKCOption_PackedLockTimeZ_Sentinel, -} LDKCOption_PackedLockTimeZ_Tag; + LDKCOption_u32Z_Sentinel, +} LDKCOption_u32Z_Tag; -typedef struct LDKCOption_PackedLockTimeZ { - LDKCOption_PackedLockTimeZ_Tag tag; +typedef struct LDKCOption_u32Z { + LDKCOption_u32Z_Tag tag; union { struct { uint32_t some; }; }; -} LDKCOption_PackedLockTimeZ; +} LDKCOption_u32Z; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_PartiallySignedTransactionusizeZ { +typedef struct LDKC2Tuple_CVec_u8ZusizeZ { /** * The element at position 0 */ @@ -1920,55 +2094,39 @@ typedef struct LDKC2Tuple_PartiallySignedTransactionusizeZ { * The element at position 1 */ uintptr_t b; -} LDKC2Tuple_PartiallySignedTransactionusizeZ; +} LDKC2Tuple_CVec_u8ZusizeZ; /** - * The contents of CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ + * The contents of CResult_C2Tuple_CVec_u8ZusizeZNoneZ */ -typedef union LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr { +typedef union LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_PartiallySignedTransactionusizeZ *result; + struct LDKC2Tuple_CVec_u8ZusizeZ *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr; +} LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZPtr; /** - * A CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ on success and a () on failure. + * A CResult_C2Tuple_CVec_u8ZusizeZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { +typedef struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ { /** - * The contents of this CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ, accessible via either + * The contents of this CResult_C2Tuple_CVec_u8ZusizeZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr contents; + union LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZPtr contents; /** - * Whether this CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ represents a success state. + * Whether this CResult_C2Tuple_CVec_u8ZusizeZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ; - -/** - * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_PaymentPreimageZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKThirtyTwoBytes *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_PaymentPreimageZ; +} LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ; /** * The contents of CResult_NoneNoneZ @@ -2002,108 +2160,108 @@ typedef struct LDKCResult_NoneNoneZ { } LDKCResult_NoneNoneZ; /** - * Represents a secp256k1 signature serialized as two 32-byte numbers + * Represents a secp256k1 ECDSA signature serialized as two 32-byte numbers */ -typedef struct LDKSignature { +typedef struct LDKECDSASignature { /** * The bytes of the signature in "compact" form */ uint8_t compact_form[64]; -} LDKSignature; +} LDKECDSASignature; /** - * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size. + * A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_SignatureZ { +typedef struct LDKCVec_ECDSASignatureZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKSignature *data; + struct LDKECDSASignature *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_SignatureZ; +} LDKCVec_ECDSASignatureZ; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ { +typedef struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { /** * The element at position 0 */ - struct LDKSignature a; + struct LDKECDSASignature a; /** * The element at position 1 */ - struct LDKCVec_SignatureZ b; -} LDKC2Tuple_SignatureCVec_SignatureZZ; + struct LDKCVec_ECDSASignatureZ b; +} LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ; /** - * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ + * The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ */ -typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { +typedef union LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_SignatureCVec_SignatureZZ *result; + struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr; +} LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr; /** - * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure. + * A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { +typedef struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { /** - * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either + * The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents; + union LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr contents; /** - * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state. + * Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ; +} LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ; /** - * The contents of CResult_SignatureNoneZ + * The contents of CResult_ECDSASignatureNoneZ */ -typedef union LDKCResult_SignatureNoneZPtr { +typedef union LDKCResult_ECDSASignatureNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKSignature *result; + struct LDKECDSASignature *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_SignatureNoneZPtr; +} LDKCResult_ECDSASignatureNoneZPtr; /** - * A CResult_SignatureNoneZ represents the result of a fallible operation, - * containing a crate::c_types::Signature on success and a () on failure. + * A CResult_ECDSASignatureNoneZ represents the result of a fallible operation, + * containing a crate::c_types::ECDSASignature on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_SignatureNoneZ { +typedef struct LDKCResult_ECDSASignatureNoneZ { /** - * The contents of this CResult_SignatureNoneZ, accessible via either + * The contents of this CResult_ECDSASignatureNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_SignatureNoneZPtr contents; + union LDKCResult_ECDSASignatureNoneZPtr contents; /** - * Whether this CResult_SignatureNoneZ represents a success state. + * Whether this CResult_ECDSASignatureNoneZ represents a success state. */ bool result_ok; -} LDKCResult_SignatureNoneZ; +} LDKCResult_ECDSASignatureNoneZ; /** * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array. @@ -2150,61 +2308,29 @@ typedef struct LDKCResult_PublicKeyNoneZ { /** * An enum which can either contain a crate::c_types::BigEndianScalar or not */ -typedef enum LDKCOption_ScalarZ_Tag { +typedef enum LDKCOption_BigEndianScalarZ_Tag { /** - * When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar + * When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar */ - LDKCOption_ScalarZ_Some, + LDKCOption_BigEndianScalarZ_Some, /** - * When we're in this state, this COption_ScalarZ contains nothing + * When we're in this state, this COption_BigEndianScalarZ contains nothing */ - LDKCOption_ScalarZ_None, + LDKCOption_BigEndianScalarZ_None, /** * Must be last for serialization purposes */ - LDKCOption_ScalarZ_Sentinel, -} LDKCOption_ScalarZ_Tag; + LDKCOption_BigEndianScalarZ_Sentinel, +} LDKCOption_BigEndianScalarZ_Tag; -typedef struct LDKCOption_ScalarZ { - LDKCOption_ScalarZ_Tag tag; +typedef struct LDKCOption_BigEndianScalarZ { + LDKCOption_BigEndianScalarZ_Tag tag; union { struct { struct LDKBigEndianScalar some; }; }; -} LDKCOption_ScalarZ; - -/** - * The contents of CResult_SharedSecretNoneZ - */ -typedef union LDKCResult_SharedSecretNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKThirtyTwoBytes *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_SharedSecretNoneZPtr; - -/** - * A CResult_SharedSecretNoneZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_SharedSecretNoneZ { - /** - * The contents of this CResult_SharedSecretNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_SharedSecretNoneZPtr contents; - /** - * Whether this CResult_SharedSecretNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_SharedSecretNoneZ; +} LDKCOption_BigEndianScalarZ; /** * Integer in the range `0..32` @@ -2273,6 +2399,48 @@ typedef struct LDKCResult_RecoverableSignatureNoneZ { bool result_ok; } LDKCResult_RecoverableSignatureNoneZ; +/** + * Represents a secp256k1 Schnorr signature serialized as two 32-byte numbers + */ +typedef struct LDKSchnorrSignature { + /** + * The bytes of the signature as two 32-byte numbers + */ + uint8_t compact_form[64]; +} LDKSchnorrSignature; + +/** + * The contents of CResult_SchnorrSignatureNoneZ + */ +typedef union LDKCResult_SchnorrSignatureNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKSchnorrSignature *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_SchnorrSignatureNoneZPtr; + +/** + * A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation, + * containing a crate::c_types::SchnorrSignature on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SchnorrSignatureNoneZ { + /** + * The contents of this CResult_SchnorrSignatureNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_SchnorrSignatureNoneZPtr contents; + /** + * Whether this CResult_SchnorrSignatureNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_SchnorrSignatureNoneZ; + /** @@ -2492,7 +2660,7 @@ typedef struct LDKChannelSigner { * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. */ - struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages); + struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_ThirtyTwoBytesZ preimages); /** * Returns the holder's channel public keys and basepoints. */ @@ -2558,7 +2726,7 @@ typedef struct LDKEcdsaChannelSigner { * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. */ - struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages); + struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ preimages); /** * Validate the counterparty's revocation. * @@ -2583,7 +2751,7 @@ typedef struct LDKEcdsaChannelSigner { * * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ - struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); + struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); /** * Create a signature for the given input in a transaction spending an HTLC transaction output * or a commitment transaction `to_local` output when our counterparty broadcasts an old state. @@ -2600,7 +2768,7 @@ typedef struct LDKEcdsaChannelSigner { * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do * so). */ - struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]); + struct LDKCResult_ECDSASignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]); /** * Create a signature for the given input in a transaction spending a commitment transaction * HTLC output when our counterparty broadcasts an old state. @@ -2621,7 +2789,7 @@ typedef struct LDKEcdsaChannelSigner { * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script * (which is committed to in the BIP 143 signatures). */ - struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_htlc)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); + struct LDKCResult_ECDSASignatureNoneZ (*sign_justice_revoked_htlc)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** * Computes the signature for a commitment transaction's HTLC output used as an input within * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned @@ -2631,7 +2799,7 @@ typedef struct LDKEcdsaChannelSigner { * * [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All */ - struct LDKCResult_SignatureNoneZ (*sign_holder_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor); + struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor); /** * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment * transaction, either offered or received. @@ -2651,19 +2819,19 @@ typedef struct LDKEcdsaChannelSigner { * channel state keys, which are then included in the witness script and committed to in the * BIP 143 signature. */ - struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); + struct LDKCResult_ECDSASignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** * Create a signature for a (proposed) closing transaction. * * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have * chosen to forgo their output as dust. */ - struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx); + struct LDKCResult_ECDSASignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx); /** * Computes the signature for a commitment transaction's anchor output used as an * input within `anchor_tx`, which spends the commitment transaction, at index `input`. */ - struct LDKCResult_SignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input); + struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input); /** * Signs a channel announcement message with our funding key proving it comes from one of the * channel participants. @@ -2675,7 +2843,7 @@ typedef struct LDKEcdsaChannelSigner { * our counterparty may (though likely will not) close the channel on us for violating the * protocol. */ - struct LDKCResult_SignatureNoneZ (*sign_channel_announcement_with_funding_key)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); + struct LDKCResult_ECDSASignatureNoneZ (*sign_channel_announcement_with_funding_key)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); /** * Implementation of ChannelSigner for this object. */ @@ -2710,6 +2878,12 @@ typedef struct LDKWriteableEcdsaChannelSigner { * Serialize the object into a byte array */ struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Called, if set, after this WriteableEcdsaChannelSigner has been cloned into a duplicate object. + * The new WriteableEcdsaChannelSigner is provided, and should be mutated as needed to perform a + * deep copy of the object pointed to by this_arg or avoid any double-freeing. + */ + void (*cloned)(struct LDKWriteableEcdsaChannelSigner *NONNULL_PTR new_WriteableEcdsaChannelSigner); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -2751,9 +2925,9 @@ typedef struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ { } LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ; /** - * The contents of CResult_ScriptNoneZ + * The contents of CResult_CVec_u8ZNoneZ */ -typedef union LDKCResult_ScriptNoneZPtr { +typedef union LDKCResult_CVec_u8ZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -2763,24 +2937,24 @@ typedef union LDKCResult_ScriptNoneZPtr { * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_ScriptNoneZPtr; +} LDKCResult_CVec_u8ZNoneZPtr; /** - * A CResult_ScriptNoneZ represents the result of a fallible operation, + * A CResult_CVec_u8ZNoneZ represents the result of a fallible operation, * containing a crate::c_types::derived::CVec_u8Z on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ScriptNoneZ { +typedef struct LDKCResult_CVec_u8ZNoneZ { /** - * The contents of this CResult_ScriptNoneZ, accessible via either + * The contents of this CResult_CVec_u8ZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ScriptNoneZPtr contents; + union LDKCResult_CVec_u8ZNoneZPtr contents; /** - * Whether this CResult_ScriptNoneZ represents a success state. + * Whether this CResult_CVec_u8ZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_ScriptNoneZ; +} LDKCResult_CVec_u8ZNoneZ; /** * The contents of CResult_ShutdownScriptNoneZ @@ -2814,6 +2988,60 @@ typedef struct LDKCResult_ShutdownScriptNoneZ { bool result_ok; } LDKCResult_ShutdownScriptNoneZ; +/** + * An enum which can either contain a u16 or not + */ +typedef enum LDKCOption_u16Z_Tag { + /** + * When we're in this state, this COption_u16Z contains a u16 + */ + LDKCOption_u16Z_Some, + /** + * When we're in this state, this COption_u16Z contains nothing + */ + LDKCOption_u16Z_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_u16Z_Sentinel, +} LDKCOption_u16Z_Tag; + +typedef struct LDKCOption_u16Z { + LDKCOption_u16Z_Tag tag; + union { + struct { + uint16_t some; + }; + }; +} LDKCOption_u16Z; + +/** + * An enum which can either contain a bool or not + */ +typedef enum LDKCOption_boolZ_Tag { + /** + * When we're in this state, this COption_boolZ contains a bool + */ + LDKCOption_boolZ_Some, + /** + * When we're in this state, this COption_boolZ contains nothing + */ + LDKCOption_boolZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_boolZ_Sentinel, +} LDKCOption_boolZ_Tag; + +typedef struct LDKCOption_boolZ { + LDKCOption_boolZ_Tag tag; + union { + struct { + bool some; + }; + }; +} LDKCOption_boolZ; + /** * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size. * This corresponds to std::vector in C++ @@ -2918,38 +3146,6 @@ typedef struct LDKCResult_InMemorySignerDecodeErrorZ { bool result_ok; } LDKCResult_InMemorySignerDecodeErrorZ; -/** - * The contents of CResult_PartiallySignedTransactionNoneZ - */ -typedef union LDKCResult_PartiallySignedTransactionNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKCVec_u8Z *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_PartiallySignedTransactionNoneZPtr; - -/** - * A CResult_PartiallySignedTransactionNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_u8Z on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_PartiallySignedTransactionNoneZ { - /** - * The contents of this CResult_PartiallySignedTransactionNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_PartiallySignedTransactionNoneZPtr contents; - /** - * Whether this CResult_PartiallySignedTransactionNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_PartiallySignedTransactionNoneZ; - /** * The contents of CResult_TransactionNoneZ */ @@ -3005,7 +3201,7 @@ typedef struct MUST_USE_STRUCT LDKNodeId { /** - * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`]. + * Proposed use of a channel passed as a parameter to [`ScoreLookUp::channel_penalty_msat`]. */ typedef struct MUST_USE_STRUCT LDKChannelUsage { /** @@ -3048,6 +3244,37 @@ typedef struct MUST_USE_STRUCT LDKProbabilisticScoringFeeParameters { bool is_owned; } LDKProbabilisticScoringFeeParameters; +/** + * An interface used to score payment channels for path finding. + * + * `ScoreLookUp` is used to determine the penalty for a given channel. + * + * Scoring is in terms of fees willing to be paid in order to avoid routing through a channel. + */ +typedef struct LDKScoreLookUp { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the + * given channel in the direction from `source` to `target`. + * + * The channel's capacity (less any other MPP parts that are also being considered for use in + * the same payment) is given by `capacity_msat`. It may be determined from various sources + * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near + * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount. + * Thus, implementations should be overflow-safe. + */ + uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, struct LDKChannelUsage usage, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKScoreLookUp; + /** @@ -3070,27 +3297,14 @@ typedef struct MUST_USE_STRUCT LDKPath { } LDKPath; /** - * An interface used to score payment channels for path finding. - * - *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel. + * `ScoreUpdate` is used to update the scorer's internal state after a payment attempt. */ -typedef struct LDKScore { +typedef struct LDKScoreUpdate { /** * An opaque pointer which is passed to your function implementations as an argument. * This has no meaning in the LDK, and can be NULL or any other value. */ void *this_arg; - /** - * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the - * given channel in the direction from `source` to `target`. - * - * The channel's capacity (less any other MPP parts that are also being considered for use in - * the same payment) is given by `capacity_msat`. It may be determined from various sources - * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near - * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount. - * Thus, implementations should be overflow-safe. - */ - uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, struct LDKChannelUsage usage, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params); /** * Handles updating channel penalties after failing to route through a channel. */ @@ -3107,24 +3321,20 @@ typedef struct LDKScore { * Handles updating channel penalties after a probe over the given path succeeded. */ void (*probe_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path); - /** - * Serialize the object into a byte array - */ - struct LDKCVec_u8Z (*write)(const void *this_arg); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. */ void (*free)(void *this_arg); -} LDKScore; +} LDKScoreUpdate; /** * A scorer that is accessed under a lock. * - * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while - * having shared ownership of a scorer but without requiring internal locking in [`Score`] + * Needed so that calls to [`ScoreLookUp::channel_penalty_msat`] in [`find_route`] can be made while + * having shared ownership of a scorer but without requiring internal locking in [`ScoreUpdate`] * implementations. Internal locking would be detrimental to route finding performance and could - * result in [`Score::channel_penalty_msat`] returning a different value for the same channel. + * result in [`ScoreLookUp::channel_penalty_msat`] returning a different value for the same channel. * * [`find_route`]: crate::routing::router::find_route */ @@ -3135,9 +3345,13 @@ typedef struct LDKLockableScore { */ void *this_arg; /** - * Returns the locked scorer. + * Returns read locked scorer. */ - struct LDKScore (*lock)(const void *this_arg); + struct LDKScoreLookUp (*read_lock)(const void *this_arg); + /** + * Returns write locked scorer. + */ + struct LDKScoreUpdate (*write_lock)(const void *this_arg); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -3200,9 +3414,9 @@ typedef struct LDKCOption_WriteableScoreZ { } LDKCOption_WriteableScoreZ; /** - * The contents of CResult_NoneErrorZ + * The contents of CResult_NoneIOErrorZ */ -typedef union LDKCResult_NoneErrorZPtr { +typedef union LDKCResult_NoneIOErrorZPtr { /** * Note that this value is always NULL, as there are no contents in the OK variant */ @@ -3212,24 +3426,24 @@ typedef union LDKCResult_NoneErrorZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ enum LDKIOError *err; -} LDKCResult_NoneErrorZPtr; +} LDKCResult_NoneIOErrorZPtr; /** - * A CResult_NoneErrorZ represents the result of a fallible operation, + * A CResult_NoneIOErrorZ represents the result of a fallible operation, * containing a () on success and a crate::c_types::IOError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NoneErrorZ { +typedef struct LDKCResult_NoneIOErrorZ { /** - * The contents of this CResult_NoneErrorZ, accessible via either + * The contents of this CResult_NoneIOErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneErrorZPtr contents; + union LDKCResult_NoneIOErrorZPtr contents; /** - * Whether this CResult_NoneErrorZ represents a success state. + * Whether this CResult_NoneIOErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneErrorZ; +} LDKCResult_NoneIOErrorZ; @@ -3452,8 +3666,9 @@ typedef struct LDKCResult_RouteHopDecodeErrorZ { /** - * Used to construct the blinded hops portion of a blinded path. These hops cannot be identified - * by outside observers and thus can be used to hide the identity of the recipient. + * An encrypted payload and node id corresponding to a hop in a payment or onion message path, to + * be encoded in the sender's onion packet. These hops cannot be identified by outside observers + * and thus can be used to hide the identity of the recipient. */ typedef struct MUST_USE_STRUCT LDKBlindedHop { /** @@ -3558,33 +3773,6 @@ typedef struct LDKCVec_RouteHopZ { uintptr_t datalen; } LDKCVec_RouteHopZ; -/** - * An enum which can either contain a u32 or not - */ -typedef enum LDKCOption_u32Z_Tag { - /** - * When we're in this state, this COption_u32Z contains a u32 - */ - LDKCOption_u32Z_Some, - /** - * When we're in this state, this COption_u32Z contains nothing - */ - LDKCOption_u32Z_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_u32Z_Sentinel, -} LDKCOption_u32Z_Tag; - -typedef struct LDKCOption_u32Z { - LDKCOption_u32Z_Tag tag; - union { - struct { - uint32_t some; - }; - }; -} LDKCOption_u32Z; - /** * A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size. * This corresponds to std::vector in C++ @@ -3945,7 +4133,7 @@ typedef struct LDKCVec_PublicKeyZ { /** - * [`Score`] implementation that uses a fixed penalty. + * [`ScoreLookUp`] implementation that uses a fixed penalty. */ typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer { /** @@ -4053,14 +4241,14 @@ typedef struct LDKCOption_C2Tuple_u64u64ZZ { } LDKCOption_C2Tuple_u64u64ZZ; /** - * 8 u16s + * 32 u16s */ -typedef struct LDKEightU16s { +typedef struct LDKThirtyTwoU16s { /** - * The eight 16-bit integers + * The thirty-two 16-bit integers */ - uint16_t data[8]; -} LDKEightU16s; + uint16_t data[32]; +} LDKThirtyTwoU16s; /** * A tuple of 2 elements. See the individual fields for the types contained. @@ -4069,53 +4257,80 @@ typedef struct LDKC2Tuple_Z { /** * The element at position 0 */ - struct LDKEightU16s a; + struct LDKThirtyTwoU16s a; /** * The element at position 1 */ - struct LDKEightU16s b; + struct LDKThirtyTwoU16s b; } LDKC2Tuple_Z; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple__u168_u168Z { +typedef struct LDKC2Tuple__u1632_u1632Z { /** * The element at position 0 */ - struct LDKEightU16s a; + struct LDKThirtyTwoU16s a; /** * The element at position 1 */ - struct LDKEightU16s b; -} LDKC2Tuple__u168_u168Z; + struct LDKThirtyTwoU16s b; +} LDKC2Tuple__u1632_u1632Z; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not + */ +typedef enum LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z + */ + LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing + */ + LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Sentinel, +} LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Tag; + +typedef struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { + LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Tag tag; + union { + struct { + struct LDKC2Tuple__u1632_u1632Z some; + }; + }; +} LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ; /** - * An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not + * An enum which can either contain a f64 or not */ -typedef enum LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag { +typedef enum LDKCOption_f64Z_Tag { /** - * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z + * When we're in this state, this COption_f64Z contains a f64 */ - LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some, + LDKCOption_f64Z_Some, /** - * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing + * When we're in this state, this COption_f64Z contains nothing */ - LDKCOption_C2Tuple_EightU16sEightU16sZZ_None, + LDKCOption_f64Z_None, /** * Must be last for serialization purposes */ - LDKCOption_C2Tuple_EightU16sEightU16sZZ_Sentinel, -} LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag; + LDKCOption_f64Z_Sentinel, +} LDKCOption_f64Z_Tag; -typedef struct LDKCOption_C2Tuple_EightU16sEightU16sZZ { - LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag tag; +typedef struct LDKCOption_f64Z { + LDKCOption_f64Z_Tag tag; union { struct { - struct LDKC2Tuple__u168_u168Z some; + double some; }; }; -} LDKCOption_C2Tuple_EightU16sEightU16sZZ; +} LDKCOption_f64Z; @@ -4181,7 +4396,7 @@ typedef struct MUST_USE_STRUCT LDKNetworkGraph { /** - * [`Score`] implementation using channel success probability distributions. + * [`ScoreLookUp`] implementation using channel success probability distributions. * * Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel, * we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC. @@ -4191,7 +4406,7 @@ typedef struct MUST_USE_STRUCT LDKNetworkGraph { * These bounds are then used to determine a success probability using the formula from * *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt * and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`). - * + *6762, 1070 * This probability is combined with the [`liquidity_penalty_multiplier_msat`] and * [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in * milli-satoshis. The penalties, when added across all hops, have the property of being linear in @@ -4296,37 +4511,10 @@ typedef struct LDKCVec_C2Tuple_usizeTransactionZZ { uintptr_t datalen; } LDKCVec_C2Tuple_usizeTransactionZZ; -/** - * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not - */ -typedef enum LDKCOption_BlockHashZ_Tag { - /** - * When we're in this state, this COption_BlockHashZ contains a crate::c_types::ThirtyTwoBytes - */ - LDKCOption_BlockHashZ_Some, - /** - * When we're in this state, this COption_BlockHashZ contains nothing - */ - LDKCOption_BlockHashZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_BlockHashZ_Sentinel, -} LDKCOption_BlockHashZ_Tag; - -typedef struct LDKCOption_BlockHashZ { - LDKCOption_BlockHashZ_Tag tag; - union { - struct { - struct LDKThirtyTwoBytes some; - }; - }; -} LDKCOption_BlockHashZ; - /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_TxidCOption_BlockHashZZ { +typedef struct LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { /** * The element at position 0 */ @@ -4334,24 +4522,56 @@ typedef struct LDKC2Tuple_TxidCOption_BlockHashZZ { /** * The element at position 1 */ - struct LDKCOption_BlockHashZ b; -} LDKC2Tuple_TxidCOption_BlockHashZZ; + struct LDKCOption_ThirtyTwoBytesZ b; +} LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ { +typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_TxidCOption_BlockHashZZ *data; + struct LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ; +} LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ; + +/** + * The contents of CResult_ChannelMonitorUpdateStatusNoneZ + */ +typedef union LDKCResult_ChannelMonitorUpdateStatusNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + enum LDKChannelMonitorUpdateStatus *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_ChannelMonitorUpdateStatusNoneZPtr; + +/** + * A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation, + * containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ChannelMonitorUpdateStatusNoneZ { + /** + * The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ChannelMonitorUpdateStatusNoneZPtr contents; + /** + * Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_ChannelMonitorUpdateStatusNoneZ; @@ -4386,7 +4606,7 @@ typedef enum LDKMonitorEvent_Tag { /** * A monitor event that the Channel's commitment transaction was confirmed. */ - LDKMonitorEvent_CommitmentTxConfirmed, + LDKMonitorEvent_HolderForceClosed, /** * Indicates a [`ChannelMonitor`] update has completed. See * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used. @@ -4394,13 +4614,6 @@ typedef enum LDKMonitorEvent_Tag { * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress */ LDKMonitorEvent_Completed, - /** - * Indicates a [`ChannelMonitor`] update has failed. See - * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used. - * - * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure - */ - LDKMonitorEvent_UpdateFailed, /** * Must be last for serialization purposes */ @@ -4429,12 +4642,9 @@ typedef struct MUST_USE_STRUCT LDKMonitorEvent { struct LDKHTLCUpdate htlc_event; }; struct { - struct LDKOutPoint commitment_tx_confirmed; + struct LDKOutPoint holder_force_closed; }; LDKMonitorEvent_LDKCompleted_Body completed; - struct { - struct LDKOutPoint update_failed; - }; }; } LDKMonitorEvent; @@ -4868,22 +5078,6 @@ typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ { bool result_ok; } LDKCResult_ChannelTypeFeaturesDecodeErrorZ; -/** - * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_ChainHashZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKThirtyTwoBytes *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_ChainHashZ; - /** @@ -4950,9 +5144,9 @@ typedef struct LDKCResult_OfferBolt12ParseErrorZ { } LDKCResult_OfferBolt12ParseErrorZ; /** - * The contents of CResult_PublicKeyErrorZ + * The contents of CResult_PublicKeySecp256k1ErrorZ */ -typedef union LDKCResult_PublicKeyErrorZPtr { +typedef union LDKCResult_PublicKeySecp256k1ErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -4963,24 +5157,24 @@ typedef union LDKCResult_PublicKeyErrorZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ enum LDKSecp256k1Error *err; -} LDKCResult_PublicKeyErrorZPtr; +} LDKCResult_PublicKeySecp256k1ErrorZPtr; /** - * A CResult_PublicKeyErrorZ represents the result of a fallible operation, + * A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation, * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PublicKeyErrorZ { +typedef struct LDKCResult_PublicKeySecp256k1ErrorZ { /** - * The contents of this CResult_PublicKeyErrorZ, accessible via either + * The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PublicKeyErrorZPtr contents; + union LDKCResult_PublicKeySecp256k1ErrorZPtr contents; /** - * Whether this CResult_PublicKeyErrorZ represents a success state. + * Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PublicKeyErrorZ; +} LDKCResult_PublicKeySecp256k1ErrorZ; /** * The contents of CResult_NodeIdDecodeErrorZ @@ -5758,6 +5952,27 @@ typedef struct MUST_USE_STRUCT LDKTxAckRbf { +/** + * A tx_abort message which signals the cancellation of an in-progress transaction negotiation. + * + */ +typedef struct MUST_USE_STRUCT LDKTxAbort { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeTxAbort *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKTxAbort; + + + /** * A [`channel_ready`] message to be sent to or received from a peer. * @@ -6496,7 +6711,7 @@ typedef struct LDKMessageSendEvent_LDKSendTxAbort_Body { /** * The message which should be sent. */ - struct LDKTxAddInput msg; + struct LDKTxAbort msg; } LDKMessageSendEvent_LDKSendTxAbort_Body; typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body { @@ -6947,40 +7162,40 @@ typedef struct MUST_USE_STRUCT LDKHostname { /** * An address which can be used to connect to a remote peer. */ -typedef enum LDKNetAddress_Tag { +typedef enum LDKSocketAddress_Tag { /** - * An IPv4 address/port on which the peer is listening. + * An IPv4 address and port on which the peer is listening. */ - LDKNetAddress_IPv4, + LDKSocketAddress_TcpIpV4, /** - * An IPv6 address/port on which the peer is listening. + * An IPv6 address and port on which the peer is listening. */ - LDKNetAddress_IPv6, + LDKSocketAddress_TcpIpV6, /** * An old-style Tor onion address/port on which the peer is listening. * * This field is deprecated and the Tor network generally no longer supports V2 Onion * addresses. Thus, the details are not parsed here. */ - LDKNetAddress_OnionV2, + LDKSocketAddress_OnionV2, /** * A new-style Tor onion address/port on which the peer is listening. * * To create the human-readable \"hostname\", concatenate the ED25519 pubkey, checksum, and version, * wrap as base32 and append \".onion\". */ - LDKNetAddress_OnionV3, + LDKSocketAddress_OnionV3, /** * A hostname/port on which the peer is listening. */ - LDKNetAddress_Hostname, + LDKSocketAddress_Hostname, /** * Must be last for serialization purposes */ - LDKNetAddress_Sentinel, -} LDKNetAddress_Tag; + LDKSocketAddress_Sentinel, +} LDKSocketAddress_Tag; -typedef struct LDKNetAddress_LDKIPv4_Body { +typedef struct LDKSocketAddress_LDKTcpIpV4_Body { /** * The 4-byte IPv4 address */ @@ -6989,9 +7204,9 @@ typedef struct LDKNetAddress_LDKIPv4_Body { * The port on which the node is listening */ uint16_t port; -} LDKNetAddress_LDKIPv4_Body; +} LDKSocketAddress_LDKTcpIpV4_Body; -typedef struct LDKNetAddress_LDKIPv6_Body { +typedef struct LDKSocketAddress_LDKTcpIpV6_Body { /** * The 16-byte IPv6 address */ @@ -7000,9 +7215,9 @@ typedef struct LDKNetAddress_LDKIPv6_Body { * The port on which the node is listening */ uint16_t port; -} LDKNetAddress_LDKIPv6_Body; +} LDKSocketAddress_LDKTcpIpV6_Body; -typedef struct LDKNetAddress_LDKOnionV3_Body { +typedef struct LDKSocketAddress_LDKOnionV3_Body { /** * The ed25519 long-term public key of the peer */ @@ -7019,9 +7234,9 @@ typedef struct LDKNetAddress_LDKOnionV3_Body { * The port on which the node is listening */ uint16_t port; -} LDKNetAddress_LDKOnionV3_Body; +} LDKSocketAddress_LDKOnionV3_Body; -typedef struct LDKNetAddress_LDKHostname_Body { +typedef struct LDKSocketAddress_LDKHostname_Body { /** * The hostname on which the node is listening. */ @@ -7030,36 +7245,36 @@ typedef struct LDKNetAddress_LDKHostname_Body { * The port on which the node is listening. */ uint16_t port; -} LDKNetAddress_LDKHostname_Body; +} LDKSocketAddress_LDKHostname_Body; -typedef struct MUST_USE_STRUCT LDKNetAddress { - LDKNetAddress_Tag tag; +typedef struct MUST_USE_STRUCT LDKSocketAddress { + LDKSocketAddress_Tag tag; union { - LDKNetAddress_LDKIPv4_Body i_pv4; - LDKNetAddress_LDKIPv6_Body i_pv6; + LDKSocketAddress_LDKTcpIpV4_Body tcp_ip_v4; + LDKSocketAddress_LDKTcpIpV6_Body tcp_ip_v6; struct { struct LDKTwelveBytes onion_v2; }; - LDKNetAddress_LDKOnionV3_Body onion_v3; - LDKNetAddress_LDKHostname_Body hostname; + LDKSocketAddress_LDKOnionV3_Body onion_v3; + LDKSocketAddress_LDKHostname_Body hostname; }; -} LDKNetAddress; +} LDKSocketAddress; /** - * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size. + * A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_NetAddressZ { +typedef struct LDKCVec_SocketAddressZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKNetAddress *data; + struct LDKSocketAddress *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_NetAddressZ; +} LDKCVec_SocketAddressZ; @@ -7257,58 +7472,117 @@ typedef struct LDKCResult_NetworkGraphDecodeErrorZ { } LDKCResult_NetworkGraphDecodeErrorZ; /** - * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not + * An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not */ -typedef enum LDKCOption_CVec_NetAddressZZ_Tag { +typedef enum LDKCOption_CVec_SocketAddressZZ_Tag { /** - * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ + * When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ */ - LDKCOption_CVec_NetAddressZZ_Some, + LDKCOption_CVec_SocketAddressZZ_Some, /** - * When we're in this state, this COption_CVec_NetAddressZZ contains nothing + * When we're in this state, this COption_CVec_SocketAddressZZ contains nothing */ - LDKCOption_CVec_NetAddressZZ_None, + LDKCOption_CVec_SocketAddressZZ_None, /** * Must be last for serialization purposes */ - LDKCOption_CVec_NetAddressZZ_Sentinel, -} LDKCOption_CVec_NetAddressZZ_Tag; + LDKCOption_CVec_SocketAddressZZ_Sentinel, +} LDKCOption_CVec_SocketAddressZZ_Tag; -typedef struct LDKCOption_CVec_NetAddressZZ { - LDKCOption_CVec_NetAddressZZ_Tag tag; +typedef struct LDKCOption_CVec_SocketAddressZZ { + LDKCOption_CVec_SocketAddressZZ_Tag tag; union { struct { - struct LDKCVec_NetAddressZ some; + struct LDKCVec_SocketAddressZ some; }; }; -} LDKCOption_CVec_NetAddressZZ; +} LDKCOption_CVec_SocketAddressZZ; + + /** - * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not + * The parameters required to derive a channel signer via [`SignerProvider`]. */ -typedef enum LDKCOption_PaymentPreimageZ_Tag { +typedef struct MUST_USE_STRUCT LDKChannelDerivationParameters { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelDerivationParameters *inner; /** - * When we're in this state, this COption_PaymentPreimageZ contains a crate::c_types::ThirtyTwoBytes + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKCOption_PaymentPreimageZ_Some, + bool is_owned; +} LDKChannelDerivationParameters; + +/** + * The contents of CResult_ChannelDerivationParametersDecodeErrorZ + */ +typedef union LDKCResult_ChannelDerivationParametersDecodeErrorZPtr { /** - * When we're in this state, this COption_PaymentPreimageZ contains nothing + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKCOption_PaymentPreimageZ_None, + struct LDKChannelDerivationParameters *result; /** - * Must be last for serialization purposes + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKCOption_PaymentPreimageZ_Sentinel, -} LDKCOption_PaymentPreimageZ_Tag; + struct LDKDecodeError *err; +} LDKCResult_ChannelDerivationParametersDecodeErrorZPtr; -typedef struct LDKCOption_PaymentPreimageZ { - LDKCOption_PaymentPreimageZ_Tag tag; - union { - struct { - struct LDKThirtyTwoBytes some; - }; - }; -} LDKCOption_PaymentPreimageZ; +/** + * A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::events::bump_transaction::ChannelDerivationParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ChannelDerivationParametersDecodeErrorZ { + /** + * The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ChannelDerivationParametersDecodeErrorZPtr contents; + /** + * Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ChannelDerivationParametersDecodeErrorZ; + +/** + * The contents of CResult_HTLCDescriptorDecodeErrorZ + */ +typedef union LDKCResult_HTLCDescriptorDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKHTLCDescriptor *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_HTLCDescriptorDecodeErrorZPtr; + +/** + * A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::events::bump_transaction::HTLCDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_HTLCDescriptorDecodeErrorZ { + /** + * The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_HTLCDescriptorDecodeErrorZPtr contents; + /** + * Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_HTLCDescriptorDecodeErrorZ; /** * A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size. @@ -7530,31 +7804,45 @@ typedef struct LDKCResult_CVec_UtxoZNoneZ { } LDKCResult_CVec_UtxoZNoneZ; /** - * An enum which can either contain a u16 or not + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef enum LDKCOption_u16Z_Tag { +typedef struct LDKC2Tuple_u64u16Z { /** - * When we're in this state, this COption_u16Z contains a u16 + * The element at position 0 */ - LDKCOption_u16Z_Some, + uint64_t a; /** - * When we're in this state, this COption_u16Z contains nothing + * The element at position 1 */ - LDKCOption_u16Z_None, + uint16_t b; +} LDKC2Tuple_u64u16Z; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not + */ +typedef enum LDKCOption_C2Tuple_u64u16ZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z + */ + LDKCOption_C2Tuple_u64u16ZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing + */ + LDKCOption_C2Tuple_u64u16ZZ_None, /** * Must be last for serialization purposes */ - LDKCOption_u16Z_Sentinel, -} LDKCOption_u16Z_Tag; + LDKCOption_C2Tuple_u64u16ZZ_Sentinel, +} LDKCOption_C2Tuple_u64u16ZZ_Tag; -typedef struct LDKCOption_u16Z { - LDKCOption_u16Z_Tag tag; +typedef struct LDKCOption_C2Tuple_u64u16ZZ { + LDKCOption_C2Tuple_u64u16ZZ_Tag tag; union { struct { - uint16_t some; + struct LDKC2Tuple_u64u16Z some; }; }; -} LDKCOption_u16Z; +} LDKCOption_C2Tuple_u64u16ZZ; /** * An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not @@ -7584,36 +7872,9 @@ typedef struct LDKCOption_ChannelShutdownStateZ { } LDKCOption_ChannelShutdownStateZ; /** - * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not + * The contents of CResult_ThirtyTwoBytesAPIErrorZ */ -typedef enum LDKCOption_PaymentHashZ_Tag { - /** - * When we're in this state, this COption_PaymentHashZ contains a crate::c_types::ThirtyTwoBytes - */ - LDKCOption_PaymentHashZ_Some, - /** - * When we're in this state, this COption_PaymentHashZ contains nothing - */ - LDKCOption_PaymentHashZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_PaymentHashZ_Sentinel, -} LDKCOption_PaymentHashZ_Tag; - -typedef struct LDKCOption_PaymentHashZ { - LDKCOption_PaymentHashZ_Tag tag; - union { - struct { - struct LDKThirtyTwoBytes some; - }; - }; -} LDKCOption_PaymentHashZ; - -/** - * The contents of CResult__u832APIErrorZ - */ -typedef union LDKCResult__u832APIErrorZPtr { +typedef union LDKCResult_ThirtyTwoBytesAPIErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -7624,30 +7885,34 @@ typedef union LDKCResult__u832APIErrorZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKAPIError *err; -} LDKCResult__u832APIErrorZPtr; +} LDKCResult_ThirtyTwoBytesAPIErrorZPtr; /** - * A CResult__u832APIErrorZ represents the result of a fallible operation, + * A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation, * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult__u832APIErrorZ { +typedef struct LDKCResult_ThirtyTwoBytesAPIErrorZ { /** - * The contents of this CResult__u832APIErrorZ, accessible via either + * The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult__u832APIErrorZPtr contents; + union LDKCResult_ThirtyTwoBytesAPIErrorZPtr contents; /** - * Whether this CResult__u832APIErrorZ represents a success state. + * Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state. */ bool result_ok; -} LDKCResult__u832APIErrorZ; +} LDKCResult_ThirtyTwoBytesAPIErrorZ; /** * Used by [`ChannelManager::list_recent_payments`] to express the status of recent payments. * These include payments that have yet to find a successful path, or have unresolved HTLCs. */ typedef enum LDKRecentPaymentDetails_Tag { + /** + * When an invoice was requested and thus a payment has not yet been sent. + */ + LDKRecentPaymentDetails_AwaitingInvoice, /** * When a payment is still being sent and awaiting successful delivery. */ @@ -7670,7 +7935,20 @@ typedef enum LDKRecentPaymentDetails_Tag { LDKRecentPaymentDetails_Sentinel, } LDKRecentPaymentDetails_Tag; +typedef struct LDKRecentPaymentDetails_LDKAwaitingInvoice_Body { + /** + * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify + * a payment and ensure idempotency in LDK. + */ + struct LDKThirtyTwoBytes payment_id; +} LDKRecentPaymentDetails_LDKAwaitingInvoice_Body; + typedef struct LDKRecentPaymentDetails_LDKPending_Body { + /** + * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify + * a payment and ensure idempotency in LDK. + */ + struct LDKThirtyTwoBytes payment_id; /** * Hash of the payment that is currently being sent but has yet to be fulfilled or * abandoned. @@ -7684,14 +7962,24 @@ typedef struct LDKRecentPaymentDetails_LDKPending_Body { } LDKRecentPaymentDetails_LDKPending_Body; typedef struct LDKRecentPaymentDetails_LDKFulfilled_Body { + /** + * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify + * a payment and ensure idempotency in LDK. + */ + struct LDKThirtyTwoBytes payment_id; /** * Hash of the payment that was claimed. `None` for serializations of [`ChannelManager`] * made before LDK version 0.0.104. */ - struct LDKCOption_PaymentHashZ payment_hash; + struct LDKCOption_ThirtyTwoBytesZ payment_hash; } LDKRecentPaymentDetails_LDKFulfilled_Body; typedef struct LDKRecentPaymentDetails_LDKAbandoned_Body { + /** + * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify + * a payment and ensure idempotency in LDK. + */ + struct LDKThirtyTwoBytes payment_id; /** * Hash of the payment that we have given up trying to send. */ @@ -7701,6 +7989,7 @@ typedef struct LDKRecentPaymentDetails_LDKAbandoned_Body { typedef struct MUST_USE_STRUCT LDKRecentPaymentDetails { LDKRecentPaymentDetails_Tag tag; union { + LDKRecentPaymentDetails_LDKAwaitingInvoice_Body awaiting_invoice; LDKRecentPaymentDetails_LDKPending_Body pending; LDKRecentPaymentDetails_LDKFulfilled_Body fulfilled; LDKRecentPaymentDetails_LDKAbandoned_Body abandoned; @@ -7899,9 +8188,9 @@ typedef struct LDKCResult_NoneRetryableSendFailureZ { } LDKCResult_NoneRetryableSendFailureZ; /** - * The contents of CResult_PaymentHashPaymentSendFailureZ + * The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ */ -typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr { +typedef union LDKCResult_ThirtyTwoBytesPaymentSendFailureZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -7912,29 +8201,29 @@ typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKPaymentSendFailure *err; -} LDKCResult_PaymentHashPaymentSendFailureZPtr; +} LDKCResult_ThirtyTwoBytesPaymentSendFailureZPtr; /** - * A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation, + * A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation, * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentHashPaymentSendFailureZ { +typedef struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ { /** - * The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either + * The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentHashPaymentSendFailureZPtr contents; + union LDKCResult_ThirtyTwoBytesPaymentSendFailureZPtr contents; /** - * Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state. + * Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentHashPaymentSendFailureZ; +} LDKCResult_ThirtyTwoBytesPaymentSendFailureZ; /** - * The contents of CResult_PaymentHashRetryableSendFailureZ + * The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ */ -typedef union LDKCResult_PaymentHashRetryableSendFailureZPtr { +typedef union LDKCResult_ThirtyTwoBytesRetryableSendFailureZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -7945,29 +8234,29 @@ typedef union LDKCResult_PaymentHashRetryableSendFailureZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ enum LDKRetryableSendFailure *err; -} LDKCResult_PaymentHashRetryableSendFailureZPtr; +} LDKCResult_ThirtyTwoBytesRetryableSendFailureZPtr; /** - * A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation, + * A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation, * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentHashRetryableSendFailureZ { +typedef struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ { /** - * The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either + * The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentHashRetryableSendFailureZPtr contents; + union LDKCResult_ThirtyTwoBytesRetryableSendFailureZPtr contents; /** - * Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state. + * Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentHashRetryableSendFailureZ; +} LDKCResult_ThirtyTwoBytesRetryableSendFailureZ; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_PaymentHashPaymentIdZ { +typedef struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { /** * The element at position 0 */ @@ -7976,194 +8265,181 @@ typedef struct LDKC2Tuple_PaymentHashPaymentIdZ { * The element at position 1 */ struct LDKThirtyTwoBytes b; -} LDKC2Tuple_PaymentHashPaymentIdZ; +} LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ; /** - * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ + * The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ */ -typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { +typedef union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_PaymentHashPaymentIdZ *result; + struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKPaymentSendFailure *err; -} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr; +} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr; /** - * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. + * A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { +typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { /** - * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either + * The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents; + union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr contents; /** - * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state. + * Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ; +} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ; /** - * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_ThirtyTwoBytesZ { +typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKThirtyTwoBytes *data; + struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_ThirtyTwoBytesZ; +} LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * Indicates that we failed to send a payment probe. Further errors may be surfaced later via + * [`Event::ProbeFailed`]. + * + * [`Event::ProbeFailed`]: crate::events::Event::ProbeFailed */ -typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ { +typedef enum LDKProbeSendFailure_Tag { /** - * The element at position 0 + * We were unable to find a route to the destination. */ - struct LDKThirtyTwoBytes a; + LDKProbeSendFailure_RouteNotFound, /** - * The element at position 1 + * We failed to send the payment probes. */ - struct LDKThirtyTwoBytes b; -} LDKC2Tuple_PaymentHashPaymentSecretZ; + LDKProbeSendFailure_SendingFailed, + /** + * Must be last for serialization purposes + */ + LDKProbeSendFailure_Sentinel, +} LDKProbeSendFailure_Tag; + +typedef struct MUST_USE_STRUCT LDKProbeSendFailure { + LDKProbeSendFailure_Tag tag; + union { + struct { + struct LDKPaymentSendFailure sending_failed; + }; + }; +} LDKProbeSendFailure; /** - * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ + * The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ */ -typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { +typedef union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_PaymentHashPaymentSecretZ *result; + struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr; + struct LDKProbeSendFailure *err; +} LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr; /** - * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure. + * A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { +typedef struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { /** - * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either + * The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents; + union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr contents; /** - * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state. + * Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ; +} LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ; /** - * The contents of CResult_PaymentSecretNoneZ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_PaymentSecretNoneZPtr { +typedef struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The element at position 0 */ - struct LDKThirtyTwoBytes *result; + struct LDKThirtyTwoBytes a; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * The element at position 1 */ - void *err; -} LDKCResult_PaymentSecretNoneZPtr; + struct LDKPublicKey b; +} LDKC2Tuple_ThirtyTwoBytesPublicKeyZ; /** - * A CResult_PaymentSecretNoneZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_PaymentSecretNoneZ { +typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ { /** - * The contents of this CResult_PaymentSecretNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - union LDKCResult_PaymentSecretNoneZPtr contents; + struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *data; /** - * Whether this CResult_PaymentSecretNoneZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_PaymentSecretNoneZ; + uintptr_t datalen; +} LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ; /** - * The contents of CResult_PaymentPreimageAPIErrorZ + * The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ */ -typedef union LDKCResult_PaymentPreimageAPIErrorZPtr { +typedef union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes *result; + struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - struct LDKAPIError *err; -} LDKCResult_PaymentPreimageAPIErrorZPtr; + void *err; +} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr; /** - * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. + * A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentPreimageAPIErrorZ { +typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { /** - * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either + * The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentPreimageAPIErrorZPtr contents; + union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr contents; /** - * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state. + * Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentPreimageAPIErrorZ; - -/** - * An enum which can either contain a crate::c_types::derived::CVec_ChainHashZ or not - */ -typedef enum LDKCOption_CVec_ChainHashZZ_Tag { - /** - * When we're in this state, this COption_CVec_ChainHashZZ contains a crate::c_types::derived::CVec_ChainHashZ - */ - LDKCOption_CVec_ChainHashZZ_Some, - /** - * When we're in this state, this COption_CVec_ChainHashZZ contains nothing - */ - LDKCOption_CVec_ChainHashZZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_CVec_ChainHashZZ_Sentinel, -} LDKCOption_CVec_ChainHashZZ_Tag; - -typedef struct LDKCOption_CVec_ChainHashZZ { - LDKCOption_CVec_ChainHashZZ_Tag tag; - union { - struct { - struct LDKCVec_ChainHashZ some; - }; - }; -} LDKCOption_CVec_ChainHashZZ; +} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ; @@ -8470,21 +8746,12 @@ typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { * blocks are connected and disconnected. * * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are - * responsible for maintaining a set of monitors such that they can be updated accordingly as - * channel state changes and HTLCs are resolved. See method documentation for specific - * requirements. - * - * Implementations **must** ensure that updates are successfully applied and persisted upon method - * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down - * without taking any further action such as persisting the current state. - * - * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing - * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it - * could result in a revoked transaction being broadcast, allowing the counterparty to claim all - * funds in the channel. See [`ChannelMonitorUpdateStatus`] for more details about how to handle - * multiple instances. + * responsible for maintaining a set of monitors such that they can be updated as channel state + * changes. On each update, *all copies* of a [`ChannelMonitor`] must be updated and the update + * persisted to disk to ensure that the latest [`ChannelMonitor`] state can be reloaded if the + * application crashes. * - * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure + * See method documentation and [`ChannelMonitorUpdateStatus`] for specific requirements. */ typedef struct LDKWatch { /** @@ -8499,21 +8766,33 @@ typedef struct LDKWatch { * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means * calling [`block_connected`] and [`block_disconnected`] on the monitor. * - * Note: this interface MUST error with [`ChannelMonitorUpdateStatus::PermanentFailure`] if - * the given `funding_txo` has previously been registered via `watch_channel`. + * A return of `Err(())` indicates that the channel should immediately be force-closed without + * broadcasting the funding transaction. + * + * If the given `funding_txo` has previously been registered via `watch_channel`, `Err(())` + * must be returned. * * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected */ - enum LDKChannelMonitorUpdateStatus (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); + struct LDKCResult_ChannelMonitorUpdateStatusNoneZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); /** * Updates a channel identified by `funding_txo` by applying `update` to its monitor. * - * Implementations must call [`update_monitor`] with the given update. See - * [`ChannelMonitorUpdateStatus`] for invariants around returning an error. + * Implementations must call [`ChannelMonitor::update_monitor`] with the given update. This + * may fail (returning an `Err(())`), in which case this should return + * [`ChannelMonitorUpdateStatus::InProgress`] (and the update should never complete). This + * generally implies the channel has been closed (either by the funding outpoint being spent + * on-chain or the [`ChannelMonitor`] having decided to do so and broadcasted a transaction), + * and the [`ChannelManager`] state will be updated once it sees the funding spend on-chain. + * + * In general, persistence failures should be retried after returning + * [`ChannelMonitorUpdateStatus::InProgress`] and eventually complete. If a failure truly + * cannot be retried, the node should shut down immediately after returning + * [`ChannelMonitorUpdateStatus::UnrecoverableError`], see its documentation for more info. * - * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ enum LDKChannelMonitorUpdateStatus (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, const struct LDKChannelMonitorUpdate *NONNULL_PTR update); /** @@ -8621,6 +8900,56 @@ typedef struct LDKu8slice { +/** + * A semantically valid [`InvoiceRequest`] that hasn't been signed. + * + * # Serialization + * + * This is serialized as a TLV stream, which includes TLV records from the originating message. As + * such, it may include unknown, odd TLV records. + */ +typedef struct MUST_USE_STRUCT LDKUnsignedInvoiceRequest { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUnsignedInvoiceRequest *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKUnsignedInvoiceRequest; + + + +/** + * A semantically valid [`Bolt12Invoice`] that hasn't been signed. + * + * # Serialization + * + * This is serialized as a TLV stream, which includes TLV records from the originating message. As + * such, it may include unknown, odd TLV records. + */ +typedef struct MUST_USE_STRUCT LDKUnsignedBolt12Invoice { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUnsignedBolt12Invoice *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKUnsignedBolt12Invoice; + + + /** * The unsigned part of a [`channel_update`] message. * @@ -8740,7 +9069,7 @@ typedef struct LDKNodeSigner { * * Errors if the [`Recipient`] variant is not supported by the implementation. */ - struct LDKCResult_SharedSecretNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak); + struct LDKCResult_ThirtyTwoBytesNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_BigEndianScalarZ tweak); /** * Sign an invoice. * @@ -8755,6 +9084,34 @@ typedef struct LDKNodeSigner { * Errors if the [`Recipient`] variant is not supported by the implementation. */ struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient recipient); + /** + * Signs the [`TaggedHash`] of a BOLT 12 invoice request. + * + * May be called by a function passed to [`UnsignedInvoiceRequest::sign`] where + * `invoice_request` is the callee. + * + * Implementors may check that the `invoice_request` is expected rather than blindly signing + * the tagged hash. An `Ok` result should sign `invoice_request.tagged_hash().as_digest()` with + * the node's signing key or an ephemeral key to preserve privacy, whichever is associated with + * [`UnsignedInvoiceRequest::payer_id`]. + * + * [`TaggedHash`]: crate::offers::merkle::TaggedHash + */ + struct LDKCResult_SchnorrSignatureNoneZ (*sign_bolt12_invoice_request)(const void *this_arg, const struct LDKUnsignedInvoiceRequest *NONNULL_PTR invoice_request); + /** + * Signs the [`TaggedHash`] of a BOLT 12 invoice. + * + * May be called by a function passed to [`UnsignedBolt12Invoice::sign`] where `invoice` is the + * callee. + * + * Implementors may check that the `invoice` is expected rather than blindly signing the tagged + * hash. An `Ok` result should sign `invoice.tagged_hash().as_digest()` with the node's signing + * key or an ephemeral key to preserve privacy, whichever is associated with + * [`UnsignedBolt12Invoice::signing_pubkey`]. + * + * [`TaggedHash`]: crate::offers::merkle::TaggedHash + */ + struct LDKCResult_SchnorrSignatureNoneZ (*sign_bolt12_invoice)(const void *this_arg, const struct LDKUnsignedBolt12Invoice *NONNULL_PTR invoice); /** * Sign a gossip message. * @@ -8763,7 +9120,7 @@ typedef struct LDKNodeSigner { * message to be broadcast, as otherwise it may prevent one from receiving funds over the * corresponding channel. */ - struct LDKCResult_SignatureNoneZ (*sign_gossip_message)(const void *this_arg, struct LDKUnsignedGossipMessage msg); + struct LDKCResult_ECDSASignatureNoneZ (*sign_gossip_message)(const void *this_arg, struct LDKUnsignedGossipMessage msg); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -8822,7 +9179,7 @@ typedef struct LDKSignerProvider { * This method should return a different value each time it is called, to avoid linking * on-chain funds across channels as controlled to the same user. */ - struct LDKCResult_ScriptNoneZ (*get_destination_script)(const void *this_arg); + struct LDKCResult_CVec_u8ZNoneZ (*get_destination_script)(const void *this_arg); /** * Get a script pubkey which we will send funds to when closing a channel. * @@ -8929,12 +9286,14 @@ typedef struct LDKRouter { * called [`funding_transaction_generated`] for outbound channels) being closed. * * Note that you can be a bit lazier about writing out `ChannelManager` than you can be with - * [`ChannelMonitor`]. With [`ChannelMonitor`] you MUST write each monitor update out to disk before - * returning from [`chain::Watch::watch_channel`]/[`update_channel`], with ChannelManagers, writing updates - * happens out-of-band (and will prevent any other `ChannelManager` operations from occurring during - * the serialization process). If the deserialized version is out-of-date compared to the - * [`ChannelMonitor`] passed by reference to [`read`], those channels will be force-closed based on the - * `ChannelMonitor` state and no funds will be lost (mod on-chain transaction fees). + * [`ChannelMonitor`]. With [`ChannelMonitor`] you MUST durably write each + * [`ChannelMonitorUpdate`] before returning from + * [`chain::Watch::watch_channel`]/[`update_channel`] or before completing async writes. With + * `ChannelManager`s, writing updates happens out-of-band (and will prevent any other + * `ChannelManager` operations from occurring during the serialization process). If the + * deserialized version is out-of-date compared to the [`ChannelMonitor`] passed by reference to + * [`read`], those channels will be force-closed based on the `ChannelMonitor` state and no funds + * will be lost (modulo on-chain transaction fees). * * Note that the deserializer is only implemented for `(`[`BlockHash`]`, `[`ChannelManager`]`)`, which * tells you the last block hash which was connected. You should get the best block tip before using the manager. @@ -8988,7 +9347,7 @@ typedef struct MUST_USE_STRUCT LDKChannelManager { /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_BlockHashChannelManagerZ { +typedef struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ { /** * The element at position 0 */ @@ -8997,40 +9356,40 @@ typedef struct LDKC2Tuple_BlockHashChannelManagerZ { * The element at position 1 */ struct LDKChannelManager b; -} LDKC2Tuple_BlockHashChannelManagerZ; +} LDKC2Tuple_ThirtyTwoBytesChannelManagerZ; /** - * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ + * The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ */ -typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { +typedef union LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_BlockHashChannelManagerZ *result; + struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr; +} LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr; /** - * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { +typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { /** - * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either + * The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents; + union LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr contents; /** - * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state. + * Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ; +} LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ; /** * Options for how to set the max dust HTLC exposure allowed on a channel. See @@ -9400,7 +9759,7 @@ typedef struct LDKCResult_HTLCUpdateDecodeErrorZ { /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_OutPointScriptZ { +typedef struct LDKC2Tuple_OutPointCVec_u8ZZ { /** * The element at position 0 */ @@ -9409,12 +9768,12 @@ typedef struct LDKC2Tuple_OutPointScriptZ { * The element at position 1 */ struct LDKCVec_u8Z b; -} LDKC2Tuple_OutPointScriptZ; +} LDKC2Tuple_OutPointCVec_u8ZZ; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_u32ScriptZ { +typedef struct LDKC2Tuple_u32CVec_u8ZZ { /** * The element at position 0 */ @@ -9423,28 +9782,28 @@ typedef struct LDKC2Tuple_u32ScriptZ { * The element at position 1 */ struct LDKCVec_u8Z b; -} LDKC2Tuple_u32ScriptZ; +} LDKC2Tuple_u32CVec_u8ZZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_u32ScriptZZ { +typedef struct LDKCVec_C2Tuple_u32CVec_u8ZZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_u32ScriptZ *data; + struct LDKC2Tuple_u32CVec_u8ZZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_u32ScriptZZ; +} LDKCVec_C2Tuple_u32CVec_u8ZZZ; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { +typedef struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { /** * The element at position 0 */ @@ -9452,24 +9811,40 @@ typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { /** * The element at position 1 */ - struct LDKCVec_C2Tuple_u32ScriptZZ b; -} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; + struct LDKCVec_C2Tuple_u32CVec_u8ZZZ b; +} LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size. + * A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { +typedef struct LDKCVec_CommitmentTransactionZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data; + struct LDKCommitmentTransaction *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ; +} LDKCVec_CommitmentTransactionZ; /** * A tuple of 2 elements. See the individual fields for the types contained. @@ -9504,7 +9879,7 @@ typedef struct LDKCVec_C2Tuple_u32TxOutZZ { /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { +typedef struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { /** * The element at position 0 */ @@ -9513,10 +9888,10 @@ typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { * The element at position 1 */ struct LDKCVec_C2Tuple_u32TxOutZZ b; -} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; +} LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size. * This corresponds to std::vector in C++ */ typedef struct LDKCVec_TransactionOutputsZ { @@ -9524,7 +9899,7 @@ typedef struct LDKCVec_TransactionOutputsZ { * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data; + struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *data; /** * The number of elements pointed to by `data`. */ @@ -9590,7 +9965,7 @@ typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { * The amount available to claim, in satoshis, excluding the on-chain fees which will be * required to do so. */ - uint64_t claimable_amount_satoshis; + uint64_t amount_satoshis; } LDKBalance_LDKClaimableOnChannelClose_Body; typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { @@ -9598,7 +9973,7 @@ typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { * The amount available to claim, in satoshis, possibly excluding the on-chain fees which * were spent in broadcasting the transaction. */ - uint64_t claimable_amount_satoshis; + uint64_t amount_satoshis; /** * The height at which an [`Event::SpendableOutputs`] event will be generated for this * amount. @@ -9611,7 +9986,7 @@ typedef struct LDKBalance_LDKContentiousClaimable_Body { * The amount available to claim, in satoshis, excluding the on-chain fees which will be * required to do so. */ - uint64_t claimable_amount_satoshis; + uint64_t amount_satoshis; /** * The height at which the counterparty may be able to claim the balance if we have not * done so. @@ -9632,7 +10007,7 @@ typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body { * The amount potentially available to claim, in satoshis, excluding the on-chain fees * which will be required to do so. */ - uint64_t claimable_amount_satoshis; + uint64_t amount_satoshis; /** * The height at which we will be able to claim the balance if our counterparty has not * done so. @@ -9649,7 +10024,7 @@ typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body { * The amount potentially available to claim, in satoshis, excluding the on-chain fees * which will be required to do so. */ - uint64_t claimable_amount_satoshis; + uint64_t amount_satoshis; /** * The height at which our counterparty will be able to claim the balance if we have not * yet received the preimage and claimed it ourselves. @@ -9668,7 +10043,7 @@ typedef struct LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body { * Note that for outputs from HTLC balances this may be excluding some on-chain fees that * were already spent. */ - uint64_t claimable_amount_satoshis; + uint64_t amount_satoshis; } LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body; typedef struct MUST_USE_STRUCT LDKBalance { @@ -9702,7 +10077,7 @@ typedef struct LDKCVec_BalanceZ { /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_BlockHashChannelMonitorZ { +typedef struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ { /** * The element at position 0 */ @@ -9711,40 +10086,40 @@ typedef struct LDKC2Tuple_BlockHashChannelMonitorZ { * The element at position 1 */ struct LDKChannelMonitor b; -} LDKC2Tuple_BlockHashChannelMonitorZ; +} LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ; /** - * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ + * The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ */ -typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { +typedef union LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_BlockHashChannelMonitorZ *result; + struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr; +} LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr; /** - * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { +typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { /** - * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either + * The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents; + union LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr contents; /** - * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. + * Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; +} LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ; /** * Defines a type identifier for sending messages over the wire. @@ -9769,6 +10144,12 @@ typedef struct LDKType { * Serialize the object into a byte array */ struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Called, if set, after this Type has been cloned into a duplicate object. + * The new Type is provided, and should be mutated as needed to perform a + * deep copy of the object pointed to by this_arg or avoid any double-freeing. + */ + void (*cloned)(struct LDKType *NONNULL_PTR new_Type); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -9969,6 +10350,12 @@ typedef struct LDKCustomOnionMessageContents { * Serialize the object into a byte array */ struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Called, if set, after this CustomOnionMessageContents has been cloned into a duplicate object. + * The new CustomOnionMessageContents is provided, and should be mutated as needed to perform a + * deep copy of the object pointed to by this_arg or avoid any double-freeing. + */ + void (*cloned)(struct LDKCustomOnionMessageContents *NONNULL_PTR new_CustomOnionMessageContents); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -10097,36 +10484,36 @@ typedef struct LDKCResult_COption_TypeZDecodeErrorZ { } LDKCResult_COption_TypeZDecodeErrorZ; /** - * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not + * An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not */ -typedef enum LDKCOption_NetAddressZ_Tag { +typedef enum LDKCOption_SocketAddressZ_Tag { /** - * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress + * When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress */ - LDKCOption_NetAddressZ_Some, + LDKCOption_SocketAddressZ_Some, /** - * When we're in this state, this COption_NetAddressZ contains nothing + * When we're in this state, this COption_SocketAddressZ contains nothing */ - LDKCOption_NetAddressZ_None, + LDKCOption_SocketAddressZ_None, /** * Must be last for serialization purposes */ - LDKCOption_NetAddressZ_Sentinel, -} LDKCOption_NetAddressZ_Tag; + LDKCOption_SocketAddressZ_Sentinel, +} LDKCOption_SocketAddressZ_Tag; -typedef struct LDKCOption_NetAddressZ { - LDKCOption_NetAddressZ_Tag tag; +typedef struct LDKCOption_SocketAddressZ { + LDKCOption_SocketAddressZ_Tag tag; union { struct { - struct LDKNetAddress some; + struct LDKSocketAddress some; }; }; -} LDKCOption_NetAddressZ; +} LDKCOption_SocketAddressZ; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ { +typedef struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ { /** * The element at position 0 */ @@ -10134,24 +10521,24 @@ typedef struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ { /** * The element at position 1 */ - struct LDKCOption_NetAddressZ b; -} LDKC2Tuple_PublicKeyCOption_NetAddressZZ; + struct LDKCOption_SocketAddressZ b; +} LDKC2Tuple_PublicKeyCOption_SocketAddressZZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ { +typedef struct LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ *data; + struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ; +} LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ; @@ -10339,100 +10726,258 @@ typedef struct LDKCResult_u32GraphSyncErrorZ { } LDKCResult_u32GraphSyncErrorZ; /** - * Represents a valid secp256k1 secret key serialized as a 32 byte array. + * The contents of CResult_CVec_u8ZIOErrorZ */ -typedef struct LDKSecretKey { +typedef union LDKCResult_CVec_u8ZIOErrorZPtr { /** - * The bytes of the secret key + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - uint8_t bytes[32]; -} LDKSecretKey; + struct LDKCVec_u8Z *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKIOError *err; +} LDKCResult_CVec_u8ZIOErrorZPtr; /** - * An enum which can either contain a crate::c_types::SecretKey or not + * A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef enum LDKCOption_KeyPairZ_Tag { +typedef struct LDKCResult_CVec_u8ZIOErrorZ { /** - * When we're in this state, this COption_KeyPairZ contains a crate::c_types::SecretKey + * The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKCOption_KeyPairZ_Some, + union LDKCResult_CVec_u8ZIOErrorZPtr contents; /** - * When we're in this state, this COption_KeyPairZ contains nothing + * Whether this CResult_CVec_u8ZIOErrorZ represents a success state. */ - LDKCOption_KeyPairZ_None, + bool result_ok; +} LDKCResult_CVec_u8ZIOErrorZ; + +/** + * A dynamically-allocated array of crate::c_types::Strs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_StrZ { /** - * Must be last for serialization purposes + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKCOption_KeyPairZ_Sentinel, -} LDKCOption_KeyPairZ_Tag; + struct LDKStr *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_StrZ; -typedef struct LDKCOption_KeyPairZ { - LDKCOption_KeyPairZ_Tag tag; - union { - struct { - struct LDKSecretKey some; - }; - }; -} LDKCOption_KeyPairZ; +/** + * The contents of CResult_CVec_StrZIOErrorZ + */ +typedef union LDKCResult_CVec_StrZIOErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_StrZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKIOError *err; +} LDKCResult_CVec_StrZIOErrorZPtr; + +/** + * A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_StrZIOErrorZ { + /** + * The contents of this CResult_CVec_StrZIOErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_StrZIOErrorZPtr contents; + /** + * Whether this CResult_CVec_StrZIOErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_StrZIOErrorZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ; /** - * The contents of CResult_COption_KeyPairZNoneZ + * The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ */ -typedef union LDKCResult_COption_KeyPairZNoneZPtr { +typedef union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_KeyPairZ *result; + struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_COption_KeyPairZNoneZPtr; + enum LDKIOError *err; +} LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr; /** - * A CResult_COption_KeyPairZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::COption_KeyPairZ on success and a () on failure. + * A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_COption_KeyPairZNoneZ { +typedef struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { /** - * The contents of this CResult_COption_KeyPairZNoneZ, accessible via either + * The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_COption_KeyPairZNoneZPtr contents; + union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr contents; /** - * Whether this CResult_COption_KeyPairZNoneZ represents a success state. + * Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state. */ bool result_ok; -} LDKCResult_COption_KeyPairZNoneZ; +} LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ; /** - * An enum which can either contain a crate::c_types::derived::CVec_u8Z or not + * The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ + */ +typedef union LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKIOError *err; +} LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr; + +/** + * A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + /** + * The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr contents; + /** + * Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ; + +/** + * Represents a valid secp256k1 secret key serialized as a 32 byte array. + */ +typedef struct LDKSecretKey { + /** + * The bytes of the secret key + */ + uint8_t bytes[32]; +} LDKSecretKey; + +/** + * An enum which can either contain a crate::c_types::SecretKey or not */ -typedef enum LDKCOption_ScriptZ_Tag { +typedef enum LDKCOption_SecretKeyZ_Tag { /** - * When we're in this state, this COption_ScriptZ contains a crate::c_types::derived::CVec_u8Z + * When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey */ - LDKCOption_ScriptZ_Some, + LDKCOption_SecretKeyZ_Some, /** - * When we're in this state, this COption_ScriptZ contains nothing + * When we're in this state, this COption_SecretKeyZ contains nothing */ - LDKCOption_ScriptZ_None, + LDKCOption_SecretKeyZ_None, /** * Must be last for serialization purposes */ - LDKCOption_ScriptZ_Sentinel, -} LDKCOption_ScriptZ_Tag; + LDKCOption_SecretKeyZ_Sentinel, +} LDKCOption_SecretKeyZ_Tag; -typedef struct LDKCOption_ScriptZ { - LDKCOption_ScriptZ_Tag tag; +typedef struct LDKCOption_SecretKeyZ { + LDKCOption_SecretKeyZ_Tag tag; union { struct { - struct LDKCVec_u8Z some; + struct LDKSecretKey some; }; }; -} LDKCOption_ScriptZ; +} LDKCOption_SecretKeyZ; + + + +/** + * An [`InvoiceRequest`] that has been verified by [`InvoiceRequest::verify`] and exposes different + * ways to respond depending on whether the signing keys were derived. + */ +typedef struct MUST_USE_STRUCT LDKVerifiedInvoiceRequest { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeVerifiedInvoiceRequest *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKVerifiedInvoiceRequest; + +/** + * The contents of CResult_VerifiedInvoiceRequestNoneZ + */ +typedef union LDKCResult_VerifiedInvoiceRequestNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKVerifiedInvoiceRequest *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_VerifiedInvoiceRequestNoneZPtr; + +/** + * A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_VerifiedInvoiceRequestNoneZ { + /** + * The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_VerifiedInvoiceRequestNoneZPtr contents; + /** + * Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_VerifiedInvoiceRequestNoneZ; /** * A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size. @@ -10478,64 +11023,70 @@ typedef struct LDKCOption_i64Z { } LDKCOption_i64Z; /** - * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not + * The contents of CResult_SocketAddressDecodeErrorZ */ -typedef enum LDKCOption_TxidZ_Tag { +typedef union LDKCResult_SocketAddressDecodeErrorZPtr { /** - * When we're in this state, this COption_TxidZ contains a crate::c_types::ThirtyTwoBytes + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKCOption_TxidZ_Some, + struct LDKSocketAddress *result; /** - * When we're in this state, this COption_TxidZ contains nothing + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKCOption_TxidZ_None, + struct LDKDecodeError *err; +} LDKCResult_SocketAddressDecodeErrorZPtr; + +/** + * A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SocketAddressDecodeErrorZ { /** - * Must be last for serialization purposes + * The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKCOption_TxidZ_Sentinel, -} LDKCOption_TxidZ_Tag; - -typedef struct LDKCOption_TxidZ { - LDKCOption_TxidZ_Tag tag; - union { - struct { - struct LDKThirtyTwoBytes some; - }; - }; -} LDKCOption_TxidZ; + union LDKCResult_SocketAddressDecodeErrorZPtr contents; + /** + * Whether this CResult_SocketAddressDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_SocketAddressDecodeErrorZ; /** - * The contents of CResult_NetAddressDecodeErrorZ + * The contents of CResult_SocketAddressSocketAddressParseErrorZ */ -typedef union LDKCResult_NetAddressDecodeErrorZPtr { +typedef union LDKCResult_SocketAddressSocketAddressParseErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKNetAddress *result; + struct LDKSocketAddress *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_NetAddressDecodeErrorZPtr; + enum LDKSocketAddressParseError *err; +} LDKCResult_SocketAddressSocketAddressParseErrorZPtr; /** - * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NetAddressDecodeErrorZ { +typedef struct LDKCResult_SocketAddressSocketAddressParseErrorZ { /** - * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either + * The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NetAddressDecodeErrorZPtr contents; + union LDKCResult_SocketAddressSocketAddressParseErrorZPtr contents; /** - * Whether this CResult_NetAddressDecodeErrorZ represents a success state. + * Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NetAddressDecodeErrorZ; +} LDKCResult_SocketAddressSocketAddressParseErrorZ; @@ -11019,27 +11570,6 @@ typedef struct LDKCResult_TxAckRbfDecodeErrorZ { bool result_ok; } LDKCResult_TxAckRbfDecodeErrorZ; - - -/** - * A tx_abort message which signals the cancellation of an in-progress transaction negotiation. - * - */ -typedef struct MUST_USE_STRUCT LDKTxAbort { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeTxAbort *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKTxAbort; - /** * The contents of CResult_TxAbortDecodeErrorZ */ @@ -13082,36 +13612,63 @@ typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ { } LDKCResult_TrustedCommitmentTransactionNoneZ; /** - * The contents of CResult_CVec_SignatureZNoneZ + * The contents of CResult_CVec_ECDSASignatureZNoneZ */ -typedef union LDKCResult_CVec_SignatureZNoneZPtr { +typedef union LDKCResult_CVec_ECDSASignatureZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCVec_SignatureZ *result; + struct LDKCVec_ECDSASignatureZ *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_CVec_SignatureZNoneZPtr; +} LDKCResult_CVec_ECDSASignatureZNoneZPtr; /** - * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure. + * A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_CVec_SignatureZNoneZ { +typedef struct LDKCResult_CVec_ECDSASignatureZNoneZ { /** - * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either + * The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CVec_SignatureZNoneZPtr contents; + union LDKCResult_CVec_ECDSASignatureZNoneZPtr contents; /** - * Whether this CResult_CVec_SignatureZNoneZ represents a success state. + * Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_CVec_SignatureZNoneZ; +} LDKCResult_CVec_ECDSASignatureZNoneZ; + +/** + * An enum which can either contain a usize or not + */ +typedef enum LDKCOption_usizeZ_Tag { + /** + * When we're in this state, this COption_usizeZ contains a usize + */ + LDKCOption_usizeZ_Some, + /** + * When we're in this state, this COption_usizeZ contains nothing + */ + LDKCOption_usizeZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_usizeZ_Sentinel, +} LDKCOption_usizeZ_Tag; + +typedef struct LDKCOption_usizeZ { + LDKCOption_usizeZ_Tag tag; + union { + struct { + uintptr_t some; + }; + }; +} LDKCOption_usizeZ; /** * The contents of CResult_ShutdownScriptDecodeErrorZ @@ -13228,7 +13785,7 @@ typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body { * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds */ - struct LDKCOption_PaymentPreimageZ payment_preimage; + struct LDKCOption_ThirtyTwoBytesZ payment_preimage; /** * The \"payment secret\". This authenticates the sender to the recipient, preventing a * number of deanonymization attacks during the routing process. @@ -13287,6 +13844,59 @@ typedef struct LDKCResult_PaymentPurposeDecodeErrorZ { bool result_ok; } LDKCResult_PaymentPurposeDecodeErrorZ; + + +/** + * Information about an HTLC that is part of a payment that can be claimed. + */ +typedef struct MUST_USE_STRUCT LDKClaimedHTLC { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeClaimedHTLC *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKClaimedHTLC; + +/** + * The contents of CResult_ClaimedHTLCDecodeErrorZ + */ +typedef union LDKCResult_ClaimedHTLCDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKClaimedHTLC *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_ClaimedHTLCDecodeErrorZPtr; + +/** + * A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ClaimedHTLCDecodeErrorZ { + /** + * The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ClaimedHTLCDecodeErrorZPtr contents; + /** + * Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ClaimedHTLCDecodeErrorZ; + /** * When the payment path failure took place and extra details about it. [`PathFailure::OnPath`] may * contain a [`NetworkUpdate`] that needs to be applied to the [`NetworkGraph`]. @@ -13478,6 +14088,11 @@ typedef enum LDKClosureReason_Tag { * The channel has been immediately closed. */ LDKClosureReason_CounterpartyCoopClosedUnfundedChannel, + /** + * Another channel in the same funding batch closed before the funding transaction + * was ready to be broadcast. + */ + LDKClosureReason_FundingBatchClosure, /** * Must be last for serialization purposes */ @@ -13751,56 +14366,45 @@ typedef struct LDKCResult_PaymentFailureReasonDecodeErrorZ { /** * An enum which can either contain a crate::c_types::U128 or not */ -typedef enum LDKCOption_u128Z_Tag { +typedef enum LDKCOption_U128Z_Tag { /** - * When we're in this state, this COption_u128Z contains a crate::c_types::U128 + * When we're in this state, this COption_U128Z contains a crate::c_types::U128 */ - LDKCOption_u128Z_Some, + LDKCOption_U128Z_Some, /** - * When we're in this state, this COption_u128Z contains nothing + * When we're in this state, this COption_U128Z contains nothing */ - LDKCOption_u128Z_None, + LDKCOption_U128Z_None, /** * Must be last for serialization purposes */ - LDKCOption_u128Z_Sentinel, -} LDKCOption_u128Z_Tag; + LDKCOption_U128Z_Sentinel, +} LDKCOption_U128Z_Tag; -typedef struct LDKCOption_u128Z { - LDKCOption_u128Z_Tag tag; +typedef struct LDKCOption_U128Z { + LDKCOption_U128Z_Tag tag; union { struct { struct LDKU128 some; }; }; -} LDKCOption_u128Z; +} LDKCOption_U128Z; /** - * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not + * A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef enum LDKCOption_PaymentIdZ_Tag { +typedef struct LDKCVec_ClaimedHTLCZ { /** - * When we're in this state, this COption_PaymentIdZ contains a crate::c_types::ThirtyTwoBytes - */ - LDKCOption_PaymentIdZ_Some, - /** - * When we're in this state, this COption_PaymentIdZ contains nothing + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKCOption_PaymentIdZ_None, + struct LDKClaimedHTLC *data; /** - * Must be last for serialization purposes + * The number of elements pointed to by `data`. */ - LDKCOption_PaymentIdZ_Sentinel, -} LDKCOption_PaymentIdZ_Tag; - -typedef struct LDKCOption_PaymentIdZ { - LDKCOption_PaymentIdZ_Tag tag; - union { - struct { - struct LDKThirtyTwoBytes some; - }; - }; -} LDKCOption_PaymentIdZ; + uintptr_t datalen; +} LDKCVec_ClaimedHTLCZ; /** * An enum which can either contain a crate::lightning::events::PaymentFailureReason or not @@ -14030,9 +14634,19 @@ typedef enum LDKEvent_Tag { * Note that if the preimage is not known, you should call * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`] * to free up resources for this HTLC and avoid network congestion. - * If you fail to call either [`ChannelManager::claim_funds`], [`ChannelManager::fail_htlc_backwards`], - * or [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will be - * automatically failed. + * + * If [`Event::PaymentClaimable::onion_fields`] is `Some`, and includes custom TLVs with even type + * numbers, you should use [`ChannelManager::fail_htlc_backwards_with_reason`] with + * [`FailureCode::InvalidOnionPayload`] if you fail to understand and handle the contents, or + * [`ChannelManager::claim_funds_with_known_custom_tlvs`] upon successful handling. + * If you don't intend to check for custom TLVs, you can simply use + * [`ChannelManager::claim_funds`], which will automatically fail back even custom TLVs. + * + * If you fail to call [`ChannelManager::claim_funds`], + * [`ChannelManager::claim_funds_with_known_custom_tlvs`], + * [`ChannelManager::fail_htlc_backwards`], or + * [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will + * be automatically failed. * * # Note * LDK will not stop an inbound payment from being paid multiple times, so multiple @@ -14044,6 +14658,8 @@ typedef enum LDKEvent_Tag { * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier. * * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + * [`ChannelManager::claim_funds_with_known_custom_tlvs`]: crate::ln::channelmanager::ChannelManager::claim_funds_with_known_custom_tlvs + * [`FailureCode::InvalidOnionPayload`]: crate::ln::channelmanager::FailureCode::InvalidOnionPayload * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason */ @@ -14081,6 +14697,11 @@ typedef enum LDKEvent_Tag { * payment is no longer retryable, due either to the [`Retry`] provided or * [`ChannelManager::abandon_payment`] having been called for the corresponding payment. * + * In exceedingly rare cases, it is possible that an [`Event::PaymentFailed`] is generated for + * a payment after an [`Event::PaymentSent`] event for this same payment has already been + * received and processed. In this case, the [`Event::PaymentFailed`] event MUST be ignored, + * and the payment MUST be treated as having succeeded. + * * [`Retry`]: crate::ln::channelmanager::Retry * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ @@ -14167,18 +14788,28 @@ typedef enum LDKEvent_Tag { /** * Used to indicate that a previously opened channel with the given `channel_id` is in the * process of closure. + * + * Note that this event is only triggered for accepted channels: if the + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true and the channel is + * rejected, no `ChannelClosed` event will be sent. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ LDKEvent_ChannelClosed, /** * Used to indicate to the user that they can abandon the funding transaction and recycle the * inputs for another purpose. + * + * This event is not guaranteed to be generated for channels that are closed due to a restart. */ LDKEvent_DiscardFunding, /** * Indicates a request to open a new channel by a peer. * - * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the - * request, call [`ChannelManager::force_close_without_broadcasting_txn`]. + * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the request, + * call [`ChannelManager::force_close_without_broadcasting_txn`]. Note that a ['ChannelClosed`] + * event will _not_ be triggered if the channel is rejected. * * The event is only triggered when a new open channel request is received and the * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. @@ -14244,11 +14875,15 @@ typedef struct LDKEvent_LDKFundingGenerationReady_Body { */ struct LDKCVec_u8Z output_script; /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a - * random value for an inbound channel. This may be zero for objects serialized with LDK - * versions prior to 0.0.113. + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + * serialized with LDK versions prior to 0.0.113. * * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ struct LDKU128 user_channel_id; } LDKEvent_LDKFundingGenerationReady_Body; @@ -14309,14 +14944,12 @@ typedef struct LDKEvent_LDKPaymentClaimable_Body { struct LDKPaymentPurpose purpose; /** * The `channel_id` indicating over which channel we received the payment. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKThirtyTwoBytes via_channel_id; + struct LDKCOption_ThirtyTwoBytesZ via_channel_id; /** * The `user_channel_id` indicating over which channel we received the payment. */ - struct LDKCOption_u128Z via_user_channel_id; + struct LDKCOption_U128Z via_user_channel_id; /** * The block height at which this payment will be failed back and will no longer be * eligible for claiming. @@ -14356,6 +14989,16 @@ typedef struct LDKEvent_LDKPaymentClaimed_Body { * spontaneous payment. */ struct LDKPaymentPurpose purpose; + /** + * The HTLCs that comprise the claimed payment. This will be empty for events serialized prior + * to LDK version 0.0.117. + */ + struct LDKCVec_ClaimedHTLCZ htlcs; + /** + * The sender-intended sum total of all the MPP parts. This will be `None` for events + * serialized prior to LDK version 0.0.117. + */ + struct LDKCOption_u64Z sender_intended_total_msat; } LDKEvent_LDKPaymentClaimed_Body; typedef struct LDKEvent_LDKPaymentSent_Body { @@ -14364,7 +15007,7 @@ typedef struct LDKEvent_LDKPaymentSent_Body { * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ - struct LDKCOption_PaymentIdZ payment_id; + struct LDKCOption_ThirtyTwoBytesZ payment_id; /** * The preimage to the hash given to ChannelManager::send_payment. * Note that this serves as a payment receipt, if you wish to have such a thing, you must @@ -14425,7 +15068,7 @@ typedef struct LDKEvent_LDKPaymentPathSuccessful_Body { * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ - struct LDKCOption_PaymentHashZ payment_hash; + struct LDKCOption_ThirtyTwoBytesZ payment_hash; /** * The payment path that was successful. * @@ -14443,7 +15086,7 @@ typedef struct LDKEvent_LDKPaymentPathFailed_Body { * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ - struct LDKCOption_PaymentIdZ payment_id; + struct LDKCOption_ThirtyTwoBytesZ payment_id; /** * The hash that was given to [`ChannelManager::send_payment`]. * @@ -14573,23 +15216,25 @@ typedef struct LDKEvent_LDKSpendableOutputs_Body { * The outputs which you should store as spendable by you. */ struct LDKCVec_SpendableOutputDescriptorZ outputs; + /** + * The `channel_id` indicating which channel the spendable outputs belong to. + * + * This will always be `Some` for events generated by LDK versions 0.0.117 and above. + */ + struct LDKCOption_ThirtyTwoBytesZ channel_id; } LDKEvent_LDKSpendableOutputs_Body; typedef struct LDKEvent_LDKPaymentForwarded_Body { /** * The incoming channel between the previous node and us. This is only `None` for events * generated or serialized by versions prior to 0.0.107. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKThirtyTwoBytes prev_channel_id; + struct LDKCOption_ThirtyTwoBytesZ prev_channel_id; /** * The outgoing channel between the next node and us. This is only `None` for events * generated or serialized by versions prior to 0.0.107. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKThirtyTwoBytes next_channel_id; + struct LDKCOption_ThirtyTwoBytesZ next_channel_id; /** * The fee, in milli-satoshis, which was earned as a result of the payment. * @@ -14639,10 +15284,8 @@ typedef struct LDKEvent_LDKChannelPending_Body { * The `temporary_channel_id` this channel used to be known by during channel establishment. * * Will be `None` for channels created prior to LDK version 0.0.115. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKThirtyTwoBytes former_temporary_channel_id; + struct LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id; /** * The `node_id` of the channel counterparty. */ @@ -14702,6 +15345,20 @@ typedef struct LDKEvent_LDKChannelClosed_Body { * The reason the channel was closed. */ struct LDKClosureReason reason; + /** + * Counterparty in the closed channel. + * + * This field will be `None` for objects serialized prior to LDK 0.0.117. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKPublicKey counterparty_node_id; + /** + * Channel capacity of the closing channel (sats). + * + * This field will be `None` for objects serialized prior to LDK 0.0.117. + */ + struct LDKCOption_u64Z channel_capacity_sats; } LDKEvent_LDKChannelClosed_Body; typedef struct LDKEvent_LDKDiscardFunding_Body { @@ -14866,55 +15523,6 @@ typedef struct LDKCResult_COption_EventZDecodeErrorZ { bool result_ok; } LDKCResult_COption_EventZDecodeErrorZ; -/** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKC2Tuple_BlockHashChannelMonitorZ *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_C2Tuple_BlockHashChannelMonitorZZ; - -/** - * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ - */ -typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKIOError *err; -} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr; - -/** - * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { - /** - * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents; - /** - * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ; - /** * Sub-errors which don't have specific information in them use this type. */ @@ -15217,9 +15825,9 @@ typedef struct MUST_USE_STRUCT LDKPayeePubKey { } LDKPayeePubKey; /** - * The contents of CResult_PayeePubKeyErrorZ + * The contents of CResult_PayeePubKeySecp256k1ErrorZ */ -typedef union LDKCResult_PayeePubKeyErrorZPtr { +typedef union LDKCResult_PayeePubKeySecp256k1ErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -15230,24 +15838,24 @@ typedef union LDKCResult_PayeePubKeyErrorZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ enum LDKSecp256k1Error *err; -} LDKCResult_PayeePubKeyErrorZPtr; +} LDKCResult_PayeePubKeySecp256k1ErrorZPtr; /** - * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation, + * A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation, * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PayeePubKeyErrorZ { +typedef struct LDKCResult_PayeePubKeySecp256k1ErrorZ { /** - * The contents of this CResult_PayeePubKeyErrorZ, accessible via either + * The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PayeePubKeyErrorZPtr contents; + union LDKCResult_PayeePubKeySecp256k1ErrorZPtr contents; /** - * Whether this CResult_PayeePubKeyErrorZ represents a success state. + * Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PayeePubKeyErrorZ; +} LDKCResult_PayeePubKeySecp256k1ErrorZ; @@ -15412,22 +16020,6 @@ typedef struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ { bool result_ok; } LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ; -/** - * A dynamically-allocated array of crate::c_types::Strs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_AddressZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKStr *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_AddressZ; - /** @@ -15763,6 +16355,170 @@ typedef struct LDKCResult_UntrustedStringDecodeErrorZ { bool result_ok; } LDKCResult_UntrustedStringDecodeErrorZ; + + +/** + * Data to construct a [`BlindedHop`] for receiving a payment. This payload is custom to LDK and + * may not be valid if received by another lightning implementation. + */ +typedef struct MUST_USE_STRUCT LDKReceiveTlvs { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeReceiveTlvs *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKReceiveTlvs; + +/** + * The contents of CResult_ReceiveTlvsDecodeErrorZ + */ +typedef union LDKCResult_ReceiveTlvsDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKReceiveTlvs *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_ReceiveTlvsDecodeErrorZPtr; + +/** + * A CResult_ReceiveTlvsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::ReceiveTlvs on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ReceiveTlvsDecodeErrorZ { + /** + * The contents of this CResult_ReceiveTlvsDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ReceiveTlvsDecodeErrorZPtr contents; + /** + * Whether this CResult_ReceiveTlvsDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ReceiveTlvsDecodeErrorZ; + + + +/** + * Parameters for relaying over a given [`BlindedHop`]. + * + * [`BlindedHop`]: crate::blinded_path::BlindedHop + */ +typedef struct MUST_USE_STRUCT LDKPaymentRelay { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativePaymentRelay *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKPaymentRelay; + +/** + * The contents of CResult_PaymentRelayDecodeErrorZ + */ +typedef union LDKCResult_PaymentRelayDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPaymentRelay *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_PaymentRelayDecodeErrorZPtr; + +/** + * A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PaymentRelayDecodeErrorZ { + /** + * The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PaymentRelayDecodeErrorZPtr contents; + /** + * Whether this CResult_PaymentRelayDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PaymentRelayDecodeErrorZ; + + + +/** + * Constraints for relaying over a given [`BlindedHop`]. + * + * [`BlindedHop`]: crate::blinded_path::BlindedHop + */ +typedef struct MUST_USE_STRUCT LDKPaymentConstraints { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativePaymentConstraints *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKPaymentConstraints; + +/** + * The contents of CResult_PaymentConstraintsDecodeErrorZ + */ +typedef union LDKCResult_PaymentConstraintsDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPaymentConstraints *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_PaymentConstraintsDecodeErrorZPtr; + +/** + * A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PaymentConstraintsDecodeErrorZ { + /** + * The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PaymentConstraintsDecodeErrorZPtr contents; + /** + * Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PaymentConstraintsDecodeErrorZ; + /** * An error that may occur when making a payment. */ @@ -15794,9 +16550,9 @@ typedef struct MUST_USE_STRUCT LDKPaymentError { } LDKPaymentError; /** - * The contents of CResult_PaymentIdPaymentErrorZ + * The contents of CResult_ThirtyTwoBytesPaymentErrorZ */ -typedef union LDKCResult_PaymentIdPaymentErrorZPtr { +typedef union LDKCResult_ThirtyTwoBytesPaymentErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -15807,24 +16563,24 @@ typedef union LDKCResult_PaymentIdPaymentErrorZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKPaymentError *err; -} LDKCResult_PaymentIdPaymentErrorZPtr; +} LDKCResult_ThirtyTwoBytesPaymentErrorZPtr; /** - * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation, + * A CResult_ThirtyTwoBytesPaymentErrorZ represents the result of a fallible operation, * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentIdPaymentErrorZ { +typedef struct LDKCResult_ThirtyTwoBytesPaymentErrorZ { /** - * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either + * The contents of this CResult_ThirtyTwoBytesPaymentErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentIdPaymentErrorZPtr contents; + union LDKCResult_ThirtyTwoBytesPaymentErrorZPtr contents; /** - * Whether this CResult_PaymentIdPaymentErrorZ represents a success state. + * Whether this CResult_ThirtyTwoBytesPaymentErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentIdPaymentErrorZ; +} LDKCResult_ThirtyTwoBytesPaymentErrorZ; /** * The contents of CResult_NonePaymentErrorZ @@ -15859,9 +16615,72 @@ typedef struct LDKCResult_NonePaymentErrorZ { } LDKCResult_NonePaymentErrorZ; /** - * The contents of CResult_StringErrorZ + * An error that may occur when sending a payment probe. + */ +typedef enum LDKProbingError_Tag { + /** + * An error resulting from the provided [`Bolt11Invoice`]. + */ + LDKProbingError_Invoice, + /** + * An error occurring when sending a payment probe. + */ + LDKProbingError_Sending, + /** + * Must be last for serialization purposes + */ + LDKProbingError_Sentinel, +} LDKProbingError_Tag; + +typedef struct MUST_USE_STRUCT LDKProbingError { + LDKProbingError_Tag tag; + union { + struct { + struct LDKStr invoice; + }; + struct { + struct LDKProbeSendFailure sending; + }; + }; +} LDKProbingError; + +/** + * The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ + */ +typedef union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKProbingError *err; +} LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr; + +/** + * A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning_invoice::payment::ProbingError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { + /** + * The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr contents; + /** + * Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ; + +/** + * The contents of CResult_StrSecp256k1ErrorZ */ -typedef union LDKCResult_StringErrorZPtr { +typedef union LDKCResult_StrSecp256k1ErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -15872,24 +16691,24 @@ typedef union LDKCResult_StringErrorZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ enum LDKSecp256k1Error *err; -} LDKCResult_StringErrorZPtr; +} LDKCResult_StrSecp256k1ErrorZPtr; /** - * A CResult_StringErrorZ represents the result of a fallible operation, + * A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation, * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_StringErrorZ { +typedef struct LDKCResult_StrSecp256k1ErrorZ { /** - * The contents of this CResult_StringErrorZ, accessible via either + * The contents of this CResult_StrSecp256k1ErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_StringErrorZPtr contents; + union LDKCResult_StrSecp256k1ErrorZPtr contents; /** - * Whether this CResult_StringErrorZ represents a success state. + * Whether this CResult_StrSecp256k1ErrorZ represents a success state. */ bool result_ok; -} LDKCResult_StringErrorZ; +} LDKCResult_StrSecp256k1ErrorZ; @@ -15943,6 +16762,20 @@ typedef struct LDKCResult_OnionMessagePathNoneZ { bool result_ok; } LDKCResult_OnionMessagePathNoneZ; +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_PublicKeyOnionMessageZ { + /** + * The element at position 0 + */ + struct LDKPublicKey a; + /** + * The element at position 1 + */ + struct LDKOnionMessage b; +} LDKC2Tuple_PublicKeyOnionMessageZ; + /** * Errors that may occur when [sending an onion message]. * @@ -16003,6 +16836,39 @@ typedef struct MUST_USE_STRUCT LDKSendError { }; } LDKSendError; +/** + * The contents of CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ + */ +typedef union LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKC2Tuple_PublicKeyOnionMessageZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKSendError *err; +} LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr; + +/** + * A CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ on success and a crate::lightning::onion_message::messenger::SendError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ { + /** + * The contents of this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr contents; + /** + * Whether this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ; + /** * The contents of CResult_NoneSendErrorZ */ @@ -16067,6 +16933,38 @@ typedef struct LDKCResult_BlindedPathNoneZ { bool result_ok; } LDKCResult_BlindedPathNoneZ; +/** + * The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ + */ +typedef union LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr; + +/** + * A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { + /** + * The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr contents; + /** + * Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ; + /** * The contents of CResult_BlindedPathDecodeErrorZ */ @@ -16409,6 +17307,85 @@ typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ { uintptr_t datalen; } LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ; +/** + * Provides an interface that allows storage and retrieval of persisted values that are associated + * with given keys. + * + * In order to avoid collisions the key space is segmented based on the given `primary_namespace`s + * and `secondary_namespace`s. Implementations of this trait are free to handle them in different + * ways, as long as per-namespace key uniqueness is asserted. + * + * Keys and namespaces are required to be valid ASCII strings in the range of + * [`KVSTORE_NAMESPACE_KEY_ALPHABET`] and no longer than [`KVSTORE_NAMESPACE_KEY_MAX_LEN`]. Empty + * primary namespaces and secondary namespaces (`\"\"`) are assumed to be a valid, however, if + * `primary_namespace` is empty, `secondary_namespace` is required to be empty, too. This means + * that concerns should always be separated by primary namespace first, before secondary + * namespaces are used. While the number of primary namespaces will be relatively small and is + * determined at compile time, there may be many secondary namespaces per primary namespace. Note + * that per-namespace uniqueness needs to also hold for keys *and* namespaces in any given + * namespace, i.e., conflicts between keys and equally named + * primary namespaces/secondary namespaces must be avoided. + * + * **Note:** Users migrating custom persistence backends from the pre-v0.0.117 `KVStorePersister` + * interface can use a concatenation of `[{primary_namespace}/[{secondary_namespace}/]]{key}` to + * recover a `key` compatible with the data model previously assumed by `KVStorePersister::persist`. + */ +typedef struct LDKKVStore { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Returns the data stored for the given `primary_namespace`, `secondary_namespace`, and + * `key`. + * + * Returns an [`ErrorKind::NotFound`] if the given `key` could not be found in the given + * `primary_namespace` and `secondary_namespace`. + * + * [`ErrorKind::NotFound`]: io::ErrorKind::NotFound + */ + struct LDKCResult_CVec_u8ZIOErrorZ (*read)(const void *this_arg, struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key); + /** + * Persists the given data under the given `key`. + * + * Will create the given `primary_namespace` and `secondary_namespace` if not already present + * in the store. + */ + struct LDKCResult_NoneIOErrorZ (*write)(const void *this_arg, struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key, struct LDKu8slice buf); + /** + * Removes any data that had previously been persisted under the given `key`. + * + * If the `lazy` flag is set to `true`, the backend implementation might choose to lazily + * remove the given `key` at some point in time after the method returns, e.g., as part of an + * eventual batch deletion of multiple keys. As a consequence, subsequent calls to + * [`KVStore::list`] might include the removed key until the changes are actually persisted. + * + * Note that while setting the `lazy` flag reduces the I/O burden of multiple subsequent + * `remove` calls, it also influences the atomicity guarantees as lazy `remove`s could + * potentially get lost on crash after the method returns. Therefore, this flag should only be + * set for `remove` operations that can be safely replayed at a later time. + * + * Returns successfully if no data will be stored for the given `primary_namespace`, + * `secondary_namespace`, and `key`, independently of whether it was present before its + * invokation or not. + */ + struct LDKCResult_NoneIOErrorZ (*remove)(const void *this_arg, struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key, bool lazy); + /** + * Returns a list of keys that are stored under the given `secondary_namespace` in + * `primary_namespace`. + * + * Returns the keys in arbitrary order, so users requiring a particular order need to sort the + * returned keys. Returns an empty list if `primary_namespace` or `secondary_namespace` is unknown. + */ + struct LDKCResult_CVec_StrZIOErrorZ (*list)(const void *this_arg, struct LDKStr primary_namespace, struct LDKStr secondary_namespace); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKKVStore; + /** * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk. */ @@ -16421,15 +17398,15 @@ typedef struct LDKPersister { /** * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed. */ - struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager); + struct LDKCResult_NoneIOErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager); /** * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed. */ - struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph); + struct LDKCResult_NoneIOErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph); /** * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed. */ - struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer); + struct LDKCResult_NoneIOErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -16439,6 +17416,233 @@ typedef struct LDKPersister { +/** + * Implements [`Persist`] in a way that writes and reads both [`ChannelMonitor`]s and + * [`ChannelMonitorUpdate`]s. + * + * # Overview + * + * The main benefit this provides over the [`KVStore`]'s [`Persist`] implementation is decreased + * I/O bandwidth and storage churn, at the expense of more IOPS (including listing, reading, and + * deleting) and complexity. This is because it writes channel monitor differential updates, + * whereas the other (default) implementation rewrites the entire monitor on each update. For + * routing nodes, updates can happen many times per second to a channel, and monitors can be tens + * of megabytes (or more). Updates can be as small as a few hundred bytes. + * + * Note that monitors written with `MonitorUpdatingPersister` are _not_ backward-compatible with + * the default [`KVStore`]'s [`Persist`] implementation. They have a prepended byte sequence, + * [`MONITOR_UPDATING_PERSISTER_PREPEND_SENTINEL`], applied to prevent deserialization with other + * persisters. This is because monitors written by this struct _may_ have unapplied updates. In + * order to downgrade, you must ensure that all updates are applied to the monitor, and remove the + * sentinel bytes. + * + * # Storing monitors + * + * Monitors are stored by implementing the [`Persist`] trait, which has two functions: + * + * - [`Persist::persist_new_channel`], which persists whole [`ChannelMonitor`]s. + * - [`Persist::update_persisted_channel`], which persists only a [`ChannelMonitorUpdate`] + * + * Whole [`ChannelMonitor`]s are stored in the [`CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE`], + * using the familiar encoding of an [`OutPoint`] (for example, `[SOME-64-CHAR-HEX-STRING]_1`). + * + * Each [`ChannelMonitorUpdate`] is stored in a dynamic secondary namespace, as follows: + * + * - primary namespace: [`CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE`] + * - secondary namespace: [the monitor's encoded outpoint name] + * + * Under that secondary namespace, each update is stored with a number string, like `21`, which + * represents its `update_id` value. + * + * For example, consider this channel, named for its transaction ID and index, or [`OutPoint`]: + * + * - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef` + * - Index: `1` + * + * Full channel monitors would be stored at a single key: + * + * `[CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1` + * + * Updates would be stored as follows (with `/` delimiting primary_namespace/secondary_namespace/key): + * + * ```text + * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/1 + * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/2 + * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/3 + * ``` + * ... and so on. + * + * # Reading channel state from storage + * + * Channel state can be reconstructed by calling + * [`MonitorUpdatingPersister::read_all_channel_monitors_with_updates`]. Alternatively, users can + * list channel monitors themselves and load channels individually using + * [`MonitorUpdatingPersister::read_channel_monitor_with_updates`]. + * + * ## EXTREMELY IMPORTANT + * + * It is extremely important that your [`KVStore::read`] implementation uses the + * [`io::ErrorKind::NotFound`] variant correctly: that is, when a file is not found, and _only_ in + * that circumstance (not when there is really a permissions error, for example). This is because + * neither channel monitor reading function lists updates. Instead, either reads the monitor, and + * using its stored `update_id`, synthesizes update storage keys, and tries them in sequence until + * one is not found. All _other_ errors will be bubbled up in the function's [`Result`]. + * + * # Pruning stale channel updates + * + * Stale updates are pruned when a full monitor is written. The old monitor is first read, and if + * that succeeds, updates in the range between the old and new monitors are deleted. The `lazy` + * flag is used on the [`KVStore::remove`] method, so there are no guarantees that the deletions + * will complete. However, stale updates are not a problem for data integrity, since updates are + * only read that are higher than the stored [`ChannelMonitor`]'s `update_id`. + * + * If you have many stale updates stored (such as after a crash with pending lazy deletes), and + * would like to get rid of them, consider using the + * [`MonitorUpdatingPersister::cleanup_stale_updates`] function. + */ +typedef struct MUST_USE_STRUCT LDKMonitorUpdatingPersister { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMonitorUpdatingPersister *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKMonitorUpdatingPersister; + +/** + * `Persist` defines behavior for persisting channel monitors: this could mean + * writing once to disk, and/or uploading to one or more backup services. + * + * Persistence can happen in one of two ways - synchronously completing before the trait method + * calls return or asynchronously in the background. + * + * # For those implementing synchronous persistence + * + * * If persistence completes fully (including any relevant `fsync()` calls), the implementation + * should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal channel operation + * should continue. + * + * * If persistence fails for some reason, implementations should consider returning + * [`ChannelMonitorUpdateStatus::InProgress`] and retry all pending persistence operations in + * the background with [`ChainMonitor::list_pending_monitor_updates`] and + * [`ChainMonitor::get_monitor`]. + * + * Once a full [`ChannelMonitor`] has been persisted, all pending updates for that channel can + * be marked as complete via [`ChainMonitor::channel_monitor_updated`]. + * + * If at some point no further progress can be made towards persisting the pending updates, the + * node should simply shut down. + * + * * If the persistence has failed and cannot be retried further (e.g. because of an outage), + * [`ChannelMonitorUpdateStatus::UnrecoverableError`] can be used, though this will result in + * an immediate panic and future operations in LDK generally failing. + * + * # For those implementing asynchronous persistence + * + * All calls should generally spawn a background task and immediately return + * [`ChannelMonitorUpdateStatus::InProgress`]. Once the update completes, + * [`ChainMonitor::channel_monitor_updated`] should be called with the corresponding + * [`MonitorUpdateId`]. + * + * Note that unlike the direct [`chain::Watch`] interface, + * [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs. + * + * If at some point no further progress can be made towards persisting a pending update, the node + * should simply shut down. Until then, the background task should either loop indefinitely, or + * persistence should be regularly retried with [`ChainMonitor::list_pending_monitor_updates`] + * and [`ChainMonitor::get_monitor`] (note that if a full monitor is persisted all pending + * monitor updates may be marked completed). + * + * # Using remote watchtowers + * + * Watchtowers may be updated as a part of an implementation of this trait, utilizing the async + * update process described above while the watchtower is being updated. The following methods are + * provided for bulding transactions for a watchtower: + * [`ChannelMonitor::initial_counterparty_commitment_tx`], + * [`ChannelMonitor::counterparty_commitment_txs_from_update`], + * [`ChannelMonitor::sign_to_local_justice_tx`], [`TrustedCommitmentTransaction::revokeable_output_index`], + * [`TrustedCommitmentTransaction::build_to_local_justice_tx`]. + * + * [`TrustedCommitmentTransaction::revokeable_output_index`]: crate::ln::chan_utils::TrustedCommitmentTransaction::revokeable_output_index + * [`TrustedCommitmentTransaction::build_to_local_justice_tx`]: crate::ln::chan_utils::TrustedCommitmentTransaction::build_to_local_justice_tx + */ +typedef struct LDKPersist { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is + * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup. + * + * The data can be stored any way you want, but the identifier provided by LDK is the + * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint + * and the stored channel data). Note that you **must** persist every new monitor to disk. + * + * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`], + * if you return [`ChannelMonitorUpdateStatus::InProgress`]. + * + * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor` + * and [`ChannelMonitorUpdateStatus`] for requirements when returning errors. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`Writeable::write`]: crate::util::ser::Writeable::write + */ + enum LDKChannelMonitorUpdateStatus (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id); + /** + * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given + * update. + * + * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the + * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more + * details. + * + * During blockchain synchronization operations, and in some rare cases, this may be called with + * no [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted. + * Note that after the full [`ChannelMonitor`] is persisted any previous + * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be + * applied to the persisted [`ChannelMonitor`] as they were already applied. + * + * If an implementer chooses to persist the updates only, they need to make + * sure that all the updates are applied to the `ChannelMonitors` *before* + * the set of channel monitors is given to the `ChannelManager` + * deserialization routine. See [`ChannelMonitor::update_monitor`] for + * applying a monitor update to a monitor. If full `ChannelMonitors` are + * persisted, then there is no need to persist individual updates. + * + * Note that there could be a performance tradeoff between persisting complete + * channel monitors on every update vs. persisting only updates and applying + * them in batches. The size of each monitor grows `O(number of state updates)` + * whereas updates are small and `O(1)`. + * + * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`], + * if you return [`ChannelMonitorUpdateStatus::InProgress`]. + * + * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`, + * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and + * [`ChannelMonitorUpdateStatus`] for requirements when returning errors. + * + * [`Writeable::write`]: crate::util::ser::Writeable::write + * + * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + enum LDKChannelMonitorUpdateStatus (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, struct LDKChannelMonitorUpdate update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKPersist; + + + /** * A string that displays only printable characters, replacing control characters with * [`core::char::REPLACEMENT_CHARACTER`]. @@ -16762,7 +17966,7 @@ typedef struct LDKConfirm { * [`transactions_confirmed`]: Self::transactions_confirmed * [`transaction_unconfirmed`]: Self::transaction_unconfirmed */ - struct LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ (*get_relevant_txids)(const void *this_arg); + struct LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ (*get_relevant_txids)(const void *this_arg); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -16770,97 +17974,6 @@ typedef struct LDKConfirm { void (*free)(void *this_arg); } LDKConfirm; -/** - * `Persist` defines behavior for persisting channel monitors: this could mean - * writing once to disk, and/or uploading to one or more backup services. - * - * Each method can return three possible values: - * * If persistence (including any relevant `fsync()` calls) happens immediately, the - * implementation should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal - * channel operation should continue. - * * If persistence happens asynchronously, implementations should first ensure the - * [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return - * [`ChannelMonitorUpdateStatus::InProgress`] while the update continues in the background. - * Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be called with - * the corresponding [`MonitorUpdateId`]. - * - * Note that unlike the direct [`chain::Watch`] interface, - * [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs. - * - * * If persistence fails for some reason, implementations should return - * [`ChannelMonitorUpdateStatus::PermanentFailure`], in which case the channel will likely be - * closed without broadcasting the latest state. See - * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more details. - */ -typedef struct LDKPersist { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; - /** - * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is - * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup. - * - * The data can be stored any way you want, but the identifier provided by LDK is the - * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint - * and the stored channel data). Note that you **must** persist every new monitor to disk. - * - * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`], - * if you return [`ChannelMonitorUpdateStatus::InProgress`]. - * - * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor` - * and [`ChannelMonitorUpdateStatus`] for requirements when returning errors. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`Writeable::write`]: crate::util::ser::Writeable::write - */ - enum LDKChannelMonitorUpdateStatus (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id); - /** - * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given - * update. - * - * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the - * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more - * details. - * - * During blockchain synchronization operations, this may be called with no - * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted. - * Note that after the full [`ChannelMonitor`] is persisted any previous - * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be - * applied to the persisted [`ChannelMonitor`] as they were already applied. - * - * If an implementer chooses to persist the updates only, they need to make - * sure that all the updates are applied to the `ChannelMonitors` *before* - * the set of channel monitors is given to the `ChannelManager` - * deserialization routine. See [`ChannelMonitor::update_monitor`] for - * applying a monitor update to a monitor. If full `ChannelMonitors` are - * persisted, then there is no need to persist individual updates. - * - * Note that there could be a performance tradeoff between persisting complete - * channel monitors on every update vs. persisting only updates and applying - * them in batches. The size of each monitor grows `O(number of state updates)` - * whereas updates are small and `O(1)`. - * - * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`], - * if you return [`ChannelMonitorUpdateStatus::InProgress`]. - * - * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`, - * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and - * [`ChannelMonitorUpdateStatus`] for requirements when returning errors. - * - * [`Writeable::write`]: crate::util::ser::Writeable::write - * - * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - enum LDKChannelMonitorUpdateStatus (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, struct LDKChannelMonitorUpdate update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id); - /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. - */ - void (*free)(void *this_arg); -} LDKPersist; - /** @@ -16979,6 +18092,53 @@ typedef struct LDKEventsProvider { void (*free)(void *this_arg); } LDKEventsProvider; +/** + * This enum is used to specify which error data to send to peers when failing back an HTLC + * using [`ChannelManager::fail_htlc_backwards_with_reason`]. + * + * For more info on failure codes, see . + */ +typedef enum LDKFailureCode_Tag { + /** + * We had a temporary error processing the payment. Useful if no other error codes fit + * and you want to indicate that the payer may want to retry. + */ + LDKFailureCode_TemporaryNodeFailure, + /** + * We have a required feature which was not in this onion. For example, you may require + * some additional metadata that was not provided with this payment. + */ + LDKFailureCode_RequiredNodeFeatureMissing, + /** + * You may wish to use this when a `payment_preimage` is unknown, or the CLTV expiry of + * the HTLC is too close to the current block height for safe handling. + * Using this failure code in [`ChannelManager::fail_htlc_backwards_with_reason`] is + * equivalent to calling [`ChannelManager::fail_htlc_backwards`]. + */ + LDKFailureCode_IncorrectOrUnknownPaymentDetails, + /** + * We failed to process the payload after the onion was decrypted. You may wish to + * use this when receiving custom HTLC TLVs with even type numbers that you don't recognize. + * + * If available, the tuple data may include the type number and byte offset in the + * decrypted byte stream where the failure occurred. + */ + LDKFailureCode_InvalidOnionPayload, + /** + * Must be last for serialization purposes + */ + LDKFailureCode_Sentinel, +} LDKFailureCode_Tag; + +typedef struct MUST_USE_STRUCT LDKFailureCode { + LDKFailureCode_Tag tag; + union { + struct { + struct LDKCOption_C2Tuple_u64u16ZZ invalid_onion_payload; + }; + }; +} LDKFailureCode; + /** @@ -17003,43 +18163,6 @@ typedef struct MUST_USE_STRUCT LDKChainParameters { bool is_owned; } LDKChainParameters; -/** - * Strategies available to retry payment path failures. - */ -typedef enum LDKRetry_Tag { - /** - * Max number of attempts to retry payment. - * - * Each attempt may be multiple HTLCs along multiple paths if the router decides to split up a - * retry, and may retry multiple failed HTLCs at once if they failed around the same time and - * were retried along a route from a single call to [`Router::find_route_with_id`]. - */ - LDKRetry_Attempts, - /** - * Time elapsed before abandoning retries for a payment. At least one attempt at payment is made; - * see [`PaymentParameters::expiry_time`] to avoid any attempt at payment after a specific time. - * - * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time - */ - LDKRetry_Timeout, - /** - * Must be last for serialization purposes - */ - LDKRetry_Sentinel, -} LDKRetry_Tag; - -typedef struct MUST_USE_STRUCT LDKRetry { - LDKRetry_Tag tag; - union { - struct { - uintptr_t attempts; - }; - struct { - uint64_t timeout; - }; - }; -} LDKRetry; - /** * A trait indicating an object may generate message send events */ @@ -17221,7 +18344,7 @@ typedef struct LDKChannelMessageHandler { * If it's `None`, then no particular network chain hash compatibility will be enforced when * connecting to peers. */ - struct LDKCOption_CVec_ChainHashZZ (*get_genesis_hashes)(const void *this_arg); + struct LDKCOption_CVec_ThirtyTwoBytesZZ (*get_genesis_hashes)(const void *this_arg); /** * Implementation of MessageSendEventsProvider for this object. */ @@ -17307,6 +18430,26 @@ typedef struct MUST_USE_STRUCT LDKExpandedKey { bool is_owned; } LDKExpandedKey; + + +/** + * Packet of hop data for next peer + */ +typedef struct MUST_USE_STRUCT LDKPacket { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativePacket *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKPacket; + /** * A 3-byte byte array. */ @@ -17881,106 +19024,90 @@ typedef struct LDKWitnessVersion { /** - * A semantically valid [`Bolt12Invoice`] that hasn't been signed. - */ -typedef struct MUST_USE_STRUCT LDKUnsignedBolt12Invoice { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeUnsignedBolt12Invoice *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKUnsignedBolt12Invoice; - - - -/** - * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or + * another currency. */ -typedef struct MUST_USE_STRUCT LDKErroneousField { +typedef struct MUST_USE_STRUCT LDKAmount { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeErroneousField *inner; + LDKnativeAmount *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKErroneousField; +} LDKAmount; /** - * A semantically valid [`InvoiceRequest`] that hasn't been signed. + * Quantity of items supported by an [`Offer`]. */ -typedef struct MUST_USE_STRUCT LDKUnsignedInvoiceRequest { +typedef struct MUST_USE_STRUCT LDKQuantity { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeUnsignedInvoiceRequest *inner; + LDKnativeQuantity *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKUnsignedInvoiceRequest; +} LDKQuantity; /** - * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or - * another currency. + * A hash for use in a specific context by tweaking with a context-dependent tag as per [BIP 340] + * and computed over the merkle root of a TLV stream to sign as defined in [BOLT 12]. + * + * [BIP 340]: https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki + * [BOLT 12]: https://github.com/rustyrussell/lightning-rfc/blob/guilt/offers/12-offer-encoding.md#signature-calculation */ -typedef struct MUST_USE_STRUCT LDKAmount { +typedef struct MUST_USE_STRUCT LDKTaggedHash { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeAmount *inner; + LDKnativeTaggedHash *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKAmount; +} LDKTaggedHash; /** - * Quantity of items supported by an [`Offer`]. + * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -typedef struct MUST_USE_STRUCT LDKQuantity { +typedef struct MUST_USE_STRUCT LDKErroneousField { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeQuantity *inner; + LDKnativeErroneousField *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKQuantity; +} LDKErroneousField; @@ -18153,12 +19280,12 @@ typedef struct MUST_USE_STRUCT LDKDefaultRouter { /** - * [`Score`] implementation that factors in in-flight HTLC liquidity. + * [`ScoreLookUp`] implementation that factors in in-flight HTLC liquidity. * - * Useful for custom [`Router`] implementations to wrap their [`Score`] on-the-fly when calling + * Useful for custom [`Router`] implementations to wrap their [`ScoreLookUp`] on-the-fly when calling * [`find_route`]. * - * [`Score`]: crate::routing::scoring::Score + * [`ScoreLookUp`]: crate::routing::scoring::ScoreLookUp */ typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs { /** @@ -18246,6 +19373,39 @@ typedef struct MUST_USE_STRUCT LDKPayee { }; } LDKPayee; +/** + * A trait which can both lookup and update routing channel penalty scores. + * + * This is used in places where both bounds are required and implemented for all types which + * implement [`ScoreLookUp`] and [`ScoreUpdate`]. + * + * Bindings users may need to manually implement this for their custom scoring implementations. + */ +typedef struct LDKScore { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Implementation of ScoreLookUp for this object. + */ + struct LDKScoreLookUp ScoreLookUp; + /** + * Implementation of ScoreUpdate for this object. + */ + struct LDKScoreUpdate ScoreUpdate; + /** + * Serialize the object into a byte array + */ + struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKScore; + /** @@ -18271,20 +19431,40 @@ typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore { /** * A locked `MultiThreadedLockableScore`. */ -typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLock { +typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLockRead { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMultiThreadedScoreLockRead *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKMultiThreadedScoreLockRead; + + + +/** + * A locked `MultiThreadedLockableScore`. + */ +typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLockWrite { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeMultiThreadedScoreLock *inner; + LDKnativeMultiThreadedScoreLockWrite *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKMultiThreadedScoreLock; +} LDKMultiThreadedScoreLockWrite; @@ -18481,6 +19661,7 @@ typedef struct LDKMessageRouter { * &custom_message_handler * ); * + * # #[derive(Clone)] * # struct YourCustomMessage {} * impl Writeable for YourCustomMessage { * \tfn write(&self, w: &mut W) -> Result<(), io::Error> { @@ -18592,22 +19773,42 @@ typedef struct MUST_USE_STRUCT LDKOnionMessageContents { /** - * The parameters required to derive a channel signer via [`SignerProvider`]. + * An intermediate node, its outbound channel, and relay parameters. */ -typedef struct MUST_USE_STRUCT LDKChannelDerivationParameters { +typedef struct MUST_USE_STRUCT LDKForwardNode { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelDerivationParameters *inner; + LDKnativeForwardNode *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKChannelDerivationParameters; +} LDKForwardNode; + + + +/** + * Data to construct a [`BlindedHop`] for forwarding a payment. + */ +typedef struct MUST_USE_STRUCT LDKForwardTlvs { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeForwardTlvs *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKForwardTlvs; /** * An abstraction over a bitcoin wallet that can perform coin selection over a set of UTXOs and can @@ -18680,7 +19881,7 @@ typedef struct LDKWalletSource { * Returns a script to use for change above dust resulting from a successful coin selection * attempt. */ - struct LDKCResult_ScriptNoneZ (*get_change_script)(const void *this_arg); + struct LDKCResult_CVec_u8ZNoneZ (*get_change_script)(const void *this_arg); /** * Signs and provides the full [`TxIn::script_sig`] and [`TxIn::witness`] for all inputs within * the transaction known to the wallet (i.e., any provided via @@ -18743,33 +19944,22 @@ typedef struct MUST_USE_STRUCT LDKBumpTransactionEventHandler { /** - * FilesystemPersister persists channel data on disk, where each channel's - * data is stored in a file named after its funding outpoint. - * - * Warning: this module does the best it can with calls to persist data, but it - * can only guarantee that the data is passed to the drive. It is up to the - * drive manufacturers to do the actual persistence properly, which they often - * don't (especially on consumer-grade hardware). Therefore, it is up to the - * user to validate their entire storage stack, to ensure the writes are - * persistent. - * Corollary: especially when dealing with larger amounts of money, it is best - * practice to have multiple channel data backups and not rely only on one - * FilesystemPersister. + * A [`KVStore`] implementation that writes to and reads from the file system. */ -typedef struct MUST_USE_STRUCT LDKFilesystemPersister { +typedef struct MUST_USE_STRUCT LDKFilesystemStore { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeFilesystemPersister *inner; + LDKnativeFilesystemStore *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKFilesystemPersister; +} LDKFilesystemStore; @@ -19005,6 +20195,8 @@ typedef struct MUST_USE_STRUCT LDKFallback { extern const uintptr_t MAX_BUF_SIZE; +extern const uintptr_t KVSTORE_NAMESPACE_KEY_MAX_LEN; + extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; extern const uint32_t FEERATE_FLOOR_SATS_PER_KW; @@ -19152,25 +20344,25 @@ const void *__unmangle_inner_ptr(const void *ptr); #endif /** - * Constructs a new COption_DurationZ containing a u64 + * Constructs a new COption_u64Z containing a u64 */ -struct LDKCOption_DurationZ COption_DurationZ_some(uint64_t o); +struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); /** - * Constructs a new COption_DurationZ containing nothing + * Constructs a new COption_u64Z containing nothing */ -struct LDKCOption_DurationZ COption_DurationZ_none(void); +struct LDKCOption_u64Z COption_u64Z_none(void); /** * Frees any resources associated with the u64, if we are in the Some state */ -void COption_DurationZ_free(struct LDKCOption_DurationZ _res); +void COption_u64Z_free(struct LDKCOption_u64Z _res); /** - * Creates a new COption_DurationZ which has the same data as `orig` + * Creates a new COption_u64Z which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_DurationZ COption_DurationZ_clone(const struct LDKCOption_DurationZ *NONNULL_PTR orig); +struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -19178,51 +20370,56 @@ struct LDKCOption_DurationZ COption_DurationZ_clone(const struct LDKCOption_Dura void CVec_BlindedPathZ_free(struct LDKCVec_BlindedPathZ _res); /** - * Constructs a new COption_u64Z containing a u64 + * Creates a new CResult_RefundBolt12ParseErrorZ in the success state. */ -struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); +struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_ok(struct LDKRefund o); /** - * Constructs a new COption_u64Z containing nothing + * Creates a new CResult_RefundBolt12ParseErrorZ in the error state. */ -struct LDKCOption_u64Z COption_u64Z_none(void); +struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_err(struct LDKBolt12ParseError e); /** - * Frees any resources associated with the u64, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_u64Z_free(struct LDKCOption_u64Z _res); +bool CResult_RefundBolt12ParseErrorZ_is_ok(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR o); /** - * Creates a new COption_u64Z which has the same data as `orig` + * Frees any resources used by the CResult_RefundBolt12ParseErrorZ. + */ +void CResult_RefundBolt12ParseErrorZ_free(struct LDKCResult_RefundBolt12ParseErrorZ _res); + +/** + * Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); +struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_clone(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RefundBolt12ParseErrorZ in the success state. + * Creates a new CResult_RetryDecodeErrorZ in the success state. */ -struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_ok(struct LDKRefund o); +struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_ok(struct LDKRetry o); /** - * Creates a new CResult_RefundBolt12ParseErrorZ in the error state. + * Creates a new CResult_RetryDecodeErrorZ in the error state. */ -struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_err(struct LDKBolt12ParseError e); +struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RefundBolt12ParseErrorZ_is_ok(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR o); +bool CResult_RetryDecodeErrorZ_is_ok(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RefundBolt12ParseErrorZ. + * Frees any resources used by the CResult_RetryDecodeErrorZ. */ -void CResult_RefundBolt12ParseErrorZ_free(struct LDKCResult_RefundBolt12ParseErrorZ _res); +void CResult_RetryDecodeErrorZ_free(struct LDKCResult_RetryDecodeErrorZ _res); /** - * Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig` + * Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_clone(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR orig); +struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_clone(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_NoneAPIErrorZ in the success state. @@ -19261,25 +20458,25 @@ void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); /** - * Constructs a new COption_PaymentSecretZ containing a crate::c_types::ThirtyTwoBytes + * Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes */ -struct LDKCOption_PaymentSecretZ COption_PaymentSecretZ_some(struct LDKThirtyTwoBytes o); +struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_some(struct LDKThirtyTwoBytes o); /** - * Constructs a new COption_PaymentSecretZ containing nothing + * Constructs a new COption_ThirtyTwoBytesZ containing nothing */ -struct LDKCOption_PaymentSecretZ COption_PaymentSecretZ_none(void); +struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_none(void); /** * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state */ -void COption_PaymentSecretZ_free(struct LDKCOption_PaymentSecretZ _res); +void COption_ThirtyTwoBytesZ_free(struct LDKCOption_ThirtyTwoBytesZ _res); /** - * Creates a new COption_PaymentSecretZ which has the same data as `orig` + * Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_PaymentSecretZ COption_PaymentSecretZ_clone(const struct LDKCOption_PaymentSecretZ *NONNULL_PTR orig); +struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_clone(const struct LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -19333,6 +20530,105 @@ void CResult_RecipientOnionFieldsDecodeErrorZ_free(struct LDKCResult_RecipientOn */ struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_clone(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_u64CVec_u8ZZ C2Tuple_u64CVec_u8ZZ_clone(const struct LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_u64CVec_u8ZZ from the contained elements. + */ +struct LDKC2Tuple_u64CVec_u8ZZ C2Tuple_u64CVec_u8ZZ_new(uint64_t a, struct LDKCVec_u8Z b); + +/** + * Frees any resources used by the C2Tuple_u64CVec_u8ZZ. + */ +void C2Tuple_u64CVec_u8ZZ_free(struct LDKC2Tuple_u64CVec_u8ZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_u64CVec_u8ZZZ_free(struct LDKCVec_C2Tuple_u64CVec_u8ZZZ _res); + +/** + * Creates a new CResult_RecipientOnionFieldsNoneZ in the success state. + */ +struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_ok(struct LDKRecipientOnionFields o); + +/** + * Creates a new CResult_RecipientOnionFieldsNoneZ in the error state. + */ +struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RecipientOnionFieldsNoneZ_is_ok(const struct LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RecipientOnionFieldsNoneZ. + */ +void CResult_RecipientOnionFieldsNoneZ_free(struct LDKCResult_RecipientOnionFieldsNoneZ _res); + +/** + * Creates a new CResult_RecipientOnionFieldsNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_clone(const struct LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res); + +/** + * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ + */ +struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_some(struct LDKCVec_ThirtyTwoBytesZ o); + +/** + * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing + */ +struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state + */ +void COption_CVec_ThirtyTwoBytesZZ_free(struct LDKCOption_CVec_ThirtyTwoBytesZZ _res); + +/** + * Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_clone(const struct LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ThirtyTwoBytesNoneZ in the success state. + */ +struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult_ThirtyTwoBytesNoneZ in the error state. + */ +struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ThirtyTwoBytesNoneZ_is_ok(const struct LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ThirtyTwoBytesNoneZ. + */ +void CResult_ThirtyTwoBytesNoneZ_free(struct LDKCResult_ThirtyTwoBytesNoneZ _res); + +/** + * Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_clone(const struct LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR orig); + /** * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state. */ @@ -19448,72 +20744,67 @@ void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescript void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); /** - * Constructs a new COption_PackedLockTimeZ containing a u32 + * Constructs a new COption_u32Z containing a u32 */ -struct LDKCOption_PackedLockTimeZ COption_PackedLockTimeZ_some(uint32_t o); +struct LDKCOption_u32Z COption_u32Z_some(uint32_t o); /** - * Constructs a new COption_PackedLockTimeZ containing nothing + * Constructs a new COption_u32Z containing nothing */ -struct LDKCOption_PackedLockTimeZ COption_PackedLockTimeZ_none(void); +struct LDKCOption_u32Z COption_u32Z_none(void); /** * Frees any resources associated with the u32, if we are in the Some state */ -void COption_PackedLockTimeZ_free(struct LDKCOption_PackedLockTimeZ _res); +void COption_u32Z_free(struct LDKCOption_u32Z _res); /** - * Creates a new COption_PackedLockTimeZ which has the same data as `orig` + * Creates a new COption_u32Z which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_PackedLockTimeZ COption_PackedLockTimeZ_clone(const struct LDKCOption_PackedLockTimeZ *NONNULL_PTR orig); +struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_PartiallySignedTransactionusizeZ C2Tuple_PartiallySignedTransactionusizeZ_clone(const struct LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR orig); +struct LDKC2Tuple_CVec_u8ZusizeZ C2Tuple_CVec_u8ZusizeZ_clone(const struct LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_PartiallySignedTransactionusizeZ from the contained elements. + * Creates a new C2Tuple_CVec_u8ZusizeZ from the contained elements. */ -struct LDKC2Tuple_PartiallySignedTransactionusizeZ C2Tuple_PartiallySignedTransactionusizeZ_new(struct LDKCVec_u8Z a, uintptr_t b); +struct LDKC2Tuple_CVec_u8ZusizeZ C2Tuple_CVec_u8ZusizeZ_new(struct LDKCVec_u8Z a, uintptr_t b); /** - * Frees any resources used by the C2Tuple_PartiallySignedTransactionusizeZ. + * Frees any resources used by the C2Tuple_CVec_u8ZusizeZ. */ -void C2Tuple_PartiallySignedTransactionusizeZ_free(struct LDKC2Tuple_PartiallySignedTransactionusizeZ _res); +void C2Tuple_CVec_u8ZusizeZ_free(struct LDKC2Tuple_CVec_u8ZusizeZ _res); /** - * Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ in the success state. + * Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ in the success state. */ -struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok(struct LDKC2Tuple_PartiallySignedTransactionusizeZ o); +struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(struct LDKC2Tuple_CVec_u8ZusizeZ o); /** - * Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ in the error state. + * Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ in the error state. */ -struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err(void); +struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR o); +bool CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(const struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ. + * Frees any resources used by the CResult_C2Tuple_CVec_u8ZusizeZNoneZ. */ -void CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ _res); +void CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ _res); /** - * Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(const struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res); +struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(const struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR orig); /** * Creates a new CResult_NoneNoneZ in the success state. @@ -19544,75 +20835,75 @@ struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_None /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res); +void CVec_ECDSASignatureZ_free(struct LDKCVec_ECDSASignatureZ _res); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig); +struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(const struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements. + * Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements. */ -struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b); +struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(struct LDKECDSASignature a, struct LDKCVec_ECDSASignatureZ b); /** - * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ. + * Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ. */ -void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res); +void C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res); /** - * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state. + * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state. */ -struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o); +struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o); /** - * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state. + * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state. */ -struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void); +struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o); +bool CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ. + * Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ. */ -void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res); +void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res); /** - * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_SignatureNoneZ in the success state. + * Creates a new CResult_ECDSASignatureNoneZ in the success state. */ -struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o); +struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_ok(struct LDKECDSASignature o); /** - * Creates a new CResult_SignatureNoneZ in the error state. + * Creates a new CResult_ECDSASignatureNoneZ in the error state. */ -struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void); +struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o); +bool CResult_ECDSASignatureNoneZ_is_ok(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SignatureNoneZ. + * Frees any resources used by the CResult_ECDSASignatureNoneZ. */ -void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res); +void CResult_ECDSASignatureNoneZ_free(struct LDKCResult_ECDSASignatureNoneZ _res); /** - * Creates a new CResult_SignatureNoneZ which has the same data as `orig` + * Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig); +struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_clone(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR orig); /** * Creates a new CResult_PublicKeyNoneZ in the success state. @@ -19641,82 +20932,82 @@ void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res); struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig); /** - * Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar + * Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar */ -struct LDKCOption_ScalarZ COption_ScalarZ_some(struct LDKBigEndianScalar o); +struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_some(struct LDKBigEndianScalar o); /** - * Constructs a new COption_ScalarZ containing nothing + * Constructs a new COption_BigEndianScalarZ containing nothing */ -struct LDKCOption_ScalarZ COption_ScalarZ_none(void); +struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_none(void); /** * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state */ -void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res); +void COption_BigEndianScalarZ_free(struct LDKCOption_BigEndianScalarZ _res); /** - * Creates a new COption_ScalarZ which has the same data as `orig` + * Creates a new COption_BigEndianScalarZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_ScalarZ COption_ScalarZ_clone(const struct LDKCOption_ScalarZ *NONNULL_PTR orig); +struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_clone(const struct LDKCOption_BigEndianScalarZ *NONNULL_PTR orig); /** - * Creates a new CResult_SharedSecretNoneZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_ok(struct LDKThirtyTwoBytes o); +void CVec_U5Z_free(struct LDKCVec_U5Z _res); /** - * Creates a new CResult_SharedSecretNoneZ in the error state. + * Creates a new CResult_RecoverableSignatureNoneZ in the success state. */ -struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_err(void); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_RecoverableSignatureNoneZ in the error state. */ -bool CResult_SharedSecretNoneZ_is_ok(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR o); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); /** - * Frees any resources used by the CResult_SharedSecretNoneZ. + * Checks if the given object is currently in the success state */ -void CResult_SharedSecretNoneZ_free(struct LDKCResult_SharedSecretNoneZ _res); +bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_SharedSecretNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_RecoverableSignatureNoneZ. */ -struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_clone(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR orig); +void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_U5Z_free(struct LDKCVec_U5Z _res); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the success state. + * Creates a new CResult_SchnorrSignatureNoneZ in the success state. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); +struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_ok(struct LDKSchnorrSignature o); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the error state. + * Creates a new CResult_SchnorrSignatureNoneZ in the error state. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); +struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); +bool CResult_SchnorrSignatureNoneZ_is_ok(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RecoverableSignatureNoneZ. + * Frees any resources used by the CResult_SchnorrSignatureNoneZ. */ -void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); +void CResult_SchnorrSignatureNoneZ_free(struct LDKCResult_SchnorrSignatureNoneZ _res); /** - * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` + * Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); +struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_clone(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR orig); /** * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state. @@ -19739,30 +21030,36 @@ bool CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(const struct LDKCResu void CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res); /** - * Creates a new CResult_ScriptNoneZ in the success state. + * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ScriptNoneZ CResult_ScriptNoneZ_ok(struct LDKCVec_u8Z o); +struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(const struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ScriptNoneZ in the error state. + * Creates a new CResult_CVec_u8ZNoneZ in the success state. */ -struct LDKCResult_ScriptNoneZ CResult_ScriptNoneZ_err(void); +struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_ok(struct LDKCVec_u8Z o); + +/** + * Creates a new CResult_CVec_u8ZNoneZ in the error state. + */ +struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_ScriptNoneZ_is_ok(const struct LDKCResult_ScriptNoneZ *NONNULL_PTR o); +bool CResult_CVec_u8ZNoneZ_is_ok(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ScriptNoneZ. + * Frees any resources used by the CResult_CVec_u8ZNoneZ. */ -void CResult_ScriptNoneZ_free(struct LDKCResult_ScriptNoneZ _res); +void CResult_CVec_u8ZNoneZ_free(struct LDKCResult_CVec_u8ZNoneZ _res); /** - * Creates a new CResult_ScriptNoneZ which has the same data as `orig` + * Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ScriptNoneZ CResult_ScriptNoneZ_clone(const struct LDKCResult_ScriptNoneZ *NONNULL_PTR orig); +struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_clone(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR orig); /** * Creates a new CResult_ShutdownScriptNoneZ in the success state. @@ -19790,6 +21087,48 @@ void CResult_ShutdownScriptNoneZ_free(struct LDKCResult_ShutdownScriptNoneZ _res */ struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_clone(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR orig); +/** + * Constructs a new COption_u16Z containing a u16 + */ +struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); + +/** + * Constructs a new COption_u16Z containing nothing + */ +struct LDKCOption_u16Z COption_u16Z_none(void); + +/** + * Frees any resources associated with the u16, if we are in the Some state + */ +void COption_u16Z_free(struct LDKCOption_u16Z _res); + +/** + * Creates a new COption_u16Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); + +/** + * Constructs a new COption_boolZ containing a bool + */ +struct LDKCOption_boolZ COption_boolZ_some(bool o); + +/** + * Constructs a new COption_boolZ containing nothing + */ +struct LDKCOption_boolZ COption_boolZ_none(void); + +/** + * Frees any resources associated with the bool, if we are in the Some state + */ +void COption_boolZ_free(struct LDKCOption_boolZ _res); + +/** + * Creates a new COption_boolZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_boolZ COption_boolZ_clone(const struct LDKCOption_boolZ *NONNULL_PTR orig); + /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -19847,32 +21186,6 @@ void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDec */ struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); -/** - * Creates a new CResult_PartiallySignedTransactionNoneZ in the success state. - */ -struct LDKCResult_PartiallySignedTransactionNoneZ CResult_PartiallySignedTransactionNoneZ_ok(struct LDKCVec_u8Z o); - -/** - * Creates a new CResult_PartiallySignedTransactionNoneZ in the error state. - */ -struct LDKCResult_PartiallySignedTransactionNoneZ CResult_PartiallySignedTransactionNoneZ_err(void); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_PartiallySignedTransactionNoneZ_is_ok(const struct LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_PartiallySignedTransactionNoneZ. - */ -void CResult_PartiallySignedTransactionNoneZ_free(struct LDKCResult_PartiallySignedTransactionNoneZ _res); - -/** - * Creates a new CResult_PartiallySignedTransactionNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_PartiallySignedTransactionNoneZ CResult_PartiallySignedTransactionNoneZ_clone(const struct LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR orig); - /** * Creates a new CResult_TransactionNoneZ in the success state. */ @@ -19915,30 +21228,30 @@ struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void); void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res); /** - * Creates a new CResult_NoneErrorZ in the success state. + * Creates a new CResult_NoneIOErrorZ in the success state. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void); +struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_ok(void); /** - * Creates a new CResult_NoneErrorZ in the error state. + * Creates a new CResult_NoneIOErrorZ in the error state. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e); +struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_err(enum LDKIOError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o); +bool CResult_NoneIOErrorZ_is_ok(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneErrorZ. + * Frees any resources used by the CResult_NoneIOErrorZ. */ -void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res); +void CResult_NoneIOErrorZ_free(struct LDKCResult_NoneIOErrorZ _res); /** - * Creates a new CResult_NoneErrorZ which has the same data as `orig` + * Creates a new CResult_NoneIOErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_clone(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -20059,27 +21372,6 @@ struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_clone( */ void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); -/** - * Constructs a new COption_u32Z containing a u32 - */ -struct LDKCOption_u32Z COption_u32Z_some(uint32_t o); - -/** - * Constructs a new COption_u32Z containing nothing - */ -struct LDKCOption_u32Z COption_u32Z_none(void); - -/** - * Frees any resources associated with the u32, if we are in the Some state - */ -void COption_u32Z_free(struct LDKCOption_u32Z _res); - -/** - * Creates a new COption_u32Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig); - /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -20324,16 +21616,10 @@ void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res); */ struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig); -/** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKC2Tuple_Z C2Tuple_Z_clone(const struct LDKC2Tuple_Z *NONNULL_PTR orig); - /** * Creates a new C2Tuple_Z from the contained elements. */ -struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKEightU16s a, struct LDKEightU16s b); +struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b); /** * Frees any resources used by the C2Tuple_Z. @@ -20341,41 +21627,50 @@ struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKEightU16s a, struct LDKEightU16s b); void C2Tuple_Z_free(struct LDKC2Tuple_Z _res); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C2Tuple__u1632_u1632Z from the contained elements. + */ +struct LDKC2Tuple__u1632_u1632Z C2Tuple__u1632_u1632Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b); + +/** + * Frees any resources used by the C2Tuple__u1632_u1632Z. + */ +void C2Tuple__u1632_u1632Z_free(struct LDKC2Tuple__u1632_u1632Z _res); + +/** + * Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z */ -struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_clone(const struct LDKC2Tuple__u168_u168Z *NONNULL_PTR orig); +struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(struct LDKC2Tuple__u1632_u1632Z o); /** - * Creates a new C2Tuple__u168_u168Z from the contained elements. + * Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing */ -struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_new(struct LDKEightU16s a, struct LDKEightU16s b); +struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none(void); /** - * Frees any resources used by the C2Tuple__u168_u168Z. + * Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state */ -void C2Tuple__u168_u168Z_free(struct LDKC2Tuple__u168_u168Z _res); +void COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res); /** - * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z + * Constructs a new COption_f64Z containing a f64 */ -struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_some(struct LDKC2Tuple__u168_u168Z o); +struct LDKCOption_f64Z COption_f64Z_some(double o); /** - * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing + * Constructs a new COption_f64Z containing nothing */ -struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_none(void); +struct LDKCOption_f64Z COption_f64Z_none(void); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state + * Frees any resources associated with the f64, if we are in the Some state */ -void COption_C2Tuple_EightU16sEightU16sZZ_free(struct LDKCOption_C2Tuple_EightU16sEightU16sZZ _res); +void COption_f64Z_free(struct LDKCOption_f64Z _res); /** - * Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig` + * Creates a new COption_f64Z which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_clone(const struct LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR orig); +struct LDKCOption_f64Z COption_f64Z_clone(const struct LDKCOption_f64Z *NONNULL_PTR orig); /** * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. @@ -20419,46 +21714,51 @@ void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); /** - * Constructs a new COption_BlockHashZ containing a crate::c_types::ThirtyTwoBytes + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_BlockHashZ COption_BlockHashZ_some(struct LDKThirtyTwoBytes o); +struct LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR orig); /** - * Constructs a new COption_BlockHashZ containing nothing + * Creates a new C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ from the contained elements. */ -struct LDKCOption_BlockHashZ COption_BlockHashZ_none(void); +struct LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(struct LDKThirtyTwoBytes a, struct LDKCOption_ThirtyTwoBytesZ b); /** - * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state + * Frees any resources used by the C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ. */ -void COption_BlockHashZ_free(struct LDKCOption_BlockHashZ _res); +void C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res); /** - * Creates a new COption_BlockHashZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_BlockHashZ COption_BlockHashZ_clone(const struct LDKCOption_BlockHashZ *NONNULL_PTR orig); +void CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ _res); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state. */ -struct LDKC2Tuple_TxidCOption_BlockHashZZ C2Tuple_TxidCOption_BlockHashZZ_clone(const struct LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR orig); +struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_ok(enum LDKChannelMonitorUpdateStatus o); /** - * Creates a new C2Tuple_TxidCOption_BlockHashZZ from the contained elements. + * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state. */ -struct LDKC2Tuple_TxidCOption_BlockHashZZ C2Tuple_TxidCOption_BlockHashZZ_new(struct LDKThirtyTwoBytes a, struct LDKCOption_BlockHashZ b); +struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_err(void); /** - * Frees any resources used by the C2Tuple_TxidCOption_BlockHashZZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_TxidCOption_BlockHashZZ_free(struct LDKC2Tuple_TxidCOption_BlockHashZZ _res); +bool CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ. */ -void CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(struct LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ _res); +void CResult_ChannelMonitorUpdateStatusNoneZ_free(struct LDKCResult_ChannelMonitorUpdateStatusNoneZ _res); + +/** + * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_clone(const struct LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -20668,11 +21968,6 @@ void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeF */ struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_ChainHashZ_free(struct LDKCVec_ChainHashZ _res); - /** * Creates a new CResult_OfferBolt12ParseErrorZ in the success state. */ @@ -20700,30 +21995,30 @@ void CResult_OfferBolt12ParseErrorZ_free(struct LDKCResult_OfferBolt12ParseError struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_clone(const struct LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PublicKeyErrorZ in the success state. + * Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state. */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); +struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_ok(struct LDKPublicKey o); /** - * Creates a new CResult_PublicKeyErrorZ in the error state. + * Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state. */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_err(enum LDKSecp256k1Error e); /** * Checks if the given object is currently in the success state */ -bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o); +bool CResult_PublicKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PublicKeyErrorZ. + * Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ. */ -void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res); +void CResult_PublicKeySecp256k1ErrorZ_free(struct LDKCResult_PublicKeySecp256k1ErrorZ _res); /** - * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig` + * Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig); +struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_clone(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_NodeIdDecodeErrorZ in the success state. @@ -20988,7 +22283,7 @@ struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone( /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res); +void CVec_SocketAddressZ_free(struct LDKCVec_SocketAddressZ _res); /** * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. @@ -21089,46 +22384,77 @@ bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraph void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); /** - * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ + * Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ */ -struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o); +struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_some(struct LDKCVec_SocketAddressZ o); /** - * Constructs a new COption_CVec_NetAddressZZ containing nothing + * Constructs a new COption_CVec_SocketAddressZZ containing nothing */ -struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void); +struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_none(void); /** - * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state + * Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state */ -void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res); +void COption_CVec_SocketAddressZZ_free(struct LDKCOption_CVec_SocketAddressZZ _res); /** - * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig` + * Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig); +struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_clone(const struct LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR orig); /** - * Constructs a new COption_PaymentPreimageZ containing a crate::c_types::ThirtyTwoBytes + * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state. */ -struct LDKCOption_PaymentPreimageZ COption_PaymentPreimageZ_some(struct LDKThirtyTwoBytes o); +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_ok(struct LDKChannelDerivationParameters o); /** - * Constructs a new COption_PaymentPreimageZ containing nothing + * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state. */ -struct LDKCOption_PaymentPreimageZ COption_PaymentPreimageZ_none(void); +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ. + */ +void CResult_ChannelDerivationParametersDecodeErrorZ_free(struct LDKCResult_ChannelDerivationParametersDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state. + */ +struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_ok(struct LDKHTLCDescriptor o); + +/** + * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state. + */ +struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HTLCDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ. */ -void COption_PaymentPreimageZ_free(struct LDKCOption_PaymentPreimageZ _res); +void CResult_HTLCDescriptorDecodeErrorZ_free(struct LDKCResult_HTLCDescriptorDecodeErrorZ _res); /** - * Creates a new COption_PaymentPreimageZ which has the same data as `orig` + * Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_PaymentPreimageZ COption_PaymentPreimageZ_clone(const struct LDKCOption_PaymentPreimageZ *NONNULL_PTR orig); +struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_clone(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -21224,93 +22550,88 @@ void CResult_CVec_UtxoZNoneZ_free(struct LDKCResult_CVec_UtxoZNoneZ _res); struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_clone(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR orig); /** - * Constructs a new COption_u16Z containing a u16 + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); +struct LDKC2Tuple_u64u16Z C2Tuple_u64u16Z_clone(const struct LDKC2Tuple_u64u16Z *NONNULL_PTR orig); /** - * Constructs a new COption_u16Z containing nothing + * Creates a new C2Tuple_u64u16Z from the contained elements. */ -struct LDKCOption_u16Z COption_u16Z_none(void); +struct LDKC2Tuple_u64u16Z C2Tuple_u64u16Z_new(uint64_t a, uint16_t b); /** - * Frees any resources associated with the u16, if we are in the Some state + * Frees any resources used by the C2Tuple_u64u16Z. */ -void COption_u16Z_free(struct LDKCOption_u16Z _res); +void C2Tuple_u64u16Z_free(struct LDKC2Tuple_u64u16Z _res); /** - * Creates a new COption_u16Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z */ -struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); +struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_some(struct LDKC2Tuple_u64u16Z o); /** - * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState + * Constructs a new COption_C2Tuple_u64u16ZZ containing nothing */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_some(enum LDKChannelShutdownState o); +struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_none(void); /** - * Constructs a new COption_ChannelShutdownStateZ containing nothing + * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_none(void); +void COption_C2Tuple_u64u16ZZ_free(struct LDKCOption_C2Tuple_u64u16ZZ _res); /** - * Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state - */ -void COption_ChannelShutdownStateZ_free(struct LDKCOption_ChannelShutdownStateZ _res); - -/** - * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` + * Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_clone(const struct LDKCOption_ChannelShutdownStateZ *NONNULL_PTR orig); +struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_clone(const struct LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR orig); /** - * Constructs a new COption_PaymentHashZ containing a crate::c_types::ThirtyTwoBytes + * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState */ -struct LDKCOption_PaymentHashZ COption_PaymentHashZ_some(struct LDKThirtyTwoBytes o); +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_some(enum LDKChannelShutdownState o); /** - * Constructs a new COption_PaymentHashZ containing nothing + * Constructs a new COption_ChannelShutdownStateZ containing nothing */ -struct LDKCOption_PaymentHashZ COption_PaymentHashZ_none(void); +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_none(void); /** - * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state + * Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state */ -void COption_PaymentHashZ_free(struct LDKCOption_PaymentHashZ _res); +void COption_ChannelShutdownStateZ_free(struct LDKCOption_ChannelShutdownStateZ _res); /** - * Creates a new COption_PaymentHashZ which has the same data as `orig` + * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_PaymentHashZ COption_PaymentHashZ_clone(const struct LDKCOption_PaymentHashZ *NONNULL_PTR orig); +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_clone(const struct LDKCOption_ChannelShutdownStateZ *NONNULL_PTR orig); /** - * Creates a new CResult__u832APIErrorZ in the success state. + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state. */ -struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult__u832APIErrorZ in the error state. + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state. */ -struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_err(struct LDKAPIError e); /** * Checks if the given object is currently in the success state */ -bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o); +bool CResult_ThirtyTwoBytesAPIErrorZ_is_ok(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult__u832APIErrorZ. + * Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ. */ -void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res); +void CResult_ThirtyTwoBytesAPIErrorZ_free(struct LDKCResult_ThirtyTwoBytesAPIErrorZ _res); /** - * Creates a new CResult__u832APIErrorZ which has the same data as `orig` + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig); +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_clone(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -21370,218 +22691,176 @@ void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendF struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state. + * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state. */ -struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state. + * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state. */ -struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentHashPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR o); +bool CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ. + * Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ. */ -void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res); +void CResult_ThirtyTwoBytesPaymentSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res); /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig` + * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state. + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state. */ -struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state. + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state. */ -struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentHashRetryableSendFailureZ_is_ok(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR o); +bool CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ. + * Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ. */ -void CResult_PaymentHashRetryableSendFailureZ_free(struct LDKCResult_PaymentHashRetryableSendFailureZ _res); +void CResult_ThirtyTwoBytesRetryableSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res); /** - * Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig` + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_clone(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR orig); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig); +struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements. + * Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements. */ -struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); +struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); /** - * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ. */ -void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res); +void C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o); +bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ. + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ. */ -void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res); +void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res); +void CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state. */ -struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig); +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o); /** - * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements. + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state. */ -struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); - -/** - * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ. - */ -void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res); - -/** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state. - */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); - -/** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state. - */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void); +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(struct LDKProbeSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o); +bool CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ. + * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ. */ -void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res); +void CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig` + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_PaymentSecretNoneZ in the success state. - */ -struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentSecretNoneZ in the error state. - */ -struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_PaymentSecretNoneZ. - */ -void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res); - -/** - * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig` + * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state. - */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state. + * Creates a new C2Tuple_ThirtyTwoBytesPublicKeyZ from the contained elements. */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e); +struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ C2Tuple_ThirtyTwoBytesPublicKeyZ_new(struct LDKThirtyTwoBytes a, struct LDKPublicKey b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the C2Tuple_ThirtyTwoBytesPublicKeyZ. */ -bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o); +void C2Tuple_ThirtyTwoBytesPublicKeyZ_free(struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res); /** - * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res); +void CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res); /** - * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state. */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); /** - * Constructs a new COption_CVec_ChainHashZZ containing a crate::c_types::derived::CVec_ChainHashZ + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state. */ -struct LDKCOption_CVec_ChainHashZZ COption_CVec_ChainHashZZ_some(struct LDKCVec_ChainHashZ o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err(void); /** - * Constructs a new COption_CVec_ChainHashZZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_CVec_ChainHashZZ COption_CVec_ChainHashZZ_none(void); +bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::c_types::derived::CVec_ChainHashZ, if we are in the Some state + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ. */ -void COption_CVec_ChainHashZZ_free(struct LDKCOption_CVec_ChainHashZZ _res); +void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res); /** - * Creates a new COption_CVec_ChainHashZZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_CVec_ChainHashZZ COption_CVec_ChainHashZZ_clone(const struct LDKCOption_CVec_ChainHashZZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR orig); /** * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. @@ -21719,34 +22998,34 @@ struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateD void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); /** - * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. + * Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements. */ -struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); +struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ C2Tuple_ThirtyTwoBytesChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); /** - * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ. */ -void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res); +void C2Tuple_ThirtyTwoBytesChannelManagerZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res); /** - * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state. */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o); /** - * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state. */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ. + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ. */ -void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res); +void CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res); /** * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state. @@ -21971,59 +23250,64 @@ struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(co * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig); +struct LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_clone(const struct LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_OutPointScriptZ from the contained elements. + * Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements. */ -struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); +struct LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); /** - * Frees any resources used by the C2Tuple_OutPointScriptZ. + * Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ. */ -void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res); +void C2Tuple_OutPointCVec_u8ZZ_free(struct LDKC2Tuple_OutPointCVec_u8ZZ _res); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig); +struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_clone(const struct LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_u32ScriptZ from the contained elements. + * Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements. */ -struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b); +struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_new(uint32_t a, struct LDKCVec_u8Z b); /** - * Frees any resources used by the C2Tuple_u32ScriptZ. + * Frees any resources used by the C2Tuple_u32CVec_u8ZZ. */ -void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res); +void C2Tuple_u32CVec_u8ZZ_free(struct LDKC2Tuple_u32CVec_u8ZZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res); +void CVec_C2Tuple_u32CVec_u8ZZZ_free(struct LDKCVec_C2Tuple_u32CVec_u8ZZZ _res); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig); +struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements. + * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b); +struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32CVec_u8ZZZ b); /** - * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ. */ -void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res); +void C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res); +void CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_CommitmentTransactionZ_free(struct LDKCVec_CommitmentTransactionZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -22055,17 +23339,17 @@ void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); +struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements. + * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); +struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); /** - * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ. */ -void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res); +void C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -22078,34 +23362,52 @@ void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); /** - * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements. */ -struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); +struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); /** - * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ. */ -void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res); +void C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res); /** - * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state. */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o); /** - * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state. */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ. + */ +void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res); +struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_clone(const struct LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR orig); /** * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. @@ -22158,6 +23460,12 @@ struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContents */ void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res); +/** + * Creates a new COption_CustomOnionMessageContentsZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_clone(const struct LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR orig); + /** * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state. */ @@ -22178,6 +23486,12 @@ bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct */ void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res); +/** + * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR orig); + /** * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type */ @@ -22193,6 +23507,12 @@ struct LDKCOption_TypeZ COption_TypeZ_none(void); */ void COption_TypeZ_free(struct LDKCOption_TypeZ _res); +/** + * Creates a new COption_TypeZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_TypeZ COption_TypeZ_clone(const struct LDKCOption_TypeZ *NONNULL_PTR orig); + /** * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. */ @@ -22214,46 +23534,52 @@ bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_Typ void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); /** - * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress + * Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_clone(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress */ -struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o); +struct LDKCOption_SocketAddressZ COption_SocketAddressZ_some(struct LDKSocketAddress o); /** - * Constructs a new COption_NetAddressZ containing nothing + * Constructs a new COption_SocketAddressZ containing nothing */ -struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void); +struct LDKCOption_SocketAddressZ COption_SocketAddressZ_none(void); /** - * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state + * Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state */ -void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res); +void COption_SocketAddressZ_free(struct LDKCOption_SocketAddressZ _res); /** - * Creates a new COption_NetAddressZ which has the same data as `orig` + * Creates a new COption_SocketAddressZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig); +struct LDKCOption_SocketAddressZ COption_SocketAddressZ_clone(const struct LDKCOption_SocketAddressZ *NONNULL_PTR orig); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_clone(const struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR orig); +struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(const struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements. + * Creates a new C2Tuple_PublicKeyCOption_SocketAddressZZ from the contained elements. */ -struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_new(struct LDKPublicKey a, struct LDKCOption_NetAddressZ b); +struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ C2Tuple_PublicKeyCOption_SocketAddressZZ_new(struct LDKPublicKey a, struct LDKCOption_SocketAddressZ b); /** - * Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ. + * Frees any resources used by the C2Tuple_PublicKeyCOption_SocketAddressZZ. */ -void C2Tuple_PublicKeyCOption_NetAddressZZ_free(struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res); +void C2Tuple_PublicKeyCOption_SocketAddressZZ_free(struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res); +void CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(struct LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res); /** * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. @@ -22354,72 +23680,165 @@ bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res); /** - * Constructs a new COption_KeyPairZ containing a crate::c_types::SecretKey + * Creates a new CResult_CVec_u8ZIOErrorZ in the success state. */ -struct LDKCOption_KeyPairZ COption_KeyPairZ_some(struct LDKSecretKey o); +struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_ok(struct LDKCVec_u8Z o); /** - * Constructs a new COption_KeyPairZ containing nothing + * Creates a new CResult_CVec_u8ZIOErrorZ in the error state. */ -struct LDKCOption_KeyPairZ COption_KeyPairZ_none(void); +struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_err(enum LDKIOError e); /** - * Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_u8ZIOErrorZ_is_ok(const struct LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_u8ZIOErrorZ. */ -void COption_KeyPairZ_free(struct LDKCOption_KeyPairZ _res); +void CResult_CVec_u8ZIOErrorZ_free(struct LDKCResult_CVec_u8ZIOErrorZ _res); /** - * Creates a new COption_KeyPairZ which has the same data as `orig` + * Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_KeyPairZ COption_KeyPairZ_clone(const struct LDKCOption_KeyPairZ *NONNULL_PTR orig); +struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_clone(const struct LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_StrZ_free(struct LDKCVec_StrZ _res); /** - * Creates a new CResult_COption_KeyPairZNoneZ in the success state. + * Creates a new CResult_CVec_StrZIOErrorZ in the success state. */ -struct LDKCResult_COption_KeyPairZNoneZ CResult_COption_KeyPairZNoneZ_ok(struct LDKCOption_KeyPairZ o); +struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_ok(struct LDKCVec_StrZ o); /** - * Creates a new CResult_COption_KeyPairZNoneZ in the error state. + * Creates a new CResult_CVec_StrZIOErrorZ in the error state. */ -struct LDKCResult_COption_KeyPairZNoneZ CResult_COption_KeyPairZNoneZ_err(void); +struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_err(enum LDKIOError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_KeyPairZNoneZ_is_ok(const struct LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR o); +bool CResult_CVec_StrZIOErrorZ_is_ok(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_KeyPairZNoneZ. + * Frees any resources used by the CResult_CVec_StrZIOErrorZ. */ -void CResult_COption_KeyPairZNoneZ_free(struct LDKCResult_COption_KeyPairZNoneZ _res); +void CResult_CVec_StrZIOErrorZ_free(struct LDKCResult_CVec_StrZIOErrorZ _res); /** - * Creates a new CResult_COption_KeyPairZNoneZ which has the same data as `orig` + * Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_KeyPairZNoneZ CResult_COption_KeyPairZNoneZ_clone(const struct LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR orig); +struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_clone(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_ScriptZ containing a crate::c_types::derived::CVec_u8Z + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_ScriptZ COption_ScriptZ_some(struct LDKCVec_u8Z o); +void CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res); /** - * Constructs a new COption_ScriptZ containing nothing + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state. */ -struct LDKCOption_ScriptZ COption_ScriptZ_none(void); +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o); /** - * Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(enum LDKIOError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ. + */ +void CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(enum LDKIOError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ. */ -void COption_ScriptZ_free(struct LDKCOption_ScriptZ _res); +void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res); /** - * Creates a new COption_ScriptZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_ScriptZ COption_ScriptZ_clone(const struct LDKCOption_ScriptZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey + */ +struct LDKCOption_SecretKeyZ COption_SecretKeyZ_some(struct LDKSecretKey o); + +/** + * Constructs a new COption_SecretKeyZ containing nothing + */ +struct LDKCOption_SecretKeyZ COption_SecretKeyZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state + */ +void COption_SecretKeyZ_free(struct LDKCOption_SecretKeyZ _res); + +/** + * Creates a new COption_SecretKeyZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_SecretKeyZ COption_SecretKeyZ_clone(const struct LDKCOption_SecretKeyZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state. + */ +struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_ok(struct LDKVerifiedInvoiceRequest o); + +/** + * Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state. + */ +struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_VerifiedInvoiceRequestNoneZ_is_ok(const struct LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ. + */ +void CResult_VerifiedInvoiceRequestNoneZ_free(struct LDKCResult_VerifiedInvoiceRequestNoneZ _res); + +/** + * Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_clone(const struct LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR orig); /** * Constructs a new COption_NoneZ containing a @@ -22463,51 +23882,56 @@ void COption_i64Z_free(struct LDKCOption_i64Z _res); struct LDKCOption_i64Z COption_i64Z_clone(const struct LDKCOption_i64Z *NONNULL_PTR orig); /** - * Constructs a new COption_TxidZ containing a crate::c_types::ThirtyTwoBytes + * Creates a new CResult_SocketAddressDecodeErrorZ in the success state. */ -struct LDKCOption_TxidZ COption_TxidZ_some(struct LDKThirtyTwoBytes o); +struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_ok(struct LDKSocketAddress o); /** - * Constructs a new COption_TxidZ containing nothing + * Creates a new CResult_SocketAddressDecodeErrorZ in the error state. */ -struct LDKCOption_TxidZ COption_TxidZ_none(void); +struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_TxidZ_free(struct LDKCOption_TxidZ _res); +bool CResult_SocketAddressDecodeErrorZ_is_ok(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new COption_TxidZ which has the same data as `orig` + * Frees any resources used by the CResult_SocketAddressDecodeErrorZ. + */ +void CResult_SocketAddressDecodeErrorZ_free(struct LDKCResult_SocketAddressDecodeErrorZ _res); + +/** + * Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_TxidZ COption_TxidZ_clone(const struct LDKCOption_TxidZ *NONNULL_PTR orig); +struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_clone(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NetAddressDecodeErrorZ in the success state. + * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state. */ -struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_ok(struct LDKSocketAddress o); /** - * Creates a new CResult_NetAddressDecodeErrorZ in the error state. + * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state. */ -struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_err(enum LDKSocketAddressParseError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o); +bool CResult_SocketAddressSocketAddressParseErrorZ_is_ok(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NetAddressDecodeErrorZ. + * Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ. */ -void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res); +void CResult_SocketAddressSocketAddressParseErrorZ_free(struct LDKCResult_SocketAddressSocketAddressParseErrorZ _res); /** - * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_clone(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -24051,30 +25475,51 @@ bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_Tru void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); /** - * Creates a new CResult_CVec_SignatureZNoneZ in the success state. + * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state. */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o); +struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_ok(struct LDKCVec_ECDSASignatureZ o); /** - * Creates a new CResult_CVec_SignatureZNoneZ in the error state. + * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state. */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); +struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o); +bool CResult_CVec_ECDSASignatureZNoneZ_is_ok(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ. + */ +void CResult_CVec_ECDSASignatureZNoneZ_free(struct LDKCResult_CVec_ECDSASignatureZNoneZ _res); + +/** + * Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_clone(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_usizeZ containing a usize + */ +struct LDKCOption_usizeZ COption_usizeZ_some(uintptr_t o); + +/** + * Constructs a new COption_usizeZ containing nothing + */ +struct LDKCOption_usizeZ COption_usizeZ_none(void); /** - * Frees any resources used by the CResult_CVec_SignatureZNoneZ. + * Frees any resources associated with the usize, if we are in the Some state */ -void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res); +void COption_usizeZ_free(struct LDKCOption_usizeZ _res); /** - * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig` + * Creates a new COption_usizeZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig); +struct LDKCOption_usizeZ COption_usizeZ_clone(const struct LDKCOption_usizeZ *NONNULL_PTR orig); /** * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. @@ -24154,6 +25599,32 @@ void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDec */ struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state. + */ +struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_ok(struct LDKClaimedHTLC o); + +/** + * Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state. + */ +struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ClaimedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ. + */ +void CResult_ClaimedHTLCDecodeErrorZ_free(struct LDKCResult_ClaimedHTLCDecodeErrorZ _res); + +/** + * Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_clone(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR orig); + /** * Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure */ @@ -24322,46 +25793,30 @@ void CResult_PaymentFailureReasonDecodeErrorZ_free(struct LDKCResult_PaymentFail struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_clone(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_u128Z containing a crate::c_types::U128 + * Constructs a new COption_U128Z containing a crate::c_types::U128 */ -struct LDKCOption_u128Z COption_u128Z_some(struct LDKU128 o); +struct LDKCOption_U128Z COption_U128Z_some(struct LDKU128 o); /** - * Constructs a new COption_u128Z containing nothing + * Constructs a new COption_U128Z containing nothing */ -struct LDKCOption_u128Z COption_u128Z_none(void); +struct LDKCOption_U128Z COption_U128Z_none(void); /** * Frees any resources associated with the crate::c_types::U128, if we are in the Some state */ -void COption_u128Z_free(struct LDKCOption_u128Z _res); +void COption_U128Z_free(struct LDKCOption_U128Z _res); /** - * Creates a new COption_u128Z which has the same data as `orig` + * Creates a new COption_U128Z which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_u128Z COption_u128Z_clone(const struct LDKCOption_u128Z *NONNULL_PTR orig); +struct LDKCOption_U128Z COption_U128Z_clone(const struct LDKCOption_U128Z *NONNULL_PTR orig); /** - * Constructs a new COption_PaymentIdZ containing a crate::c_types::ThirtyTwoBytes - */ -struct LDKCOption_PaymentIdZ COption_PaymentIdZ_some(struct LDKThirtyTwoBytes o); - -/** - * Constructs a new COption_PaymentIdZ containing nothing - */ -struct LDKCOption_PaymentIdZ COption_PaymentIdZ_none(void); - -/** - * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state - */ -void COption_PaymentIdZ_free(struct LDKCOption_PaymentIdZ _res); - -/** - * Creates a new COption_PaymentIdZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_PaymentIdZ COption_PaymentIdZ_clone(const struct LDKCOption_PaymentIdZ *NONNULL_PTR orig); +void CVec_ClaimedHTLCZ_free(struct LDKCVec_ClaimedHTLCZ _res); /** * Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason @@ -24431,31 +25886,6 @@ void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDec */ struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res); - -/** - * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state. - */ -struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o); - -/** - * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state. - */ -struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ. - */ -void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res); - /** * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state. */ @@ -24551,30 +25981,30 @@ struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11 void C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res); /** - * Creates a new CResult_PayeePubKeyErrorZ in the success state. + * Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o); +struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_ok(struct LDKPayeePubKey o); /** - * Creates a new CResult_PayeePubKeyErrorZ in the error state. + * Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_err(enum LDKSecp256k1Error e); /** * Checks if the given object is currently in the success state */ -bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o); +bool CResult_PayeePubKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PayeePubKeyErrorZ. + * Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ. */ -void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res); +void CResult_PayeePubKeySecp256k1ErrorZ_free(struct LDKCResult_PayeePubKeySecp256k1ErrorZ _res); /** - * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` + * Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig); +struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_clone(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -24659,11 +26089,6 @@ void CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(struct LDKCResult_Bolt11Invo */ struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR orig); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_AddressZ_free(struct LDKCVec_AddressZ _res); - /** * Creates a new CResult_DescriptionCreationErrorZ in the success state. */ @@ -24873,30 +26298,108 @@ void CResult_UntrustedStringDecodeErrorZ_free(struct LDKCResult_UntrustedStringD struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_clone(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentIdPaymentErrorZ in the success state. + * Creates a new CResult_ReceiveTlvsDecodeErrorZ in the success state. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_ReceiveTlvsDecodeErrorZ CResult_ReceiveTlvsDecodeErrorZ_ok(struct LDKReceiveTlvs o); /** - * Creates a new CResult_PaymentIdPaymentErrorZ in the error state. + * Creates a new CResult_ReceiveTlvsDecodeErrorZ in the error state. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e); +struct LDKCResult_ReceiveTlvsDecodeErrorZ CResult_ReceiveTlvsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o); +bool CResult_ReceiveTlvsDecodeErrorZ_is_ok(const struct LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentIdPaymentErrorZ. + * Frees any resources used by the CResult_ReceiveTlvsDecodeErrorZ. */ -void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res); +void CResult_ReceiveTlvsDecodeErrorZ_free(struct LDKCResult_ReceiveTlvsDecodeErrorZ _res); /** - * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig` + * Creates a new CResult_ReceiveTlvsDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig); +struct LDKCResult_ReceiveTlvsDecodeErrorZ CResult_ReceiveTlvsDecodeErrorZ_clone(const struct LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PaymentRelayDecodeErrorZ in the success state. + */ +struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_ok(struct LDKPaymentRelay o); + +/** + * Creates a new CResult_PaymentRelayDecodeErrorZ in the error state. + */ +struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PaymentRelayDecodeErrorZ_is_ok(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PaymentRelayDecodeErrorZ. + */ +void CResult_PaymentRelayDecodeErrorZ_free(struct LDKCResult_PaymentRelayDecodeErrorZ _res); + +/** + * Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_clone(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state. + */ +struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_ok(struct LDKPaymentConstraints o); + +/** + * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state. + */ +struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PaymentConstraintsDecodeErrorZ_is_ok(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ. + */ +void CResult_PaymentConstraintsDecodeErrorZ_free(struct LDKCResult_PaymentConstraintsDecodeErrorZ _res); + +/** + * Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_clone(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the success state. + */ +struct LDKCResult_ThirtyTwoBytesPaymentErrorZ CResult_ThirtyTwoBytesPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the error state. + */ +struct LDKCResult_ThirtyTwoBytesPaymentErrorZ CResult_ThirtyTwoBytesPaymentErrorZ_err(struct LDKPaymentError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(const struct LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ThirtyTwoBytesPaymentErrorZ. + */ +void CResult_ThirtyTwoBytesPaymentErrorZ_free(struct LDKCResult_ThirtyTwoBytesPaymentErrorZ _res); + +/** + * Creates a new CResult_ThirtyTwoBytesPaymentErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ThirtyTwoBytesPaymentErrorZ CResult_ThirtyTwoBytesPaymentErrorZ_clone(const struct LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_NonePaymentErrorZ in the success state. @@ -24925,30 +26428,56 @@ void CResult_NonePaymentErrorZ_free(struct LDKCResult_NonePaymentErrorZ _res); struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_clone(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_StringErrorZ in the success state. + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the success state. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the error state. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(struct LDKProbingError e); + +/** + * Checks if the given object is currently in the success state */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o); +bool CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_StringErrorZ in the error state. + * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ. + */ +void CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ _res); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_StrSecp256k1ErrorZ in the success state. + */ +struct LDKCResult_StrSecp256k1ErrorZ CResult_StrSecp256k1ErrorZ_ok(struct LDKStr o); + +/** + * Creates a new CResult_StrSecp256k1ErrorZ in the error state. + */ +struct LDKCResult_StrSecp256k1ErrorZ CResult_StrSecp256k1ErrorZ_err(enum LDKSecp256k1Error e); /** * Checks if the given object is currently in the success state */ -bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o); +bool CResult_StrSecp256k1ErrorZ_is_ok(const struct LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_StringErrorZ. + * Frees any resources used by the CResult_StrSecp256k1ErrorZ. */ -void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res); +void CResult_StrSecp256k1ErrorZ_free(struct LDKCResult_StrSecp256k1ErrorZ _res); /** - * Creates a new CResult_StringErrorZ which has the same data as `orig` + * Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig); +struct LDKCResult_StrSecp256k1ErrorZ CResult_StrSecp256k1ErrorZ_clone(const struct LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state. @@ -25002,6 +26531,42 @@ void CResult_OnionMessagePathNoneZ_free(struct LDKCResult_OnionMessagePathNoneZ */ struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_clone(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR orig); +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_PublicKeyOnionMessageZ C2Tuple_PublicKeyOnionMessageZ_clone(const struct LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_PublicKeyOnionMessageZ from the contained elements. + */ +struct LDKC2Tuple_PublicKeyOnionMessageZ C2Tuple_PublicKeyOnionMessageZ_new(struct LDKPublicKey a, struct LDKOnionMessage b); + +/** + * Frees any resources used by the C2Tuple_PublicKeyOnionMessageZ. + */ +void C2Tuple_PublicKeyOnionMessageZ_free(struct LDKC2Tuple_PublicKeyOnionMessageZ _res); + +/** + * Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the success state. + */ +struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(struct LDKC2Tuple_PublicKeyOnionMessageZ o); + +/** + * Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the error state. + */ +struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(struct LDKSendError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(const struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ. + */ +void CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ _res); + /** * Creates a new CResult_NoneSendErrorZ in the success state. */ @@ -25048,6 +26613,32 @@ void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res); */ struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_clone(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR orig); +/** + * Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state. + */ +struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(struct LDKC2Tuple_BlindedPayInfoBlindedPathZ o); + +/** + * Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state. + */ +struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(const struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ. + */ +void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res); + +/** + * Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(const struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR orig); + /** * Creates a new CResult_BlindedPathDecodeErrorZ in the success state. */ @@ -25364,12 +26955,12 @@ struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ TransactionU16LenLimited_ * A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller. * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted. */ -struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]); +struct LDKCResult_StrSecp256k1ErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]); /** * Recovers the PublicKey of the signer of the message given the message and the signature. */ -struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig); +struct LDKCResult_PublicKeySecp256k1ErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig); /** * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature, @@ -25382,11 +26973,92 @@ bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); */ struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z data_without_signature); +/** + * Calls the free function if one is set + */ +void KVStore_free(struct LDKKVStore this_ptr); + /** * Calls the free function if one is set */ void Persister_free(struct LDKPersister this_ptr); +/** + * Read previously persisted [`ChannelMonitor`]s from the store. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ read_channel_monitors(struct LDKKVStore kv_store, struct LDKEntropySource entropy_source, struct LDKSignerProvider signer_provider); + +/** + * Frees any resources used by the MonitorUpdatingPersister, if is_owned is set and inner is non-NULL. + */ +void MonitorUpdatingPersister_free(struct LDKMonitorUpdatingPersister this_obj); + +/** + * Constructs a new [`MonitorUpdatingPersister`]. + * + * The `maximum_pending_updates` parameter controls how many updates may be stored before a + * [`MonitorUpdatingPersister`] consolidates updates by writing a full monitor. Note that + * consolidation will frequently occur with fewer updates than what you set here; this number + * is merely the maximum that may be stored. When setting this value, consider that for higher + * values of `maximum_pending_updates`: + * + * - [`MonitorUpdatingPersister`] will tend to write more [`ChannelMonitorUpdate`]s than + * [`ChannelMonitor`]s, approaching one [`ChannelMonitor`] write for every + * `maximum_pending_updates` [`ChannelMonitorUpdate`]s. + * - [`MonitorUpdatingPersister`] will issue deletes differently. Lazy deletes will come in + * \"waves\" for each [`ChannelMonitor`] write. A larger `maximum_pending_updates` means bigger, + * less frequent \"waves.\" + * - [`MonitorUpdatingPersister`] will potentially have more listing to do if you need to run + * [`MonitorUpdatingPersister::cleanup_stale_updates`]. + */ +MUST_USE_RES struct LDKMonitorUpdatingPersister MonitorUpdatingPersister_new(struct LDKKVStore kv_store, struct LDKLogger logger, uint64_t maximum_pending_updates, struct LDKEntropySource entropy_source, struct LDKSignerProvider signer_provider); + +/** + * Reads all stored channel monitors, along with any stored updates for them. + * + * It is extremely important that your [`KVStore::read`] implementation uses the + * [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the + * documentation for [`MonitorUpdatingPersister`]. + */ +MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ MonitorUpdatingPersister_read_all_channel_monitors_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator); + +/** + * Read a single channel monitor, along with any stored updates for it. + * + * It is extremely important that your [`KVStore::read`] implementation uses the + * [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the + * documentation for [`MonitorUpdatingPersister`]. + * + * For `monitor_key`, channel storage keys be the channel's transaction ID and index, or + * [`OutPoint`], with an underscore `_` between them. For example, given: + * + * - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef` + * - Index: `1` + * + * The correct `monitor_key` would be: + * `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1` + * + * Loading a large number of monitors will be faster if done in parallel. You can use this + * function to accomplish this. Take care to limit the number of parallel readers. + */ +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ MonitorUpdatingPersister_read_channel_monitor_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, struct LDKStr monitor_key); + +/** + * Cleans up stale updates for all monitors. + * + * This function works by first listing all monitors, and then for each of them, listing all + * updates. The updates that have an `update_id` less than or equal to than the stored monitor + * are deleted. The deletion can either be lazy or non-lazy based on the `lazy` flag; this will + * be passed to [`KVStore::remove`]. + */ +MUST_USE_RES struct LDKCResult_NoneIOErrorZ MonitorUpdatingPersister_cleanup_stale_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, bool lazy); + +/** + * Constructs a new Persist which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is + */ +struct LDKPersist MonitorUpdatingPersister_as_Persist(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg); + /** * Frees any resources used by the UntrustedString, if is_owned is set and inner is non-NULL. */ @@ -26907,9 +28579,9 @@ enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_completed(void); enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_in_progress(void); /** - * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateStatus + * Utility method to constructs a new UnrecoverableError-variant ChannelMonitorUpdateStatus */ -enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_permanent_failure(void); +enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_unrecoverable_error(void); /** * Checks if two ChannelMonitorUpdateStatuss contain equal inner contents. @@ -26935,12 +28607,12 @@ void WatchedOutput_free(struct LDKWatchedOutput this_obj); /** * First block where the transaction output may have been spent. */ -struct LDKCOption_BlockHashZ WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); +struct LDKCOption_ThirtyTwoBytesZ WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); /** * First block where the transaction output may have been spent. */ -void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCOption_BlockHashZ val); +void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** * Outpoint identifying the transaction output. @@ -26965,7 +28637,7 @@ void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_p /** * Constructs a new WatchedOutput given each field */ -MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKCOption_BlockHashZ block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg); +MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKCOption_ThirtyTwoBytesZ block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg); /** * Creates a copy of the WatchedOutput @@ -27256,20 +28928,15 @@ struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_ struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a); /** - * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent + * Utility method to constructs a new HolderForceClosed-variant MonitorEvent */ -struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a); +struct LDKMonitorEvent MonitorEvent_holder_force_closed(struct LDKOutPoint a); /** * Utility method to constructs a new Completed-variant MonitorEvent */ struct LDKMonitorEvent MonitorEvent_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id); -/** - * Utility method to constructs a new UpdateFailed-variant MonitorEvent - */ -struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a); - /** * Checks if two MonitorEvents contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -27326,32 +28993,32 @@ struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig); /** * Utility method to constructs a new ClaimableOnChannelClose-variant Balance */ -struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis); +struct LDKBalance Balance_claimable_on_channel_close(uint64_t amount_satoshis); /** * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance */ -struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height); +struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t amount_satoshis, uint32_t confirmation_height); /** * Utility method to constructs a new ContentiousClaimable-variant Balance */ -struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_preimage); +struct LDKBalance Balance_contentious_claimable(uint64_t amount_satoshis, uint32_t timeout_height, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_preimage); /** * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance */ -struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t claimable_height, struct LDKThirtyTwoBytes payment_hash); +struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t amount_satoshis, uint32_t claimable_height, struct LDKThirtyTwoBytes payment_hash); /** * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance */ -struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t expiry_height, struct LDKThirtyTwoBytes payment_hash); +struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t amount_satoshis, uint32_t expiry_height, struct LDKThirtyTwoBytes payment_hash); /** * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance */ -struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t claimable_amount_satoshis); +struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t amount_satoshis); /** * Checks if two Balances contain equal inner contents. @@ -27374,6 +29041,11 @@ MUST_USE_RES uint64_t Balance_claimable_amount_satoshis(const struct LDKBalance */ void ChannelMonitor_free(struct LDKChannelMonitor this_obj); +/** + * Creates a copy of the ChannelMonitor + */ +struct LDKChannelMonitor ChannelMonitor_clone(const struct LDKChannelMonitor *NONNULL_PTR orig); + /** * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read */ @@ -27385,7 +29057,7 @@ struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_ * * panics if the given update is not the next update by update_id. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this @@ -27396,13 +29068,13 @@ MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChanne /** * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for. */ -MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKC2Tuple_OutPointCVec_u8ZZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** * Gets a list of txids, with their output scripts (in the order they appear in the * transaction), which we must learn about spends of via block_connected(). */ -MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly @@ -27434,6 +29106,69 @@ MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_m */ void ChannelMonitor_process_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKEventHandler *NONNULL_PTR handler); +/** + * Gets the counterparty's initial commitment transaction. The returned commitment + * transaction is unsigned. This is intended to be called during the initial persistence of + * the monitor (inside an implementation of [`Persist::persist_new_channel`]), to allow for + * watchtowers in the persistence pipeline to have enough data to form justice transactions. + * + * This is similar to [`Self::counterparty_commitment_txs_from_update`], except + * that for the initial commitment transaction, we don't have a corresponding update. + * + * This will only return `Some` for channel monitors that have been created after upgrading + * to LDK 0.0.117+. + * + * [`Persist::persist_new_channel`]: crate::chain::chainmonitor::Persist::persist_new_channel + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKCommitmentTransaction ChannelMonitor_initial_counterparty_commitment_tx(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + +/** + * Gets all of the counterparty commitment transactions provided by the given update. This + * may be empty if the update doesn't include any new counterparty commitments. Returned + * commitment transactions are unsigned. + * + * This is provided so that watchtower clients in the persistence pipeline are able to build + * justice transactions for each counterparty commitment upon each update. It's intended to be + * used within an implementation of [`Persist::update_persisted_channel`], which is provided + * with a monitor and an update. Once revoked, signing a justice transaction can be done using + * [`Self::sign_to_local_justice_tx`]. + * + * It is expected that a watchtower client may use this method to retrieve the latest counterparty + * commitment transaction(s), and then hold the necessary data until a later update in which + * the monitor has been updated with the corresponding revocation data, at which point the + * monitor can sign the justice transaction. + * + * This will only return a non-empty list for monitor updates that have been created after + * upgrading to LDK 0.0.117+. Note that no restriction lies on the monitors themselves, which + * may have been created prior to upgrading. + * + * [`Persist::update_persisted_channel`]: crate::chain::chainmonitor::Persist::update_persisted_channel + */ +MUST_USE_RES struct LDKCVec_CommitmentTransactionZ ChannelMonitor_counterparty_commitment_txs_from_update(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR update); + +/** + * Wrapper around [`EcdsaChannelSigner::sign_justice_revoked_output`] to make + * signing the justice transaction easier for implementors of + * [`chain::chainmonitor::Persist`]. On success this method returns the provided transaction + * signing the input at `input_idx`. This method will only produce a valid signature for + * a transaction spending the `to_local` output of a commitment transaction, i.e. this cannot + * be used for revoked HTLC outputs. + * + * `Value` is the value of the output being spent by the input at `input_idx`, committed + * in the BIP 143 signature. + * + * This method will only succeed if this monitor has received the revocation secret for the + * provided `commitment_number`. If a commitment number is provided that does not correspond + * to the commitment transaction being revoked, this will return a signed transaction, but + * the signature will not be valid. + * + * [`EcdsaChannelSigner::sign_justice_revoked_output`]: crate::sign::EcdsaChannelSigner::sign_justice_revoked_output + * [`Persist`]: crate::chain::chainmonitor::Persist + */ +MUST_USE_RES struct LDKCResult_TransactionNoneZ ChannelMonitor_sign_to_local_justice_tx(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKTransaction justice_tx, uintptr_t input_idx, uint64_t value, uint64_t commitment_number); + /** * Gets the `node_id` of the counterparty for this channel. * @@ -27445,21 +29180,20 @@ void ChannelMonitor_process_pending_events(const struct LDKChannelMonitor *NONNU MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of - * the Channel was out-of-date. + * Used by [`ChannelManager`] deserialization to broadcast the latest holder state if its copy + * of the channel state was out-of-date. * * You may also use this to broadcast the latest local commitment transaction, either because - * a monitor update failed with [`ChannelMonitorUpdateStatus::PermanentFailure`] or because we've - * fallen behind (i.e. we've received proof that our counterparty side knows a revocation - * secret we gave them that they shouldn't know). + * a monitor update failed or because we've fallen behind (i.e. we've received proof that our + * counterparty side knows a revocation secret we gave them that they shouldn't know). * * Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty * side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't * close channel with their commitment transaction after a substantial amount of time. Best * may be to contact the other node operator out-of-band to coordinate other options available - * to you. In any-case, the choice is up to you. + * to you. * - * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger); @@ -27519,7 +29253,7 @@ MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_best_block_update /** * Returns the set of txids that should be monitored for re-organization out of the chain. */ -MUST_USE_RES struct LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** * Gets the latest best block which was connected either via the [`chain::Listen`] or @@ -27536,6 +29270,28 @@ MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct */ void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +/** + * Returns the descriptors for relevant outputs (i.e., those that we can spend) within the + * transaction if they exist and the transaction has at least [`ANTI_REORG_DELAY`] + * confirmations. For [`SpendableOutputDescriptor::DelayedPaymentOutput`] descriptors to be + * returned, the transaction must have at least `max(ANTI_REORG_DELAY, to_self_delay)` + * confirmations. + * + * Descriptors returned by this method are primarily exposed via [`Event::SpendableOutputs`] + * once they are no longer under reorg risk. This method serves as a way to retrieve these + * descriptors at a later time, either for historical purposes, or to replay any + * missed/unhandled descriptors. For the purpose of gathering historical records, if the + * channel close has fully resolved (i.e., [`ChannelMonitor::get_claimable_balances`] returns + * an empty set), you can retrieve all spendable outputs by providing all descendant spending + * transactions starting from the channel's funding transaction and going down three levels. + * + * `tx` is a transaction we'll scan the outputs of. Any transaction can be provided. If any + * outputs which can be spent by us are found, at least one descriptor is returned. + * + * `confirmation_height` must be the height of the block in which `tx` was included in. + */ +MUST_USE_RES struct LDKCVec_SpendableOutputDescriptorZ ChannelMonitor_get_spendable_outputs(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKTransaction tx, uint32_t confirmation_height); + /** * Gets the balances in this channel which are either claimable by us if we were to * force-close the channel now or which are claimable on-chain (possibly awaiting @@ -27547,8 +29303,7 @@ void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *N * confirmations on the claim transaction. * * Note that for `ChannelMonitors` which track a channel which went on-chain with versions of - * LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted - * a revoked state. + * LDK prior to 0.0.111, not all or excess balances may be included. * * See [`Balance`] for additional details on the types of claimable balances which * may be returned here and their meanings. @@ -27556,9 +29311,9 @@ void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *N MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write + * Read a C2Tuple_ThirtyTwoBytesChannelMonitorZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelMonitorZ_write */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKEntropySource *NONNULL_PTR arg_a, const struct LDKSignerProvider *NONNULL_PTR arg_b); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKEntropySource *NONNULL_PTR arg_a, const struct LDKSignerProvider *NONNULL_PTR arg_b); /** * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL. @@ -27622,25 +29377,35 @@ struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj); */ struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); +/** + * Frees any resources used by the FailureCode + */ +void FailureCode_free(struct LDKFailureCode this_ptr); + /** * Creates a copy of the FailureCode */ -enum LDKFailureCode FailureCode_clone(const enum LDKFailureCode *NONNULL_PTR orig); +struct LDKFailureCode FailureCode_clone(const struct LDKFailureCode *NONNULL_PTR orig); /** * Utility method to constructs a new TemporaryNodeFailure-variant FailureCode */ -enum LDKFailureCode FailureCode_temporary_node_failure(void); +struct LDKFailureCode FailureCode_temporary_node_failure(void); /** * Utility method to constructs a new RequiredNodeFeatureMissing-variant FailureCode */ -enum LDKFailureCode FailureCode_required_node_feature_missing(void); +struct LDKFailureCode FailureCode_required_node_feature_missing(void); /** * Utility method to constructs a new IncorrectOrUnknownPaymentDetails-variant FailureCode */ -enum LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void); +struct LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void); + +/** + * Utility method to constructs a new InvalidOnionPayload-variant FailureCode + */ +struct LDKFailureCode FailureCode_invalid_onion_payload(struct LDKCOption_C2Tuple_u64u16ZZ a); /** * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL. @@ -27828,6 +29593,8 @@ void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounter /** * Constructs a new ChannelCounterparty given each field + * + * Note that forwarding_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg, struct LDKCOption_u64Z outbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z outbound_htlc_maximum_msat_arg); @@ -28032,16 +29799,28 @@ struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const s void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The `user_channel_id` passed in to create_channel, or a random value if the channel was - * inbound. This may be zero for inbound channels serialized with LDK versions prior to - * 0.0.113. + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + * serialized with LDK versions prior to 0.0.113. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The `user_channel_id` passed in to create_channel, or a random value if the channel was - * inbound. This may be zero for inbound channels serialized with LDK versions prior to - * 0.0.113. + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + * serialized with LDK versions prior to 0.0.113. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val); @@ -28361,6 +30140,10 @@ void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, s /** * Constructs a new ChannelDetails given each field + * + * Note that funding_txo_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that config_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, struct LDKU128 user_channel_id_arg, struct LDKCOption_u32Z feerate_sat_per_1000_weight_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t next_outbound_htlc_minimum_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u32Z confirmations_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_channel_ready_arg, struct LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg, bool is_usable_arg, bool is_public_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg); @@ -28435,20 +30218,25 @@ void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr); */ struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig); +/** + * Utility method to constructs a new AwaitingInvoice-variant RecentPaymentDetails + */ +struct LDKRecentPaymentDetails RecentPaymentDetails_awaiting_invoice(struct LDKThirtyTwoBytes payment_id); + /** * Utility method to constructs a new Pending-variant RecentPaymentDetails */ -struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat); +struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat); /** * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails */ -struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKCOption_PaymentHashZ payment_hash); +struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash); /** * Utility method to constructs a new Abandoned-variant RecentPaymentDetails */ -struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_hash); +struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash); /** * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL. @@ -28556,7 +30344,7 @@ MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configurati * * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult__u832APIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, struct LDKU128 user_channel_id, struct LDKUserConfig override_config); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, struct LDKU128 user_channel_id, struct LDKUserConfig override_config); /** * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for @@ -28721,9 +30509,8 @@ void ChannelManager_force_close_all_channels_without_broadcasting_txn(const stru * In general, a path may raise: * * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee, * node public key) is specified. - * * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates - * (including due to previous monitor update failure or new permanent monitor update - * failure). + * * [`APIError::ChannelUnavailable`] if the next-hop channel is not available as it has been + * closed, doesn't exist, or the peer is currently disconnected. * * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the * relevant updates. * @@ -28747,10 +30534,12 @@ MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payme MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); /** - * Signals that no further retries for the given payment should occur. Useful if you have a + * Signals that no further attempts for the given payment should occur. Useful if you have a * pending outbound payment with retries remaining, but wish to stop retrying the payment before * retries are exhausted. * + * # Event Generation + * * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon * as there are no remaining pending HTLCs for this payment. * @@ -28758,11 +30547,10 @@ MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_pay * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to * determine the ultimate status of a payment. * - * If an [`Event::PaymentFailed`] event is generated and we restart without this - * [`ChannelManager`] having been persisted, another [`Event::PaymentFailed`] may be generated. + * # Restart Behavior * - * [`Event::PaymentFailed`]: events::Event::PaymentFailed - * [`Event::PaymentSent`]: events::Event::PaymentSent + * If an [`Event::PaymentFailed`] is generated and we restart without first persisting the + * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated. */ void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); @@ -28781,7 +30569,7 @@ void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR * * [`send_payment`]: Self::send_payment */ -MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKCOption_PaymentPreimageZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); /** * Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route @@ -28792,14 +30580,40 @@ MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_sen * * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend */ -MUST_USE_RES struct LDKCResult_PaymentHashRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_PaymentPreimageZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); /** * Send a payment that is probing the given route for liquidity. We calculate the * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows * us to easily discern them from real payments. */ -MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path); +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path); + +/** + * Sends payment probes over all paths of a route that would be used to pay the given + * amount to the given `node_id`. + * + * See [`ChannelManager::send_preflight_probes`] for more information. + */ +MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_spontaneous_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, uint64_t amount_msat, uint32_t final_cltv_expiry_delta, struct LDKCOption_u64Z liquidity_limit_multiplier); + +/** + * Sends payment probes over all paths of a route that would be used to pay a route found + * according to the given [`RouteParameters`]. + * + * This may be used to send \"pre-flight\" probes, i.e., to train our scorer before conducting + * the actual payment. Note this is only useful if there likely is sufficient time for the + * probe to settle before sending out the actual payment, e.g., when waiting for user + * confirmation in a wallet UI. + * + * Otherwise, there is a chance the probe could take up some liquidity needed to complete the + * actual payment. Users should therefore be cautious and might avoid sending probes if + * liquidity is scarce and/or they don't expect the probe to return before they send the + * payment. To mitigate this issue, channels with available liquidity less than the required + * amount times the given `liquidity_limit_multiplier` won't be used to send pre-flight + * probes. If `None` is given as `liquidity_limit_multiplier`, it defaults to `3`. + */ +MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKRouteParameters route_params, struct LDKCOption_u64Z liquidity_limit_multiplier); /** * Call this upon creation of a funding transaction for the given channel. @@ -28835,6 +30649,20 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ */ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction); +/** + * Call this upon creation of a batch funding transaction for the given channels. + * + * Return values are identical to [`Self::funding_transaction_generated`], respective to + * each individual channel and transaction output. + * + * Do NOT broadcast the funding transaction yourself. This batch funding transcaction + * will only be broadcast when we have safely received and persisted the counterparty's + * signature for each channel. + * + * If there is an error, all channels in the batch are to be considered closed. + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_batch_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels, struct LDKTransaction funding_transaction); + /** * Atomically applies partial updates to the [`ChannelConfig`] of the given channels. * @@ -28977,7 +30805,7 @@ void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_ * * See [`FailureCode`] for valid failure codes. */ -void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], enum LDKFailureCode failure_code); +void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKFailureCode failure_code); /** * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any @@ -28993,15 +30821,33 @@ void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManag * event matches your expectation. If you fail to do so and call this method, you may provide * the sender \"proof-of-payment\" when they did not fulfill the full expected payment. * + * This function will fail the payment if it has custom TLVs with even type numbers, as we + * will assume they are unknown. If you intend to accept even custom TLVs, you should use + * [`claim_funds_with_known_custom_tlvs`]. + * * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed * [`process_pending_events`]: EventsProvider::process_pending_events * [`create_inbound_payment`]: Self::create_inbound_payment * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + * [`claim_funds_with_known_custom_tlvs`]: Self::claim_funds_with_known_custom_tlvs */ void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); +/** + * This is a variant of [`claim_funds`] that allows accepting a payment with custom TLVs with + * even type numbers. + * + * # Note + * + * You MUST check you've understood all even TLVs before using this to + * claim, otherwise you may unintentionally agree to some protocol you do not understand. + * + * [`claim_funds`]: Self::claim_funds + */ +void ChannelManager_claim_funds_with_known_custom_tlvs(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); + /** * Gets the node_id held by this ChannelManager */ @@ -29083,7 +30929,7 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_chann * [`PaymentPurpose::InvoicePayment::payment_preimage`]: events::PaymentPurpose::InvoicePayment::payment_preimage * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash */ -MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is @@ -29133,7 +30979,7 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelMan * [`create_inbound_payment`]: Self::create_inbound_payment * [`PaymentClaimable`]: events::Event::PaymentClaimable */ -MUST_USE_RES struct LDKCResult_PaymentSecretNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry); /** * Gets an LDK-generated payment preimage from a payment hash and payment secret that were @@ -29141,7 +30987,7 @@ MUST_USE_RES struct LDKCResult_PaymentSecretNoneZ ChannelManager_create_inbound_ * * [`create_inbound_payment`]: Self::create_inbound_payment */ -MUST_USE_RES struct LDKCResult_PaymentPreimageAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); /** * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids @@ -29199,13 +31045,21 @@ struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNUL struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Gets a [`Future`] that completes when this [`ChannelManager`] needs to be persisted. + * Gets a [`Future`] that completes when this [`ChannelManager`] may need to be persisted or + * may have events that need processing. + * + * In order to check if this [`ChannelManager`] needs persisting, call + * [`Self::get_and_clear_needs_persistence`]. * * Note that callbacks registered on the [`Future`] MUST NOT call back into this * [`ChannelManager`] and should instead register actions to be taken later. - * */ -MUST_USE_RES struct LDKFuture ChannelManager_get_persistable_update_future(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKFuture ChannelManager_get_event_or_persistence_needed_future(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Returns true if this [`ChannelManager`] needs to be persisted. + */ +MUST_USE_RES bool ChannelManager_get_and_clear_needs_persistence(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Gets the latest best block which was connected either via the [`chain::Listen`] or @@ -29437,9 +31291,9 @@ void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors); /** - * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write + * Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); /** * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL. @@ -29470,7 +31324,7 @@ MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material) * [phantom node payments]: crate::sign::PhantomKeysManager * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKEntropySource *NONNULL_PTR entropy_source, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKEntropySource *NONNULL_PTR entropy_source, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`], @@ -29484,7 +31338,7 @@ struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ create(const struct LDK * * [phantom node payments]: crate::sign::PhantomKeysManager */ -struct LDKCResult_PaymentSecretNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +struct LDKCResult_ThirtyTwoBytesNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** * Frees any resources used by the DecodeError @@ -29559,14 +31413,14 @@ void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatu * * Returns a copy of the field. */ -struct LDKCOption_CVec_ChainHashZZ Init_get_networks(const struct LDKInit *NONNULL_PTR this_ptr); +struct LDKCOption_CVec_ThirtyTwoBytesZZ Init_get_networks(const struct LDKInit *NONNULL_PTR this_ptr); /** * Indicates chains the sender is interested in. * * If there are no common chains, the connection will be closed. */ -void Init_set_networks(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_CVec_ChainHashZZ val); +void Init_set_networks(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_CVec_ThirtyTwoBytesZZ val); /** * The receipient's network address. @@ -29576,7 +31430,7 @@ void Init_set_networks(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_C * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing * the new address. */ -struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr); +struct LDKCOption_SocketAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr); /** * The receipient's network address. @@ -29586,12 +31440,12 @@ struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKIn * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing * the new address. */ -void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val); +void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_SocketAddressZ val); /** * Constructs a new Init given each field */ -MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_CVec_ChainHashZZ networks_arg, struct LDKCOption_NetAddressZ remote_network_address_arg); +MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg, struct LDKCOption_SocketAddressZ remote_network_address_arg); /** * Creates a copy of the Init @@ -29989,12 +31843,12 @@ void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, /** * A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close */ -struct LDKCOption_ScriptZ OpenChannel_get_shutdown_scriptpubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKCOption_CVec_u8ZZ OpenChannel_get_shutdown_scriptpubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close */ -void OpenChannel_set_shutdown_scriptpubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKCOption_ScriptZ val); +void OpenChannel_set_shutdown_scriptpubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** * The channel type that this channel will represent @@ -30018,8 +31872,10 @@ void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, s /** * Constructs a new OpenChannel given each field + * + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKOpenChannel OpenChannel_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t funding_satoshis_arg, uint64_t push_msat_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t channel_reserve_satoshis_arg, uint64_t htlc_minimum_msat_arg, uint32_t feerate_per_kw_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, uint8_t channel_flags_arg, struct LDKCOption_ScriptZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); +MUST_USE_RES struct LDKOpenChannel OpenChannel_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t funding_satoshis_arg, uint64_t push_msat_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t channel_reserve_satoshis_arg, uint64_t htlc_minimum_msat_arg, uint32_t feerate_per_kw_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, uint8_t channel_flags_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); /** * Creates a copy of the OpenChannel @@ -30238,13 +32094,13 @@ void OpenChannelV2_set_channel_flags(struct LDKOpenChannelV2 *NONNULL_PTR this_p * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we * collaboratively close */ -struct LDKCOption_ScriptZ OpenChannelV2_get_shutdown_scriptpubkey(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +struct LDKCOption_CVec_u8ZZ OpenChannelV2_get_shutdown_scriptpubkey(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); /** * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we * collaboratively close */ -void OpenChannelV2_set_shutdown_scriptpubkey(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKCOption_ScriptZ val); +void OpenChannelV2_set_shutdown_scriptpubkey(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** * The channel type that this channel will represent. If none is set, we derive the channel @@ -30276,8 +32132,10 @@ void OpenChannelV2_set_require_confirmed_inputs(struct LDKOpenChannelV2 *NONNULL /** * Constructs a new OpenChannelV2 given each field + * + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKOpenChannelV2 OpenChannelV2_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKThirtyTwoBytes temporary_channel_id_arg, uint32_t funding_feerate_sat_per_1000_weight_arg, uint32_t commitment_feerate_sat_per_1000_weight_arg, uint64_t funding_satoshis_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, uint32_t locktime_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKPublicKey second_per_commitment_point_arg, uint8_t channel_flags_arg, struct LDKCOption_ScriptZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); +MUST_USE_RES struct LDKOpenChannelV2 OpenChannelV2_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKThirtyTwoBytes temporary_channel_id_arg, uint32_t funding_feerate_sat_per_1000_weight_arg, uint32_t commitment_feerate_sat_per_1000_weight_arg, uint64_t funding_satoshis_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, uint32_t locktime_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKPublicKey second_per_commitment_point_arg, uint8_t channel_flags_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); /** * Creates a copy of the OpenChannelV2 @@ -30439,12 +32297,12 @@ void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNU /** * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close */ -struct LDKCOption_ScriptZ AcceptChannel_get_shutdown_scriptpubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCOption_CVec_u8ZZ AcceptChannel_get_shutdown_scriptpubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close */ -void AcceptChannel_set_shutdown_scriptpubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKCOption_ScriptZ val); +void AcceptChannel_set_shutdown_scriptpubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** * The channel type that this channel will represent. @@ -30470,8 +32328,10 @@ void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_pt /** * Constructs a new AcceptChannel given each field + * + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKAcceptChannel AcceptChannel_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t channel_reserve_satoshis_arg, uint64_t htlc_minimum_msat_arg, uint32_t minimum_depth_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKCOption_ScriptZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); +MUST_USE_RES struct LDKAcceptChannel AcceptChannel_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t channel_reserve_satoshis_arg, uint64_t htlc_minimum_msat_arg, uint32_t minimum_depth_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); /** * Creates a copy of the AcceptChannel @@ -30650,13 +32510,13 @@ void AcceptChannelV2_set_second_per_commitment_point(struct LDKAcceptChannelV2 * * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we * collaboratively close */ -struct LDKCOption_ScriptZ AcceptChannelV2_get_shutdown_scriptpubkey(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCOption_CVec_u8ZZ AcceptChannelV2_get_shutdown_scriptpubkey(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); /** * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we * collaboratively close */ -void AcceptChannelV2_set_shutdown_scriptpubkey(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKCOption_ScriptZ val); +void AcceptChannelV2_set_shutdown_scriptpubkey(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** * The channel type that this channel will represent. If none is set, we derive the channel @@ -30692,8 +32552,10 @@ void AcceptChannelV2_set_require_confirmed_inputs(struct LDKAcceptChannelV2 *NON /** * Constructs a new AcceptChannelV2 given each field + * + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKAcceptChannelV2 AcceptChannelV2_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t funding_satoshis_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint32_t minimum_depth_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKPublicKey second_per_commitment_point_arg, struct LDKCOption_ScriptZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); +MUST_USE_RES struct LDKAcceptChannelV2 AcceptChannelV2_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t funding_satoshis_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint32_t minimum_depth_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKPublicKey second_per_commitment_point_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); /** * Creates a copy of the AcceptChannelV2 @@ -30745,17 +32607,17 @@ void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_P /** * The signature of the channel initiator (funder) on the initial commitment transaction */ -struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr); +struct LDKECDSASignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** * The signature of the channel initiator (funder) on the initial commitment transaction */ -void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val); +void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Constructs a new FundingCreated given each field */ -MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg); +MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKECDSASignature signature_arg); /** * Creates a copy of the FundingCreated @@ -30787,17 +32649,17 @@ void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, /** * The signature of the channel acceptor (fundee) on the initial commitment transaction */ -struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); +struct LDKECDSASignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); /** * The signature of the channel acceptor (fundee) on the initial commitment transaction */ -void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); +void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Constructs a new FundingSigned given each field */ -MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg); +MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKECDSASignature signature_arg); /** * Creates a copy of the FundingSigned @@ -31451,12 +33313,12 @@ void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_pt /** * A signature on the closing transaction */ -struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +struct LDKECDSASignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** * A signature on the closing transaction */ -void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); +void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * The minimum and maximum fees which the sender is willing to accept, provided only by new @@ -31476,8 +33338,10 @@ void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, /** * Constructs a new ClosingSigned given each field + * + * Note that fee_range_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg); +MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKECDSASignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg); /** * Creates a copy of the ClosingSigned @@ -31589,6 +33453,21 @@ struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage */ void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val); +/** + * The full onion packet including hop data, pubkey, and hmac + */ +struct LDKPacket OnionMessage_get_onion_routing_packet(const struct LDKOnionMessage *NONNULL_PTR this_ptr); + +/** + * The full onion packet including hop data, pubkey, and hmac + */ +void OnionMessage_set_onion_routing_packet(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPacket val); + +/** + * Constructs a new OnionMessage given each field + */ +MUST_USE_RES struct LDKOnionMessage OnionMessage_new(struct LDKPublicKey blinding_point_arg, struct LDKPacket onion_routing_packet_arg); + /** * Creates a copy of the OnionMessage */ @@ -31755,29 +33634,29 @@ void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR thi /** * A signature on the commitment transaction */ -struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); +struct LDKECDSASignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** * A signature on the commitment transaction */ -void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val); +void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Signatures on the HTLC transactions * * Returns a copy of the field. */ -struct LDKCVec_SignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); +struct LDKCVec_ECDSASignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** * Signatures on the HTLC transactions */ -void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); +void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val); /** * Constructs a new CommitmentSigned given each field */ -MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg); +MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKECDSASignature signature_arg, struct LDKCVec_ECDSASignatureZ htlc_signatures_arg); /** * Creates a copy of the CommitmentSigned @@ -31945,17 +33824,17 @@ void ChannelReestablish_set_my_current_per_commitment_point(struct LDKChannelRee /** * The next funding transaction ID */ -struct LDKCOption_TxidZ ChannelReestablish_get_next_funding_txid(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +struct LDKCOption_ThirtyTwoBytesZ ChannelReestablish_get_next_funding_txid(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** * The next funding transaction ID */ -void ChannelReestablish_set_next_funding_txid(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKCOption_TxidZ val); +void ChannelReestablish_set_next_funding_txid(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** * Constructs a new ChannelReestablish given each field */ -MUST_USE_RES struct LDKChannelReestablish ChannelReestablish_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t next_local_commitment_number_arg, uint64_t next_remote_commitment_number_arg, struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg, struct LDKCOption_TxidZ next_funding_txid_arg); +MUST_USE_RES struct LDKChannelReestablish ChannelReestablish_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t next_local_commitment_number_arg, uint64_t next_remote_commitment_number_arg, struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg, struct LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg); /** * Creates a copy of the ChannelReestablish @@ -31997,27 +33876,27 @@ void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignature /** * A signature by the node key */ -struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +struct LDKECDSASignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** * A signature by the node key */ -void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); +void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * A signature by the funding key */ -struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +struct LDKECDSASignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** * A signature by the funding key */ -void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); +void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Constructs a new AnnouncementSignatures given each field */ -MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKSignature node_signature_arg, struct LDKSignature bitcoin_signature_arg); +MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKECDSASignature node_signature_arg, struct LDKECDSASignature bitcoin_signature_arg); /** * Creates a copy of the AnnouncementSignatures @@ -32032,55 +33911,98 @@ struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAn bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b); /** - * Frees any resources used by the NetAddress + * Frees any resources used by the SocketAddress */ -void NetAddress_free(struct LDKNetAddress this_ptr); +void SocketAddress_free(struct LDKSocketAddress this_ptr); /** - * Creates a copy of the NetAddress + * Creates a copy of the SocketAddress */ -struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig); +struct LDKSocketAddress SocketAddress_clone(const struct LDKSocketAddress *NONNULL_PTR orig); /** - * Utility method to constructs a new IPv4-variant NetAddress + * Utility method to constructs a new TcpIpV4-variant SocketAddress */ -struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port); +struct LDKSocketAddress SocketAddress_tcp_ip_v4(struct LDKFourBytes addr, uint16_t port); /** - * Utility method to constructs a new IPv6-variant NetAddress + * Utility method to constructs a new TcpIpV6-variant SocketAddress */ -struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port); +struct LDKSocketAddress SocketAddress_tcp_ip_v6(struct LDKSixteenBytes addr, uint16_t port); /** - * Utility method to constructs a new OnionV2-variant NetAddress + * Utility method to constructs a new OnionV2-variant SocketAddress */ -struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a); +struct LDKSocketAddress SocketAddress_onion_v2(struct LDKTwelveBytes a); /** - * Utility method to constructs a new OnionV3-variant NetAddress + * Utility method to constructs a new OnionV3-variant SocketAddress */ -struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); +struct LDKSocketAddress SocketAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); /** - * Utility method to constructs a new Hostname-variant NetAddress + * Utility method to constructs a new Hostname-variant SocketAddress */ -struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port); +struct LDKSocketAddress SocketAddress_hostname(struct LDKHostname hostname, uint16_t port); /** - * Checks if two NetAddresss contain equal inner contents. + * Checks if two SocketAddresss contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. */ -bool NetAddress_eq(const struct LDKNetAddress *NONNULL_PTR a, const struct LDKNetAddress *NONNULL_PTR b); +bool SocketAddress_eq(const struct LDKSocketAddress *NONNULL_PTR a, const struct LDKSocketAddress *NONNULL_PTR b); /** - * Serialize the NetAddress object into a byte array which can be read by NetAddress_read + * Serialize the SocketAddress object into a byte array which can be read by SocketAddress_read */ -struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj); +struct LDKCVec_u8Z SocketAddress_write(const struct LDKSocketAddress *NONNULL_PTR obj); /** - * Read a NetAddress from a byte array, created by NetAddress_write + * Read a SocketAddress from a byte array, created by SocketAddress_write */ -struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser); +struct LDKCResult_SocketAddressDecodeErrorZ SocketAddress_read(struct LDKu8slice ser); + +/** + * Creates a copy of the SocketAddressParseError + */ +enum LDKSocketAddressParseError SocketAddressParseError_clone(const enum LDKSocketAddressParseError *NONNULL_PTR orig); + +/** + * Utility method to constructs a new SocketAddrParse-variant SocketAddressParseError + */ +enum LDKSocketAddressParseError SocketAddressParseError_socket_addr_parse(void); + +/** + * Utility method to constructs a new InvalidInput-variant SocketAddressParseError + */ +enum LDKSocketAddressParseError SocketAddressParseError_invalid_input(void); + +/** + * Utility method to constructs a new InvalidPort-variant SocketAddressParseError + */ +enum LDKSocketAddressParseError SocketAddressParseError_invalid_port(void); + +/** + * Utility method to constructs a new InvalidOnionV3-variant SocketAddressParseError + */ +enum LDKSocketAddressParseError SocketAddressParseError_invalid_onion_v3(void); + +/** + * Checks if two SocketAddressParseErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool SocketAddressParseError_eq(const enum LDKSocketAddressParseError *NONNULL_PTR a, const enum LDKSocketAddressParseError *NONNULL_PTR b); + +/** + * Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`]. + * + * The host part must end with \".onion\". + */ +struct LDKCResult_SocketAddressSocketAddressParseErrorZ parse_onion_address(struct LDKStr host, uint16_t port); + +/** + * Read a SocketAddress object from a string + */ +struct LDKCResult_SocketAddressSocketAddressParseErrorZ SocketAddress_from_str(struct LDKStr s); /** * Frees any resources used by the UnsignedGossipMessage @@ -32178,12 +34100,12 @@ void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONN * * Returns a copy of the field. */ -struct LDKCVec_NetAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKCVec_SocketAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** * List of addresses on which this node is reachable */ -void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); +void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_SocketAddressZ val); /** * Creates a copy of the UnsignedNodeAnnouncement @@ -32205,12 +34127,12 @@ void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj); /** * The signature by the node key */ -struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKECDSASignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** * The signature by the node key */ -void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * The actual content of the announcement @@ -32225,7 +34147,7 @@ void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ /** * Constructs a new NodeAnnouncement given each field */ -MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); +MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); /** * Creates a copy of the NodeAnnouncement @@ -32314,6 +34236,29 @@ struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKU */ void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); +/** + * Excess data which was signed as a part of the message which we do not (yet) understand how + * to decode. + * + * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. + * + * Returns a copy of the field. + */ +struct LDKCVec_u8Z UnsignedChannelAnnouncement_get_excess_data(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); + +/** + * Excess data which was signed as a part of the message which we do not (yet) understand how + * to decode. + * + * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. + */ +void UnsignedChannelAnnouncement_set_excess_data(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); + +/** + * Constructs a new UnsignedChannelAnnouncement given each field + */ +MUST_USE_RES struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_new(struct LDKChannelFeatures features_arg, struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, struct LDKNodeId node_id_1_arg, struct LDKNodeId node_id_2_arg, struct LDKNodeId bitcoin_key_1_arg, struct LDKNodeId bitcoin_key_2_arg, struct LDKCVec_u8Z excess_data_arg); + /** * Creates a copy of the UnsignedChannelAnnouncement */ @@ -32334,42 +34279,42 @@ void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj); /** * Authentication of the announcement by the first public node */ -struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKECDSASignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Authentication of the announcement by the first public node */ -void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Authentication of the announcement by the second public node */ -struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKECDSASignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Authentication of the announcement by the second public node */ -void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Proof of funding UTXO ownership by the first public node */ -struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Proof of funding UTXO ownership by the first public node */ -void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Proof of funding UTXO ownership by the second public node */ -struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Proof of funding UTXO ownership by the second public node */ -void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * The actual announcement @@ -32384,7 +34329,7 @@ void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR /** * Constructs a new ChannelAnnouncement given each field */ -MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSignature node_signature_1_arg, struct LDKSignature node_signature_2_arg, struct LDKSignature bitcoin_signature_1_arg, struct LDKSignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg); +MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKECDSASignature node_signature_1_arg, struct LDKECDSASignature node_signature_2_arg, struct LDKECDSASignature bitcoin_signature_1_arg, struct LDKECDSASignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg); /** * Creates a copy of the ChannelAnnouncement @@ -32554,12 +34499,12 @@ void ChannelUpdate_free(struct LDKChannelUpdate this_obj); /** * A signature of the channel update */ -struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); +struct LDKECDSASignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** * A signature of the channel update */ -void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val); +void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * The actual channel update @@ -32574,7 +34519,7 @@ void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, s /** * Constructs a new ChannelUpdate given each field */ -MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); +MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); /** * Creates a copy of the ChannelUpdate @@ -33005,6 +34950,8 @@ void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_ /** * Constructs a new CommitmentUpdate given each field + * + * Note that update_fee_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, struct LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, struct LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, struct LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg); @@ -33702,7 +35649,7 @@ MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler mess * The returned `Option`s will only be `Some` if an address had been previously given via * [`Self::new_outbound_connection`] or [`Self::new_inbound_connection`]. */ -MUST_USE_RES struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); /** * Indicates a new outbound connection has been established to a node with the given `node_id` @@ -33721,7 +35668,7 @@ MUST_USE_RES struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ PeerManager_g * * [`socket_disconnected`]: PeerManager::socket_disconnected */ -MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address); +MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor, struct LDKCOption_SocketAddressZ remote_network_address); /** * Indicates a new inbound connection has been established to a node with an optional remote @@ -33740,7 +35687,7 @@ MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound * * [`socket_disconnected`]: PeerManager::socket_disconnected */ -MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address); +MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_SocketAddressZ remote_network_address); /** * Indicates that there is room to write data to the given socket descriptor. @@ -33854,7 +35801,7 @@ void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR th * * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events */ -void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses); +void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_SocketAddressZ addresses); /** * Gets the weight for an HTLC-Success transaction. @@ -34169,6 +36116,11 @@ MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicK */ struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys. + */ +uint64_t ChannelPublicKeys_hash(const struct LDKChannelPublicKeys *NONNULL_PTR o); + /** * Checks if two ChannelPublicKeyss contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -34205,6 +36157,12 @@ MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_from_channel_static_keys(st */ struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key); +/** + * Returns the script for the counterparty's output on a holder's commitment transaction based on + * the channel type. + */ +struct LDKCVec_u8Z get_counterparty_payment_script(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, struct LDKPublicKey payment_key); + /** * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL. */ @@ -34325,7 +36283,7 @@ struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32 /** * Returns the witness required to satisfy and spend a HTLC input. */ -struct LDKWitness build_htlc_input_witness(struct LDKSignature local_sig, struct LDKSignature remote_sig, struct LDKCOption_PaymentPreimageZ preimage, struct LDKu8slice redeem_script, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); +struct LDKWitness build_htlc_input_witness(struct LDKECDSASignature local_sig, struct LDKECDSASignature remote_sig, struct LDKCOption_ThirtyTwoBytesZ preimage, struct LDKu8slice redeem_script, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); /** * Gets the witnessScript for the to_remote output when anchors are enabled. @@ -34345,7 +36303,7 @@ struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey); /** * Returns the witness required to satisfy and spend an anchor input. */ -struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKSignature funding_sig); +struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKECDSASignature funding_sig); /** * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL. @@ -34428,6 +36386,9 @@ void ChannelTransactionParameters_set_channel_type_features(struct LDKChannelTra /** * Constructs a new ChannelTransactionParameters given each field + * + * Note that counterparty_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that funding_outpoint_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg, struct LDKChannelTypeFeatures channel_type_features_arg); @@ -34436,6 +36397,11 @@ MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters */ struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the ChannelTransactionParameters. + */ +uint64_t ChannelTransactionParameters_hash(const struct LDKChannelTransactionParameters *NONNULL_PTR o); + /** * Checks if two ChannelTransactionParameterss contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -34478,6 +36444,11 @@ MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChan */ struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the CounterpartyChannelTransactionParameters. + */ +uint64_t CounterpartyChannelTransactionParameters_hash(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR o); + /** * Checks if two CounterpartyChannelTransactionParameterss contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -34573,24 +36544,24 @@ void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this /** * Our counterparty's signature for the transaction */ -struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); +struct LDKECDSASignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); /** * Our counterparty's signature for the transaction */ -void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val); +void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * All non-dust counterparty HTLC signatures, in the order they appear in the transaction * * Returns a copy of the field. */ -struct LDKCVec_SignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); +struct LDKCVec_ECDSASignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); /** * All non-dust counterparty HTLC signatures, in the order they appear in the transaction */ -void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); +void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val); /** * Creates a copy of the HolderCommitmentTransaction @@ -34611,7 +36582,7 @@ struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransa * Create a new holder transaction with the given counterparty signatures. * The funding keys are used to figure out which signature should go first when building the transaction for broadcast. */ -MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, struct LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key); +MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKECDSASignature counterparty_sig, struct LDKCVec_ECDSASignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key); /** * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL. @@ -34674,12 +36645,12 @@ MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all /** * Signs the counterparty's commitment transaction. */ -MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign_counterparty_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +MUST_USE_RES struct LDKECDSASignature BuiltCommitmentTransaction_sign_counterparty_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** * Signs the holder commitment transaction because we are about to broadcast it. */ -MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign_holder_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis, const struct LDKEntropySource *NONNULL_PTR entropy_source); +MUST_USE_RES struct LDKECDSASignature BuiltCommitmentTransaction_sign_holder_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis, const struct LDKEntropySource *NONNULL_PTR entropy_source); /** * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL. @@ -34769,7 +36740,7 @@ MUST_USE_RES struct LDKThirtyTwoBytes TrustedClosingTransaction_get_sighash_all( * Sign a transaction, either because we are counter-signing the counterparty's transaction or * because we are about to broadcast a holder transaction. */ -MUST_USE_RES struct LDKSignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +MUST_USE_RES struct LDKECDSASignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL. @@ -34864,7 +36835,35 @@ MUST_USE_RES struct LDKChannelTypeFeatures TrustedCommitmentTransaction_channel_ * * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All. */ -MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKEntropySource *NONNULL_PTR entropy_source); +MUST_USE_RES struct LDKCResult_CVec_ECDSASignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKEntropySource *NONNULL_PTR entropy_source); + +/** + * Returns the index of the revokeable output, i.e. the `to_local` output sending funds to + * the broadcaster, in the built transaction, if any exists. + * + * There are two cases where this may return `None`: + * - The balance of the revokeable output is below the dust limit (only found on commitments + * early in the channel's lifetime, i.e. before the channel reserve is met). + * - This commitment was created before LDK 0.0.117. In this case, the + * commitment transaction previously didn't contain enough information to locate the + * revokeable output. + */ +MUST_USE_RES struct LDKCOption_usizeZ TrustedCommitmentTransaction_revokeable_output_index(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); + +/** + * Helper method to build an unsigned justice transaction spending the revokeable + * `to_local` output to a destination script. Fee estimation accounts for the expected + * revocation witness data that will be added when signed. + * + * This method will error if the given fee rate results in a fee greater than the value + * of the output being spent, or if there exists no revokeable `to_local` output on this + * commitment transaction. See [`Self::revokeable_output_index`] for more details. + * + * The built transaction will allow fee bumping with RBF, and this method takes + * `feerate_per_kw` as an input such that multiple copies of a justice transaction at different + * fee rates may be built. + */ +MUST_USE_RES struct LDKCResult_TransactionNoneZ TrustedCommitmentTransaction_build_to_local_justice_tx(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, uint64_t feerate_per_kw, struct LDKCVec_u8Z destination_script); /** * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a @@ -35045,6 +37044,28 @@ MUST_USE_RES bool InitFeatures_requires_unknown_bits_from(const struct LDKInitFe */ MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_required_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_optional_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35083,6 +37104,28 @@ MUST_USE_RES bool NodeFeatures_requires_unknown_bits_from(const struct LDKNodeFe */ MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_required_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_optional_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35121,6 +37164,28 @@ MUST_USE_RES bool ChannelFeatures_requires_unknown_bits_from(const struct LDKCha */ MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_required_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_optional_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35159,6 +37224,28 @@ MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits_from(const struct */ MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_required_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_optional_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35197,6 +37284,28 @@ MUST_USE_RES bool OfferFeatures_requires_unknown_bits_from(const struct LDKOffer */ MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_required_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_optional_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35235,6 +37344,28 @@ MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits_from(const struct */ MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_required_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_optional_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35273,6 +37404,28 @@ MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits_from(const struct */ MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_required_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_optional_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35311,6 +37464,28 @@ MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits_from(const struct LDK */ MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_required_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_optional_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35349,6 +37524,28 @@ MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits_from(const struct LD */ MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_required_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_optional_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -36036,6 +38233,66 @@ MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitF */ MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +/** + * Set this feature as optional. + */ +void InitFeatures_set_taproot_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_taproot_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_taproot_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_taproot_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void ChannelTypeFeatures_set_taproot_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void ChannelTypeFeatures_set_taproot_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool ChannelTypeFeatures_supports_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool ChannelTypeFeatures_requires_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + /** * Set this feature as optional. */ @@ -36386,7 +38643,7 @@ struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig); /** * Utility method to constructs a new Attempts-variant Retry */ -struct LDKRetry Retry_attempts(uintptr_t a); +struct LDKRetry Retry_attempts(uint32_t a); /** * Utility method to constructs a new Timeout-variant Retry @@ -36404,6 +38661,16 @@ bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNU */ uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o); +/** + * Serialize the Retry object into a byte array which can be read by Retry_read + */ +struct LDKCVec_u8Z Retry_write(const struct LDKRetry *NONNULL_PTR obj); + +/** + * Read a Retry from a byte array, created by Retry_write + */ +struct LDKCResult_RetryDecodeErrorZ Retry_read(struct LDKu8slice ser); + /** * Creates a copy of the RetryableSendFailure */ @@ -36465,6 +38732,38 @@ struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void); */ struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id); +/** + * Checks if two PaymentSendFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool PaymentSendFailure_eq(const struct LDKPaymentSendFailure *NONNULL_PTR a, const struct LDKPaymentSendFailure *NONNULL_PTR b); + +/** + * Frees any resources used by the ProbeSendFailure + */ +void ProbeSendFailure_free(struct LDKProbeSendFailure this_ptr); + +/** + * Creates a copy of the ProbeSendFailure + */ +struct LDKProbeSendFailure ProbeSendFailure_clone(const struct LDKProbeSendFailure *NONNULL_PTR orig); + +/** + * Utility method to constructs a new RouteNotFound-variant ProbeSendFailure + */ +struct LDKProbeSendFailure ProbeSendFailure_route_not_found(void); + +/** + * Utility method to constructs a new SendingFailed-variant ProbeSendFailure + */ +struct LDKProbeSendFailure ProbeSendFailure_sending_failed(struct LDKPaymentSendFailure a); + +/** + * Checks if two ProbeSendFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool ProbeSendFailure_eq(const struct LDKProbeSendFailure *NONNULL_PTR a, const struct LDKProbeSendFailure *NONNULL_PTR b); + /** * Frees any resources used by the RecipientOnionFields, if is_owned is set and inner is non-NULL. */ @@ -36483,7 +38782,7 @@ void RecipientOnionFields_free(struct LDKRecipientOnionFields this_obj); * want to provide a secret for a spontaneous payment if MPP is needed and you know your * recipient will not reject it. */ -struct LDKCOption_PaymentSecretZ RecipientOnionFields_get_payment_secret(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); +struct LDKCOption_ThirtyTwoBytesZ RecipientOnionFields_get_payment_secret(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); /** * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat @@ -36498,7 +38797,7 @@ struct LDKCOption_PaymentSecretZ RecipientOnionFields_get_payment_secret(const s * want to provide a secret for a spontaneous payment if MPP is needed and you know your * recipient will not reject it. */ -void RecipientOnionFields_set_payment_secret(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_PaymentSecretZ val); +void RecipientOnionFields_set_payment_secret(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of @@ -36534,11 +38833,6 @@ struct LDKCOption_CVec_u8ZZ RecipientOnionFields_get_payment_metadata(const stru */ void RecipientOnionFields_set_payment_metadata(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); -/** - * Constructs a new RecipientOnionFields given each field - */ -MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_new(struct LDKCOption_PaymentSecretZ payment_secret_arg, struct LDKCOption_CVec_u8ZZ payment_metadata_arg); - /** * Creates a copy of the RecipientOnionFields */ @@ -36580,25 +38874,181 @@ MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_secret_only(str */ MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_spontaneous_empty(void); +/** + * Creates a new [`RecipientOnionFields`] from an existing one, adding custom TLVs. Each + * TLV is provided as a `(u64, Vec)` for the type number and serialized value + * respectively. TLV type numbers must be unique and within the range + * reserved for custom types, i.e. >= 2^16, otherwise this method will return `Err(())`. + * + * This method will also error for types in the experimental range which have been + * standardized within the protocol, which only includes 5482373484 (keysend) for now. + * + * See [`Self::custom_tlvs`] for more info. + */ +MUST_USE_RES struct LDKCResult_RecipientOnionFieldsNoneZ RecipientOnionFields_with_custom_tlvs(struct LDKRecipientOnionFields this_arg, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs); + +/** + * Gets the custom TLVs that will be sent or have been received. + * + * Custom TLVs allow sending extra application-specific data with a payment. They provide + * additional flexibility on top of payment metadata, as while other implementations may + * require `payment_metadata` to reflect metadata provided in an invoice, custom TLVs + * do not have this restriction. + * + * Note that if this field is non-empty, it will contain strictly increasing TLVs, each + * represented by a `(u64, Vec)` for its type number and serialized value respectively. + * This is validated when setting this field using [`Self::with_custom_tlvs`]. + */ +MUST_USE_RES struct LDKCVec_C2Tuple_u64CVec_u8ZZZ RecipientOnionFields_custom_tlvs(const struct LDKRecipientOnionFields *NONNULL_PTR this_arg); + /** * Calls the free function if one is set */ void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr); +/** + * Creates a copy of a Type + */ +struct LDKType Type_clone(const struct LDKType *NONNULL_PTR orig); + /** * Calls the free function if one is set */ void Type_free(struct LDKType this_ptr); +/** + * Frees any resources used by the Offer, if is_owned is set and inner is non-NULL. + */ +void Offer_free(struct LDKOffer this_obj); + +/** + * Creates a copy of the Offer + */ +struct LDKOffer Offer_clone(const struct LDKOffer *NONNULL_PTR orig); + +/** + * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). + * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) + * for the selected chain. + */ +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ Offer_chains(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Opaque bytes set by the originator. Useful for authentication and validating fields since it + * is reflected in `invoice_request` messages along with all the other fields from the `offer`. + */ +MUST_USE_RES struct LDKCOption_CVec_u8ZZ Offer_metadata(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * The minimum amount required for a successful payment of a single item. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKAmount Offer_amount(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * A complete description of the purpose of the payment. Intended to be displayed to the user + * but with the caveat that it has not been verified in any way. + */ +MUST_USE_RES struct LDKPrintableString Offer_description(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Features pertaining to the offer. + */ +MUST_USE_RES struct LDKOfferFeatures Offer_offer_features(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * If `None`, the offer does not expire. + */ +MUST_USE_RES struct LDKCOption_u64Z Offer_absolute_expiry(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be + * displayed to the user but with the caveat that it has not been verified in any way. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString Offer_issuer(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. + */ +MUST_USE_RES struct LDKCVec_BlindedPathZ Offer_paths(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * The quantity of items supported. + */ +MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * The public key used by the recipient to sign invoices. + */ +MUST_USE_RES struct LDKPublicKey Offer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Returns whether the given chain is supported by the offer. + */ +MUST_USE_RES bool Offer_supports_chain(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes chain); + +/** + * Whether the offer has expired. + */ +MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Returns whether the given quantity is valid for the offer. + */ +MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t quantity); + +/** + * Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ +MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Serialize the Offer object into a byte array which can be read by Offer_read + */ +struct LDKCVec_u8Z Offer_write(const struct LDKOffer *NONNULL_PTR obj); + +/** + * Frees any resources used by the Amount, if is_owned is set and inner is non-NULL. + */ +void Amount_free(struct LDKAmount this_obj); + +/** + * Creates a copy of the Amount + */ +struct LDKAmount Amount_clone(const struct LDKAmount *NONNULL_PTR orig); + +/** + * Frees any resources used by the Quantity, if is_owned is set and inner is non-NULL. + */ +void Quantity_free(struct LDKQuantity this_obj); + +/** + * Creates a copy of the Quantity + */ +struct LDKQuantity Quantity_clone(const struct LDKQuantity *NONNULL_PTR orig); + +/** + * Read a Offer object from a string + */ +struct LDKCResult_OfferBolt12ParseErrorZ Offer_from_str(struct LDKStr s); + /** * Frees any resources used by the UnsignedBolt12Invoice, if is_owned is set and inner is non-NULL. */ void UnsignedBolt12Invoice_free(struct LDKUnsignedBolt12Invoice this_obj); /** - * The public key corresponding to the key needed to sign the invoice. + * Returns the [`TaggedHash`] of the invoice to sign. */ -MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKTaggedHash UnsignedBolt12Invoice_tagged_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** * Frees any resources used by the Bolt12Invoice, if is_owned is set and inner is non-NULL. @@ -36611,11 +39061,331 @@ void Bolt12Invoice_free(struct LDKBolt12Invoice this_obj); struct LDKBolt12Invoice Bolt12Invoice_clone(const struct LDKBolt12Invoice *NONNULL_PTR orig); /** - * A complete description of the purpose of the originating offer or refund. Intended to be - * displayed to the user but with the caveat that it has not been verified in any way. + * The chains that may be used when paying a requested invoice. + * + * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`]. + * + * [`Offer::chains`]: crate::offers::offer::Offer::chains + */ +MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ UnsignedBolt12Invoice_offer_chains(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the + * invoice originated from an offer. + * + * From [`InvoiceRequest::chain`] or [`Refund::chain`]. + * + * [`offer_chains`]: Self::offer_chains + * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain + */ +MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_chain(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Opaque bytes set by the originating [`Offer`]. + * + * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or + * if the [`Offer`] did not set it. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::metadata`]: crate::offers::offer::Offer::metadata + */ +MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedBolt12Invoice_metadata(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The minimum amount required for a successful payment of a single item. + * + * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if + * the [`Offer`] did not set it. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::amount`]: crate::offers::offer::Offer::amount + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKAmount UnsignedBolt12Invoice_amount(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Features pertaining to the originating [`Offer`]. + * + * From [`Offer::offer_features`]; `None` if the invoice was created in response to a + * [`Refund`]. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKOfferFeatures UnsignedBolt12Invoice_offer_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * A complete description of the purpose of the originating offer or refund. + * + * From [`Offer::description`] or [`Refund::description`]. + * + * [`Offer::description`]: crate::offers::offer::Offer::description + */ +MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_description(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`]. + * + * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry + */ +MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_absolute_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The issuer of the offer or refund. + * + * From [`Offer::issuer`] or [`Refund::issuer`]. + * + * [`Offer::issuer`]: crate::offers::offer::Offer::issuer + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_issuer(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Paths to the recipient originating from publicly reachable nodes. + * + * From [`Offer::paths`] or [`Refund::paths`]. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths + */ +MUST_USE_RES struct LDKCVec_BlindedPathZ UnsignedBolt12Invoice_message_paths(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The quantity of items supported. + * + * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a + * [`Refund`]. + * + * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKQuantity UnsignedBolt12Invoice_supported_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * An unpredictable series of bytes from the payer. + * + * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. + */ +MUST_USE_RES struct LDKu8slice UnsignedBolt12Invoice_payer_metadata(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Features pertaining to requesting an invoice. + * + * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. + */ +MUST_USE_RES struct LDKInvoiceRequestFeatures UnsignedBolt12Invoice_invoice_request_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The quantity of items requested or refunded for. + * + * From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. + */ +MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * A possibly transient pubkey used to sign the invoice request or to send an invoice for a + * refund in case there are no [`message_paths`]. + * + * [`message_paths`]: Self::message_paths + */ +MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_payer_id(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * A payer-provided note reflected back in the invoice. + * + * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`]. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_payer_note(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Duration since the Unix epoch when the invoice was created. + */ +MUST_USE_RES uint64_t UnsignedBolt12Invoice_created_at(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore + * should no longer be paid. + */ +MUST_USE_RES uint64_t UnsignedBolt12Invoice_relative_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Whether the invoice has expired. + */ +MUST_USE_RES bool UnsignedBolt12Invoice_is_expired(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * SHA256 hash of the payment preimage that will be given in return for paying the invoice. + */ +MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_payment_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The minimum amount required for a successful payment of the invoice. + */ +MUST_USE_RES uint64_t UnsignedBolt12Invoice_amount_msats(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Features pertaining to paying an invoice. + */ +MUST_USE_RES struct LDKBolt12InvoiceFeatures UnsignedBolt12Invoice_invoice_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The public key corresponding to the key used to sign the invoice. + */ +MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The chains that may be used when paying a requested invoice. + * + * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`]. + * + * [`Offer::chains`]: crate::offers::offer::Offer::chains + */ +MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ Bolt12Invoice_offer_chains(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the + * invoice originated from an offer. + * + * From [`InvoiceRequest::chain`] or [`Refund::chain`]. + * + * [`offer_chains`]: Self::offer_chains + * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain + */ +MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_chain(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Opaque bytes set by the originating [`Offer`]. + * + * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or + * if the [`Offer`] did not set it. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::metadata`]: crate::offers::offer::Offer::metadata + */ +MUST_USE_RES struct LDKCOption_CVec_u8ZZ Bolt12Invoice_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The minimum amount required for a successful payment of a single item. + * + * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if + * the [`Offer`] did not set it. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::amount`]: crate::offers::offer::Offer::amount + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKAmount Bolt12Invoice_amount(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Features pertaining to the originating [`Offer`]. + * + * From [`Offer::offer_features`]; `None` if the invoice was created in response to a + * [`Refund`]. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKOfferFeatures Bolt12Invoice_offer_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * A complete description of the purpose of the originating offer or refund. + * + * From [`Offer::description`] or [`Refund::description`]. + * + * [`Offer::description`]: crate::offers::offer::Offer::description */ MUST_USE_RES struct LDKPrintableString Bolt12Invoice_description(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +/** + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`]. + * + * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry + */ +MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_absolute_expiry(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The issuer of the offer or refund. + * + * From [`Offer::issuer`] or [`Refund::issuer`]. + * + * [`Offer::issuer`]: crate::offers::offer::Offer::issuer + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString Bolt12Invoice_issuer(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Paths to the recipient originating from publicly reachable nodes. + * + * From [`Offer::paths`] or [`Refund::paths`]. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths + */ +MUST_USE_RES struct LDKCVec_BlindedPathZ Bolt12Invoice_message_paths(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The quantity of items supported. + * + * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a + * [`Refund`]. + * + * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKQuantity Bolt12Invoice_supported_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * An unpredictable series of bytes from the payer. + * + * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. + */ +MUST_USE_RES struct LDKu8slice Bolt12Invoice_payer_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Features pertaining to requesting an invoice. + * + * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. + */ +MUST_USE_RES struct LDKInvoiceRequestFeatures Bolt12Invoice_invoice_request_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The quantity of items requested or refunded for. + * + * From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. + */ +MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * A possibly transient pubkey used to sign the invoice request or to send an invoice for a + * refund in case there are no [`message_paths`]. + * + * [`message_paths`]: Self::message_paths + */ +MUST_USE_RES struct LDKPublicKey Bolt12Invoice_payer_id(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * A payer-provided note reflected back in the invoice. + * + * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`]. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString Bolt12Invoice_payer_note(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + /** * Duration since the Unix epoch when the invoice was created. */ @@ -36645,22 +39415,33 @@ MUST_USE_RES uint64_t Bolt12Invoice_amount_msats(const struct LDKBolt12Invoice * /** * Features pertaining to paying an invoice. */ -MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12Invoice_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12Invoice_invoice_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** * The public key corresponding to the key used to sign the invoice. */ MUST_USE_RES struct LDKPublicKey Bolt12Invoice_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +/** + * Signature of the invoice verified using [`Bolt12Invoice::signing_pubkey`]. + */ +MUST_USE_RES struct LDKSchnorrSignature Bolt12Invoice_signature(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + /** * Hash that was used for signing the invoice. */ MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_signable_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Verifies that the invoice was for a request or refund created using the given key. + * Verifies that the invoice was for a request or refund created using the given key. Returns + * the associated [`PaymentId`] to use when sending the payment. */ -MUST_USE_RES bool Bolt12Invoice_verify(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR key); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ Bolt12Invoice_verify(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR key); + +/** + * Serialize the UnsignedBolt12Invoice object into a byte array which can be read by UnsignedBolt12Invoice_read + */ +struct LDKCVec_u8Z UnsignedBolt12Invoice_write(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR obj); /** * Serialize the Bolt12Invoice object into a byte array which can be read by Bolt12Invoice_read @@ -36815,6 +39596,8 @@ void InvoiceError_set_message(struct LDKInvoiceError *NONNULL_PTR this_ptr, stru /** * Constructs a new InvoiceError given each field + * + * Note that erroneous_field_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKInvoiceError InvoiceError_new(struct LDKErroneousField erroneous_field_arg, struct LDKUntrustedString message_arg); @@ -36875,6 +39658,11 @@ struct LDKCResult_InvoiceErrorDecodeErrorZ InvoiceError_read(struct LDKu8slice s */ void UnsignedInvoiceRequest_free(struct LDKUnsignedInvoiceRequest this_obj); +/** + * Returns the [`TaggedHash`] of the invoice to sign. + */ +MUST_USE_RES struct LDKTaggedHash UnsignedInvoiceRequest_tagged_hash(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + /** * Frees any resources used by the InvoiceRequest, if is_owned is set and inner is non-NULL. */ @@ -36885,13 +39673,215 @@ void InvoiceRequest_free(struct LDKInvoiceRequest this_obj); */ struct LDKInvoiceRequest InvoiceRequest_clone(const struct LDKInvoiceRequest *NONNULL_PTR orig); +/** + * Frees any resources used by the VerifiedInvoiceRequest, if is_owned is set and inner is non-NULL. + */ +void VerifiedInvoiceRequest_free(struct LDKVerifiedInvoiceRequest this_obj); + +/** + * Keys used for signing a [`Bolt12Invoice`] if they can be derived. + * + * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call + * [`respond_with`]. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`respond_using_derived_keys`]: Self::respond_using_derived_keys + * [`respond_with`]: Self::respond_with + */ +struct LDKCOption_SecretKeyZ VerifiedInvoiceRequest_get_keys(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr); + +/** + * Keys used for signing a [`Bolt12Invoice`] if they can be derived. + * + * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call + * [`respond_with`]. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`respond_using_derived_keys`]: Self::respond_using_derived_keys + * [`respond_with`]: Self::respond_with + */ +void VerifiedInvoiceRequest_set_keys(struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr, struct LDKCOption_SecretKeyZ val); + +/** + * Creates a copy of the VerifiedInvoiceRequest + */ +struct LDKVerifiedInvoiceRequest VerifiedInvoiceRequest_clone(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR orig); + +/** + * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). + * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) + * for the selected chain. + */ +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ UnsignedInvoiceRequest_chains(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Opaque bytes set by the originator. Useful for authentication and validating fields since it + * is reflected in `invoice_request` messages along with all the other fields from the `offer`. + */ +MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedInvoiceRequest_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The minimum amount required for a successful payment of a single item. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKAmount UnsignedInvoiceRequest_amount(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * A complete description of the purpose of the payment. Intended to be displayed to the user + * but with the caveat that it has not been verified in any way. + */ +MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_description(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Features pertaining to the offer. + */ +MUST_USE_RES struct LDKOfferFeatures UnsignedInvoiceRequest_offer_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * If `None`, the offer does not expire. + */ +MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_absolute_expiry(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be + * displayed to the user but with the caveat that it has not been verified in any way. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_issuer(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. + */ +MUST_USE_RES struct LDKCVec_BlindedPathZ UnsignedInvoiceRequest_paths(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The quantity of items supported. + */ +MUST_USE_RES struct LDKQuantity UnsignedInvoiceRequest_supported_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The public key used by the recipient to sign invoices. + */ +MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_signing_pubkey(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * An unpredictable series of bytes, typically containing information about the derivation of + * [`payer_id`]. + * + * [`payer_id`]: Self::payer_id + */ +MUST_USE_RES struct LDKu8slice UnsignedInvoiceRequest_payer_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * A chain from [`Offer::chains`] that the offer is valid for. + */ +MUST_USE_RES struct LDKThirtyTwoBytes UnsignedInvoiceRequest_chain(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which + * must be greater than or equal to [`Offer::amount`], converted if necessary. + * + * [`chain`]: Self::chain + */ +MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_amount_msats(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Features pertaining to requesting an invoice. + */ +MUST_USE_RES struct LDKInvoiceRequestFeatures UnsignedInvoiceRequest_invoice_request_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. + */ +MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * A possibly transient pubkey used to sign the invoice request. + */ +MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_payer_id(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * A payer-provided note which will be seen by the recipient and reflected back in the invoice + * response. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_payer_note(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). + * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) + * for the selected chain. + */ +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ InvoiceRequest_chains(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Opaque bytes set by the originator. Useful for authentication and validating fields since it + * is reflected in `invoice_request` messages along with all the other fields from the `offer`. + */ +MUST_USE_RES struct LDKCOption_CVec_u8ZZ InvoiceRequest_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The minimum amount required for a successful payment of a single item. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKAmount InvoiceRequest_amount(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * A complete description of the purpose of the payment. Intended to be displayed to the user + * but with the caveat that it has not been verified in any way. + */ +MUST_USE_RES struct LDKPrintableString InvoiceRequest_description(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Features pertaining to the offer. + */ +MUST_USE_RES struct LDKOfferFeatures InvoiceRequest_offer_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * If `None`, the offer does not expire. + */ +MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_absolute_expiry(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be + * displayed to the user but with the caveat that it has not been verified in any way. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString InvoiceRequest_issuer(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. + */ +MUST_USE_RES struct LDKCVec_BlindedPathZ InvoiceRequest_paths(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The quantity of items supported. + */ +MUST_USE_RES struct LDKQuantity InvoiceRequest_supported_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The public key used by the recipient to sign invoices. + */ +MUST_USE_RES struct LDKPublicKey InvoiceRequest_signing_pubkey(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + /** * An unpredictable series of bytes, typically containing information about the derivation of * [`payer_id`]. * * [`payer_id`]: Self::payer_id */ -MUST_USE_RES struct LDKu8slice InvoiceRequest_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice InvoiceRequest_payer_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** * A chain from [`Offer::chains`] that the offer is valid for. @@ -36909,7 +39899,7 @@ MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_amount_msats(const struct LDK /** * Features pertaining to requesting an invoice. */ -MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequest_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequest_invoice_request_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. @@ -36930,76 +39920,58 @@ MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_id(const struct LDKInvoice MUST_USE_RES struct LDKPrintableString InvoiceRequest_payer_note(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Verifies that the request was for an offer created using the given key. Returns the derived - * keys need to sign an [`Bolt12Invoice`] for the request if they could be extracted from the - * metadata. + * Signature of the invoice request using [`payer_id`]. * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - */ -MUST_USE_RES struct LDKCResult_COption_KeyPairZNoneZ InvoiceRequest_verify(const struct LDKInvoiceRequest *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR key); - -/** - * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read - */ -struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj); - -/** - * Frees any resources used by the Offer, if is_owned is set and inner is non-NULL. + * [`payer_id`]: Self::payer_id */ -void Offer_free(struct LDKOffer this_obj); +MUST_USE_RES struct LDKSchnorrSignature InvoiceRequest_signature(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Creates a copy of the Offer + * Verifies that the request was for an offer created using the given key. Returns the verified + * request which contains the derived keys needed to sign a [`Bolt12Invoice`] for the request + * if they could be extracted from the metadata. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -struct LDKOffer Offer_clone(const struct LDKOffer *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_VerifiedInvoiceRequestNoneZ InvoiceRequest_verify(struct LDKInvoiceRequest this_arg, const struct LDKExpandedKey *NONNULL_PTR key); /** * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) * for the selected chain. */ -MUST_USE_RES struct LDKCVec_ChainHashZ Offer_chains(const struct LDKOffer *NONNULL_PTR this_arg); - -/** - * Returns whether the given chain is supported by the offer. - */ -MUST_USE_RES bool Offer_supports_chain(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes chain); +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ VerifiedInvoiceRequest_chains(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * Opaque bytes set by the originator. Useful for authentication and validating fields since it * is reflected in `invoice_request` messages along with all the other fields from the `offer`. */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ Offer_metadata(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ VerifiedInvoiceRequest_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * The minimum amount required for a successful payment of a single item. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKAmount Offer_amount(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKAmount VerifiedInvoiceRequest_amount(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * A complete description of the purpose of the payment. Intended to be displayed to the user * but with the caveat that it has not been verified in any way. */ -MUST_USE_RES struct LDKPrintableString Offer_description(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_description(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * Features pertaining to the offer. */ -MUST_USE_RES struct LDKOfferFeatures Offer_features(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOfferFeatures VerifiedInvoiceRequest_offer_features(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * Duration since the Unix epoch when an invoice should no longer be requested. * * If `None`, the offer does not expire. */ -MUST_USE_RES struct LDKCOption_DurationZ Offer_absolute_expiry(const struct LDKOffer *NONNULL_PTR this_arg); - -/** - * Whether the offer has expired. - */ -MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_absolute_expiry(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be @@ -37007,65 +39979,82 @@ MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg); * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKPrintableString Offer_issuer(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_issuer(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide * recipient privacy by obfuscating its node id. */ -MUST_USE_RES struct LDKCVec_BlindedPathZ Offer_paths(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_BlindedPathZ VerifiedInvoiceRequest_paths(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * The quantity of items supported. */ -MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKQuantity VerifiedInvoiceRequest_supported_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Returns whether the given quantity is valid for the offer. + * The public key used by the recipient to sign invoices. */ -MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t quantity); +MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_signing_pubkey(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer. + * An unpredictable series of bytes, typically containing information about the derivation of + * [`payer_id`]. * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`payer_id`]: Self::payer_id */ -MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice VerifiedInvoiceRequest_payer_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * The public key used by the recipient to sign invoices. + * A chain from [`Offer::chains`] that the offer is valid for. */ -MUST_USE_RES struct LDKPublicKey Offer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKThirtyTwoBytes VerifiedInvoiceRequest_chain(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Serialize the Offer object into a byte array which can be read by Offer_read + * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which + * must be greater than or equal to [`Offer::amount`], converted if necessary. + * + * [`chain`]: Self::chain */ -struct LDKCVec_u8Z Offer_write(const struct LDKOffer *NONNULL_PTR obj); +MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_amount_msats(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the Amount, if is_owned is set and inner is non-NULL. + * Features pertaining to requesting an invoice. */ -void Amount_free(struct LDKAmount this_obj); +MUST_USE_RES struct LDKInvoiceRequestFeatures VerifiedInvoiceRequest_invoice_request_features(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Creates a copy of the Amount + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ -struct LDKAmount Amount_clone(const struct LDKAmount *NONNULL_PTR orig); +MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the Quantity, if is_owned is set and inner is non-NULL. + * A possibly transient pubkey used to sign the invoice request. */ -void Quantity_free(struct LDKQuantity this_obj); +MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_payer_id(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Creates a copy of the Quantity + * A payer-provided note which will be seen by the recipient and reflected back in the invoice + * response. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKQuantity Quantity_clone(const struct LDKQuantity *NONNULL_PTR orig); +MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_payer_note(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Read a Offer object from a string + * Serialize the UnsignedInvoiceRequest object into a byte array which can be read by UnsignedInvoiceRequest_read */ -struct LDKCResult_OfferBolt12ParseErrorZ Offer_from_str(struct LDKStr s); +struct LDKCVec_u8Z UnsignedInvoiceRequest_write(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR obj); + +/** + * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read + */ +struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj); + +/** + * Frees any resources used by the TaggedHash, if is_owned is set and inner is non-NULL. + */ +void TaggedHash_free(struct LDKTaggedHash this_obj); /** * Frees any resources used by the Bolt12ParseError, if is_owned is set and inner is non-NULL. @@ -37233,7 +40222,7 @@ MUST_USE_RES struct LDKPrintableString Refund_description(const struct LDKRefund * * If `None`, the refund does not expire. */ -MUST_USE_RES struct LDKCOption_DurationZ Refund_absolute_expiry(const struct LDKRefund *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z Refund_absolute_expiry(const struct LDKRefund *NONNULL_PTR this_arg); /** * Whether the refund has expired. @@ -37260,7 +40249,7 @@ MUST_USE_RES struct LDKCVec_BlindedPathZ Refund_paths(const struct LDKRefund *NO * * [`payer_id`]: Self::payer_id */ -MUST_USE_RES struct LDKu8slice Refund_metadata(const struct LDKRefund *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice Refund_payer_metadata(const struct LDKRefund *NONNULL_PTR this_arg); /** * A chain that the refund is valid for. @@ -37417,7 +40406,7 @@ MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_P /** * Get the public key from this NodeId */ -MUST_USE_RES struct LDKCResult_PublicKeyErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_PublicKeySecp256k1ErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg); /** * Generates a non-cryptographic 64-bit hash of the NodeId. @@ -37503,7 +40492,7 @@ MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGr * existing announcements unless they are updated. * Add, update or remove the provider would replace the current one. */ -void P2PGossipSync_add_utxo_lookup(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup); +void P2PGossipSync_add_utxo_lookup(const struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup); /** * Handles any network updates originating from [`Event`]s. @@ -37632,6 +40621,8 @@ void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONN /** * Constructs a new ChannelUpdateInfo given each field + * + * Note that last_update_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); @@ -37985,6 +40976,8 @@ void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInf /** * Constructs a new NodeAnnouncementInfo given each field + * + * Note that announcement_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKNodeAnnouncement announcement_message_arg); @@ -38003,7 +40996,7 @@ bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a /** * Internet-level addresses via which one can connect to the node */ -MUST_USE_RES struct LDKCVec_NetAddressZ NodeAnnouncementInfo_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_SocketAddressZ NodeAnnouncementInfo_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read @@ -38088,6 +41081,8 @@ void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, st /** * Constructs a new NodeInfo given each field + * + * Note that announcement_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); @@ -38308,7 +41303,7 @@ MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct * Returns None if the requested node is completely unknown, * or if node announcement for the node was never received. */ -MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); +MUST_USE_RES struct LDKCOption_CVec_SocketAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); /** * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. @@ -38339,18 +41334,13 @@ void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlight /** * Initialize a new `ScorerAccountingForInFlightHtlcs`. */ -MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScore scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs); - -/** - * Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read - */ -struct LDKCVec_u8Z ScorerAccountingForInFlightHtlcs_write(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR obj); +MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScoreLookUp scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs); /** - * Constructs a new Score which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is + * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is */ -struct LDKScore ScorerAccountingForInFlightHtlcs_as_Score(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg); +struct LDKScoreLookUp ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg); /** * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL. @@ -38483,10 +41473,34 @@ uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR th */ void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); +/** + * Indicates whether this hop is possibly announced in the public network graph. + * + * Will be `true` if there is a possibility that the channel is publicly known, i.e., if we + * either know for sure it's announced in the public graph, or if any public channels exist + * for which the given `short_channel_id` could be an alias for. Will be `false` if we believe + * the channel to be unannounced. + * + * Will be `true` for objects serialized with LDK version 0.0.116 and before. + */ +bool RouteHop_get_maybe_announced_channel(const struct LDKRouteHop *NONNULL_PTR this_ptr); + +/** + * Indicates whether this hop is possibly announced in the public network graph. + * + * Will be `true` if there is a possibility that the channel is publicly known, i.e., if we + * either know for sure it's announced in the public graph, or if any public channels exist + * for which the given `short_channel_id` could be an alias for. Will be `false` if we believe + * the channel to be unannounced. + * + * Will be `true` for objects serialized with LDK version 0.0.116 and before. + */ +void RouteHop_set_maybe_announced_channel(struct LDKRouteHop *NONNULL_PTR this_ptr, bool val); + /** * Constructs a new RouteHop given each field */ -MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg); +MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg, bool maybe_announced_channel_arg); /** * Creates a copy of the RouteHop @@ -38633,6 +41647,8 @@ void Path_set_blinded_tail(struct LDKPath *NONNULL_PTR this_ptr, struct LDKBlind /** * Constructs a new Path given each field + * + * Note that blinded_tail_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKPath Path_new(struct LDKCVec_RouteHopZ hops_arg, struct LDKBlindedTail blinded_tail_arg); @@ -38688,27 +41704,33 @@ struct LDKCVec_PathZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_PathZ val); /** - * The `payment_params` parameter passed via [`RouteParameters`] to [`find_route`]. + * The `route_params` parameter passed to [`find_route`]. * * This is used by `ChannelManager` to track information which may be required for retries. * + * Will be `None` for objects serialized with LDK versions prior to 0.0.117. + * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr); +struct LDKRouteParameters Route_get_route_params(const struct LDKRoute *NONNULL_PTR this_ptr); /** - * The `payment_params` parameter passed via [`RouteParameters`] to [`find_route`]. + * The `route_params` parameter passed to [`find_route`]. * * This is used by `ChannelManager` to track information which may be required for retries. * + * Will be `None` for objects serialized with LDK versions prior to 0.0.117. + * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val); +void Route_set_route_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKRouteParameters val); /** * Constructs a new Route given each field + * + * Note that route_params_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_PathZ paths_arg, struct LDKPaymentParameters payment_params_arg); +MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_PathZ paths_arg, struct LDKRouteParameters route_params_arg); /** * Creates a copy of the Route @@ -38730,14 +41752,21 @@ bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNU /** * Returns the total amount of fees paid on this [`Route`]. * - * This doesn't include any extra payment made to the recipient, which can happen in excess of - * the amount passed to [`find_route`]'s `route_params.final_value_msat`. + * For objects serialized with LDK 0.0.117 and after, this includes any extra payment made to + * the recipient, which can happen in excess of the amount passed to [`find_route`] via + * [`RouteParameters::final_value_msat`], if we had to reach the [`htlc_minimum_msat`] limits. + * + * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message */ MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); /** - * Returns the total amount paid on this [`Route`], excluding the fees. Might be more than - * requested if we had to reach htlc_minimum_msat. + * Returns the total amount paid on this [`Route`], excluding the fees. + * + * Might be more than requested as part of the given [`RouteParameters::final_value_msat`] if + * we had to reach the [`htlc_minimum_msat`] limits. + * + * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message */ MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); @@ -38776,16 +41805,41 @@ uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *N */ void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val); +/** + * The maximum total fees, in millisatoshi, that may accrue during route finding. + * + * This limit also applies to the total fees that may arise while retrying failed payment + * paths. + * + * Note that values below a few sats may result in some paths being spuriously ignored. + */ +struct LDKCOption_u64Z RouteParameters_get_max_total_routing_fee_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); + +/** + * The maximum total fees, in millisatoshi, that may accrue during route finding. + * + * This limit also applies to the total fees that may arise while retrying failed payment + * paths. + * + * Note that values below a few sats may result in some paths being spuriously ignored. + */ +void RouteParameters_set_max_total_routing_fee_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + /** * Constructs a new RouteParameters given each field */ -MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg); +MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg, struct LDKCOption_u64Z max_total_routing_fee_msat_arg); /** * Creates a copy of the RouteParameters */ struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the RouteParameters. + */ +uint64_t RouteParameters_hash(const struct LDKRouteParameters *NONNULL_PTR o); + /** * Checks if two RouteParameterss contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -38793,6 +41847,13 @@ struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters */ bool RouteParameters_eq(const struct LDKRouteParameters *NONNULL_PTR a, const struct LDKRouteParameters *NONNULL_PTR b); +/** + * Constructs [`RouteParameters`] from the given [`PaymentParameters`] and a payment amount. + * + * [`Self::max_total_routing_fee_msat`] defaults to 1% of the payment amount + 50 sats + */ +MUST_USE_RES struct LDKRouteParameters RouteParameters_from_payment_params_and_value(struct LDKPaymentParameters payment_params, uint64_t final_value_msat); + /** * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read */ @@ -38964,6 +42025,11 @@ MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LD */ MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_bolt12_invoice(const struct LDKBolt12Invoice *NONNULL_PTR invoice); +/** + * Creates parameters for paying to a blinded payee from the provided blinded route hints. + */ +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_blinded(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints); + /** * Frees any resources used by the Payee */ @@ -39162,7 +42228,7 @@ struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice s * * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params, const uint8_t (*random_seed_bytes)[32]); +struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScoreLookUp *NONNULL_PTR scorer, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params, const uint8_t (*random_seed_bytes)[32]); /** * Construct a route from us (payer) to the target node (payee) via the given hops (which should @@ -39172,6 +42238,16 @@ struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_p */ struct LDKCResult_RouteLightningErrorZ build_route_from_hops(struct LDKPublicKey our_node_pubkey, struct LDKCVec_PublicKeyZ hops, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, const uint8_t (*random_seed_bytes)[32]); +/** + * Calls the free function if one is set + */ +void ScoreLookUp_free(struct LDKScoreLookUp this_ptr); + +/** + * Calls the free function if one is set + */ +void ScoreUpdate_free(struct LDKScoreUpdate this_ptr); + /** * Calls the free function if one is set */ @@ -39215,20 +42291,31 @@ struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const stru MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); /** - * Frees any resources used by the MultiThreadedScoreLock, if is_owned is set and inner is non-NULL. + * Frees any resources used by the MultiThreadedScoreLockRead, if is_owned is set and inner is non-NULL. */ -void MultiThreadedScoreLock_free(struct LDKMultiThreadedScoreLock this_obj); +void MultiThreadedScoreLockRead_free(struct LDKMultiThreadedScoreLockRead this_obj); /** - * Serialize the MultiThreadedScoreLock object into a byte array which can be read by MultiThreadedScoreLock_read + * Frees any resources used by the MultiThreadedScoreLockWrite, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z MultiThreadedScoreLock_write(const struct LDKMultiThreadedScoreLock *NONNULL_PTR obj); +void MultiThreadedScoreLockWrite_free(struct LDKMultiThreadedScoreLockWrite this_obj); /** - * Constructs a new Score which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is + * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is */ -struct LDKScore MultiThreadedScoreLock_as_Score(const struct LDKMultiThreadedScoreLock *NONNULL_PTR this_arg); +struct LDKScoreLookUp MultiThreadedScoreLockRead_as_ScoreLookUp(const struct LDKMultiThreadedScoreLockRead *NONNULL_PTR this_arg); + +/** + * Serialize the MultiThreadedScoreLockWrite object into a byte array which can be read by MultiThreadedScoreLockWrite_read + */ +struct LDKCVec_u8Z MultiThreadedScoreLockWrite_write(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR obj); + +/** + * Constructs a new ScoreUpdate which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is + */ +struct LDKScoreUpdate MultiThreadedScoreLockWrite_as_ScoreUpdate(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR this_arg); /** * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL. @@ -39293,10 +42380,16 @@ struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenal MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat); /** - * Constructs a new Score which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is + * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is */ -struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); +struct LDKScoreLookUp FixedPenaltyScorer_as_ScoreLookUp(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); + +/** + * Constructs a new ScoreUpdate which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is + */ +struct LDKScoreUpdate FixedPenaltyScorer_as_ScoreUpdate(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); /** * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read @@ -39333,12 +42426,13 @@ uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_msat(const struct LD void ProbabilisticScoringFeeParameters_set_base_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * A multiplier used with the payment amount to calculate a fixed penalty applied to each - * channel, in excess of the [`base_penalty_msat`]. + * A multiplier used with the total amount flowing over a channel to calculate a fixed penalty + * applied to each channel, in excess of the [`base_penalty_msat`]. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^30`ths of the payment amount. + * multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment + * amount plus the amount of any other HTLCs flowing we sent over the same channel). * * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` * @@ -39349,12 +42443,13 @@ void ProbabilisticScoringFeeParameters_set_base_penalty_msat(struct LDKProbabili uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * A multiplier used with the payment amount to calculate a fixed penalty applied to each - * channel, in excess of the [`base_penalty_msat`]. + * A multiplier used with the total amount flowing over a channel to calculate a fixed penalty + * applied to each channel, in excess of the [`base_penalty_msat`]. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^30`ths of the payment amount. + * multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment + * amount plus the amount of any other HTLCs flowing we sent over the same channel). * * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` * @@ -39405,14 +42500,14 @@ uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat void ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * A multiplier used in conjunction with a payment amount and the negative `log10` of the - * channel's success probability for the payment, as determined by our latest estimates of the - * channel's liquidity, to determine the amount penalty. + * A multiplier used in conjunction with the total amount flowing over a channel and the + * negative `log10` of the channel's success probability for the payment, as determined by our + * latest estimates of the channel's liquidity, to determine the amount penalty. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the - * success probability. + * multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative + * `log10` of the success probability. * * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` * @@ -39427,14 +42522,14 @@ void ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(str uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * A multiplier used in conjunction with a payment amount and the negative `log10` of the - * channel's success probability for the payment, as determined by our latest estimates of the - * channel's liquidity, to determine the amount penalty. + * A multiplier used in conjunction with the total amount flowing over a channel and the + * negative `log10` of the channel's success probability for the payment, as determined by our + * latest estimates of the channel's liquidity, to determine the amount penalty. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the - * success probability. + * multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative + * `log10` of the success probability. * * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` * @@ -39485,13 +42580,15 @@ uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_mult void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * A multiplier used in conjunction with the payment amount and the negative `log10` of the - * channel's success probability for the payment, as determined based on the history of our - * estimates of the channel's available liquidity, to determine a penalty. + * A multiplier used in conjunction with the total amount flowing over a channel and the + * negative `log10` of the channel's success probability for the payment, as determined based + * on the history of our estimates of the channel's available liquidity, to determine a + * penalty. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost for - * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths - * of the payment amount, weighted by the negative `log10` of the success probability. + * large payments. The penalty is computed as the product of this multiplier and `2^20`ths + * of the amount flowing over this channel, weighted by the negative `log10` of the success + * probability. * * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead * of using only our latest estimate for the current liquidity available in the channel, it @@ -39507,13 +42604,15 @@ void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multipli uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * A multiplier used in conjunction with the payment amount and the negative `log10` of the - * channel's success probability for the payment, as determined based on the history of our - * estimates of the channel's available liquidity, to determine a penalty. + * A multiplier used in conjunction with the total amount flowing over a channel and the + * negative `log10` of the channel's success probability for the payment, as determined based + * on the history of our estimates of the channel's available liquidity, to determine a + * penalty. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost for - * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths - * of the payment amount, weighted by the negative `log10` of the success probability. + * large payments. The penalty is computed as the product of this multiplier and `2^20`ths + * of the amount flowing over this channel, weighted by the negative `log10` of the success + * probability. * * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead * of using only our latest estimate for the current liquidity available in the channel, it @@ -39530,7 +42629,7 @@ void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_m /** * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the - * channel's capacity, (ie. htlc_maximum_msat ≥ 0.5 * channel_capacity) which makes us + * channel's capacity, (ie. htlc_maximum_msat >= 0.5 * channel_capacity) which makes us * prefer nodes with a smaller `htlc_maximum_msat`. We treat such nodes preferentially * as this makes balance discovery attacks harder to execute, thereby creating an incentive * to restrict `htlc_maximum_msat` and improve privacy. @@ -39541,7 +42640,7 @@ uint64_t ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(const s /** * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the - * channel's capacity, (ie. htlc_maximum_msat ≥ 0.5 * channel_capacity) which makes us + * channel's capacity, (ie. htlc_maximum_msat >= 0.5 * channel_capacity) which makes us * prefer nodes with a smaller `htlc_maximum_msat`. We treat such nodes preferentially * as this makes balance discovery attacks harder to execute, thereby creating an incentive * to restrict `htlc_maximum_msat` and improve privacy. @@ -39551,8 +42650,9 @@ uint64_t ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(const s void ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * This penalty is applied when the amount we're attempting to send over a channel exceeds our - * current estimate of the channel's available liquidity. + * This penalty is applied when the total amount flowing over a channel exceeds our current + * estimate of the channel's available liquidity. The total amount is the amount of the + * current HTLC plus any HTLCs which we've sent over the same channel. * * Note that in this case all other penalties, including the * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based @@ -39572,8 +42672,9 @@ void ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(struct LDKP uint64_t ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * This penalty is applied when the amount we're attempting to send over a channel exceeds our - * current estimate of the channel's available liquidity. + * This penalty is applied when the total amount flowing over a channel exceeds our current + * estimate of the channel's available liquidity. The total amount is the amount of the + * current HTLC plus any HTLCs which we've sent over the same channel. * * Note that in this case all other penalties, including the * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based @@ -39592,6 +42693,54 @@ uint64_t ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msa */ void ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +/** + * In order to calculate most of the scores above, we must first convert a lower and upper + * bound on the available liquidity in a channel into the probability that we think a payment + * will succeed. That probability is derived from a Probability Density Function for where we + * think the liquidity in a channel likely lies, given such bounds. + * + * If this flag is set, that PDF is simply a constant - we assume that the actual available + * liquidity in a channel is just as likely to be at any point between our lower and upper + * bounds. + * + * If this flag is *not* set, that PDF is `(x - 0.5*capacity) ^ 2`. That is, we use an + * exponential curve which expects the liquidity of a channel to lie \"at the edges\". This + * matches experimental results - most routing nodes do not aggressively rebalance their + * channels and flows in the network are often unbalanced, leaving liquidity usually + * unavailable. + * + * Thus, for the \"best\" routes, leave this flag `false`. However, the flag does imply a number + * of floating-point multiplications in the hottest routing code, which may lead to routing + * performance degradation on some machines. + * + * Default value: false + */ +bool ProbabilisticScoringFeeParameters_get_linear_success_probability(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); + +/** + * In order to calculate most of the scores above, we must first convert a lower and upper + * bound on the available liquidity in a channel into the probability that we think a payment + * will succeed. That probability is derived from a Probability Density Function for where we + * think the liquidity in a channel likely lies, given such bounds. + * + * If this flag is set, that PDF is simply a constant - we assume that the actual available + * liquidity in a channel is just as likely to be at any point between our lower and upper + * bounds. + * + * If this flag is *not* set, that PDF is `(x - 0.5*capacity) ^ 2`. That is, we use an + * exponential curve which expects the liquidity of a channel to lie \"at the edges\". This + * matches experimental results - most routing nodes do not aggressively rebalance their + * channels and flows in the network are often unbalanced, leaving liquidity usually + * unavailable. + * + * Thus, for the \"best\" routes, leave this flag `false`. However, the flag does imply a number + * of floating-point multiplications in the hottest routing code, which may lead to routing + * performance degradation on some machines. + * + * Default value: false + */ +void ProbabilisticScoringFeeParameters_set_linear_success_probability(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, bool val); + /** * Creates a copy of the ProbabilisticScoringFeeParameters */ @@ -39754,26 +42903,54 @@ MUST_USE_RES struct LDKCOption_C2Tuple_u64u64ZZ ProbabilisticScorer_estimated_ch * Query the historical estimated minimum and maximum liquidity available for sending a * payment over the channel with `scid` towards the given `target` node. * - * Returns two sets of 8 buckets. The first set describes the octiles for lower-bound - * liquidity estimates, the second set describes the octiles for upper-bound liquidity - * estimates. Each bucket describes the relative frequency at which we've seen a liquidity - * bound in the octile relative to the channel's total capacity, on an arbitrary scale. - * Because the values are slowly decayed, more recent data points are weighted more heavily - * than older datapoints. + * Returns two sets of 32 buckets. The first set describes the lower-bound liquidity history, + * the second set describes the upper-bound liquidity history. Each bucket describes the + * relative frequency at which we've seen a liquidity bound in the bucket's range relative to + * the channel's total capacity, on an arbitrary scale. Because the values are slowly decayed, + * more recent data points are weighted more heavily than older datapoints. * - * When scoring, the estimated probability that an upper-/lower-bound lies in a given octile - * relative to the channel's total capacity is calculated by dividing that bucket's value with - * the total of all buckets for the given bound. + * Note that the range of each bucket varies by its location to provide more granular results + * at the edges of a channel's capacity, where it is more likely to sit. * - * For example, a value of `[0, 0, 0, 0, 0, 0, 32]` indicates that we believe the probability - * of a bound being in the top octile to be 100%, and have never (recently) seen it in any - * other octiles. A value of `[31, 0, 0, 0, 0, 0, 0, 32]` indicates we've seen the bound being - * both in the top and bottom octile, and roughly with similar (recent) frequency. + * When scoring, the estimated probability that an upper-/lower-bound lies in a given bucket + * is calculated by dividing that bucket's value with the total value of all buckets. + * + * For example, using a lower bucket count for illustrative purposes, a value of + * `[0, 0, 0, ..., 0, 32]` indicates that we believe the probability of a bound being very + * close to the channel's capacity to be 100%, and have never (recently) seen it in any other + * bucket. A value of `[31, 0, 0, ..., 0, 0, 32]` indicates we've seen the bound being both + * in the top and bottom bucket, and roughly with similar (recent) frequency. * * Because the datapoints are decayed slowly over time, values will eventually return to - * `Some(([0; 8], [0; 8]))`. + * `Some(([1; 32], [1; 32]))` and then to `None` once no datapoints remain. + * + * In order to fetch a single success probability from the buckets provided here, as used in + * the scoring model, see [`Self::historical_estimated_payment_success_probability`]. */ -MUST_USE_RES struct LDKCOption_C2Tuple_EightU16sEightU16sZZ ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target); +MUST_USE_RES struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target); + +/** + * Query the probability of payment success sending the given `amount_msat` over the channel + * with `scid` towards the given `target` node, based on the historical estimated liquidity + * bounds. + * + * These are the same bounds as returned by + * [`Self::historical_estimated_channel_liquidity_probabilities`] (but not those returned by + * [`Self::estimated_channel_liquidity_range`]). + */ +MUST_USE_RES struct LDKCOption_f64Z ProbabilisticScorer_historical_estimated_payment_success_probability(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target, uint64_t amount_msat, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR params); + +/** + * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is + */ +struct LDKScoreLookUp ProbabilisticScorer_as_ScoreLookUp(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); + +/** + * Constructs a new ScoreUpdate which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is + */ +struct LDKScoreUpdate ProbabilisticScorer_as_ScoreUpdate(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** * Constructs a new Score which calls the relevant methods on this_arg. @@ -39882,6 +43059,11 @@ MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescri */ struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the DelayedPaymentOutputDescriptor. + */ +uint64_t DelayedPaymentOutputDescriptor_hash(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR o); + /** * Checks if two DelayedPaymentOutputDescriptors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -39946,16 +43128,43 @@ uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct L */ void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); +/** + * The necessary channel parameters that need to be provided to the re-derived signer through + * [`ChannelSigner::provide_channel_parameters`]. + * + * Added as optional, but always `Some` if the descriptor was produced in v0.0.117 or later. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKChannelTransactionParameters StaticPaymentOutputDescriptor_get_channel_transaction_parameters(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The necessary channel parameters that need to be provided to the re-derived signer through + * [`ChannelSigner::provide_channel_parameters`]. + * + * Added as optional, but always `Some` if the descriptor was produced in v0.0.117 or later. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +void StaticPaymentOutputDescriptor_set_channel_transaction_parameters(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); + /** * Constructs a new StaticPaymentOutputDescriptor given each field + * + * Note that channel_transaction_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); +MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg, struct LDKChannelTransactionParameters channel_transaction_parameters_arg); /** * Creates a copy of the StaticPaymentOutputDescriptor */ struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the StaticPaymentOutputDescriptor. + */ +uint64_t StaticPaymentOutputDescriptor_hash(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR o); + /** * Checks if two StaticPaymentOutputDescriptors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -39963,6 +43172,21 @@ struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(cons */ bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b); +/** + * Returns the `witness_script` of the spendable output. + * + * Note that this will only return `Some` for [`StaticPaymentOutputDescriptor`]s that + * originated from an anchor outputs channel, as they take the form of a P2WSH script. + */ +MUST_USE_RES struct LDKCOption_CVec_u8ZZ StaticPaymentOutputDescriptor_witness_script(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg); + +/** + * The maximum length a well-formed witness spending one of these should have. + * Note: If you have the grind_signatures feature enabled, this will be at least 1 byte + * shorter. + */ +MUST_USE_RES uintptr_t StaticPaymentOutputDescriptor_max_witness_length(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg); + /** * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read */ @@ -39998,6 +43222,11 @@ struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_ou */ struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a); +/** + * Generates a non-cryptographic 64-bit hash of the SpendableOutputDescriptor. + */ +uint64_t SpendableOutputDescriptor_hash(const struct LDKSpendableOutputDescriptor *NONNULL_PTR o); + /** * Checks if two SpendableOutputDescriptors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -40032,7 +43261,7 @@ struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescripto * * We do not enforce that outputs meet the dust limit or that any output scripts are standard. */ -MUST_USE_RES struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_PackedLockTimeZ locktime); +MUST_USE_RES struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_u32Z locktime); /** * Calls the free function if one is set @@ -40044,6 +43273,11 @@ void ChannelSigner_free(struct LDKChannelSigner this_ptr); */ void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr); +/** + * Creates a copy of a WriteableEcdsaChannelSigner + */ +struct LDKWriteableEcdsaChannelSigner WriteableEcdsaChannelSigner_clone(const struct LDKWriteableEcdsaChannelSigner *NONNULL_PTR orig); + /** * Calls the free function if one is set */ @@ -40159,7 +43393,10 @@ MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey fun /** * Returns the counterparty's pubkeys. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); @@ -40168,30 +43405,36 @@ MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(con * transactions, i.e., the amount of time that we have to wait to recover our funds if we * broadcast a transaction. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. */ -MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u16Z InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Returns the `contest_delay` value specified by us and applied on transactions broadcastable * by our counterparty, i.e., the amount of time that they have to wait to recover their funds * if they broadcast a transaction. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. */ -MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u16Z InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Returns whether the holder is the initiator. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. */ -MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_boolZ InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Funding outpoint * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); @@ -40199,7 +43442,10 @@ MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDK * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or * building transactions. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); @@ -40207,7 +43453,10 @@ MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_p * Returns the channel type features of the channel parameters. Should be helpful for * determining a channel's category, i. e. legacy/anchors/taproot/etc. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKChannelTypeFeatures InMemorySigner_channel_type_features(const struct LDKInMemorySigner *NONNULL_PTR this_arg); @@ -40317,7 +43566,7 @@ MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const stru * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`]. */ -MUST_USE_RES struct LDKCResult_PartiallySignedTransactionNoneZ KeysManager_sign_spendable_outputs_psbt(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_u8Z psbt); +MUST_USE_RES struct LDKCResult_CVec_u8ZNoneZ KeysManager_sign_spendable_outputs_psbt(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_u8Z psbt); /** * Creates a [`Transaction`] which spends the given descriptors to the given outputs, plus an @@ -40338,7 +43587,7 @@ MUST_USE_RES struct LDKCResult_PartiallySignedTransactionNoneZ KeysManager_sign_ * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`]. */ -MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_PackedLockTimeZ locktime); +MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_u32Z locktime); /** * Constructs a new EntropySource which calls the relevant methods on this_arg. @@ -40399,7 +43648,7 @@ MUST_USE_RES struct LDKPhantomKeysManager PhantomKeysManager_new(const uint8_t ( /** * See [`KeysManager::spend_spendable_outputs`] for documentation on this method. */ -MUST_USE_RES struct LDKCResult_TransactionNoneZ PhantomKeysManager_spend_spendable_outputs(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_PackedLockTimeZ locktime); +MUST_USE_RES struct LDKCResult_TransactionNoneZ PhantomKeysManager_spend_spendable_outputs(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_u32Z locktime); /** * See [`KeysManager::derive_channel_keys`] for documentation on this method. @@ -40561,6 +43810,14 @@ bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSend */ void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr); +/** + * Create an onion message with contents `message` to the destination of `path`. + * Returns (introduction_node_id, onion_msg) + * + * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ create_onion_message(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, struct LDKOnionMessagePath path, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path); + /** * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to * their respective handlers. @@ -40638,11 +43895,85 @@ struct LDKCVec_u8Z OffersMessage_write(const struct LDKOffersMessage *NONNULL_PT */ struct LDKCResult_OffersMessageDecodeErrorZ OffersMessage_read(struct LDKu8slice ser, uint64_t arg_a, const struct LDKLogger *NONNULL_PTR arg_b); +/** + * Frees any resources used by the Packet, if is_owned is set and inner is non-NULL. + */ +void Packet_free(struct LDKPacket this_obj); + +/** + * Bolt 04 version number + */ +uint8_t Packet_get_version(const struct LDKPacket *NONNULL_PTR this_ptr); + +/** + * Bolt 04 version number + */ +void Packet_set_version(struct LDKPacket *NONNULL_PTR this_ptr, uint8_t val); + +/** + * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data + */ +struct LDKPublicKey Packet_get_public_key(const struct LDKPacket *NONNULL_PTR this_ptr); + +/** + * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data + */ +void Packet_set_public_key(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Encrypted payload for the next hop + * + * Returns a copy of the field. + */ +struct LDKCVec_u8Z Packet_get_hop_data(const struct LDKPacket *NONNULL_PTR this_ptr); + +/** + * Encrypted payload for the next hop + */ +void Packet_set_hop_data(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); + +/** + * HMAC to verify the integrity of hop_data + */ +const uint8_t (*Packet_get_hmac(const struct LDKPacket *NONNULL_PTR this_ptr))[32]; + +/** + * HMAC to verify the integrity of hop_data + */ +void Packet_set_hmac(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Constructs a new Packet given each field + */ +MUST_USE_RES struct LDKPacket Packet_new(uint8_t version_arg, struct LDKPublicKey public_key_arg, struct LDKCVec_u8Z hop_data_arg, struct LDKThirtyTwoBytes hmac_arg); + +/** + * Creates a copy of the Packet + */ +struct LDKPacket Packet_clone(const struct LDKPacket *NONNULL_PTR orig); + +/** + * Checks if two Packets contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool Packet_eq(const struct LDKPacket *NONNULL_PTR a, const struct LDKPacket *NONNULL_PTR b); + +/** + * Serialize the Packet object into a byte array which can be read by Packet_read + */ +struct LDKCVec_u8Z Packet_write(const struct LDKPacket *NONNULL_PTR obj); + /** * Frees any resources used by the OnionMessageContents */ void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr); +/** + * Creates a copy of the OnionMessageContents + */ +struct LDKOnionMessageContents OnionMessageContents_clone(const struct LDKOnionMessageContents *NONNULL_PTR orig); + /** * Utility method to constructs a new Offers-variant OnionMessageContents */ @@ -40653,6 +43984,11 @@ struct LDKOnionMessageContents OnionMessageContents_offers(struct LDKOffersMessa */ struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a); +/** + * Creates a copy of a CustomOnionMessageContents + */ +struct LDKCustomOnionMessageContents CustomOnionMessageContents_clone(const struct LDKCustomOnionMessageContents *NONNULL_PTR orig); + /** * Calls the free function if one is set */ @@ -40663,6 +43999,55 @@ void CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_p */ void BlindedPath_free(struct LDKBlindedPath this_obj); +/** + * To send to a blinded path, the sender first finds a route to the unblinded + * `introduction_node_id`, which can unblind its [`encrypted_payload`] to find out the onion + * message or payment's next hop and forward it along. + * + * [`encrypted_payload`]: BlindedHop::encrypted_payload + */ +struct LDKPublicKey BlindedPath_get_introduction_node_id(const struct LDKBlindedPath *NONNULL_PTR this_ptr); + +/** + * To send to a blinded path, the sender first finds a route to the unblinded + * `introduction_node_id`, which can unblind its [`encrypted_payload`] to find out the onion + * message or payment's next hop and forward it along. + * + * [`encrypted_payload`]: BlindedHop::encrypted_payload + */ +void BlindedPath_set_introduction_node_id(struct LDKBlindedPath *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Used by the introduction node to decrypt its [`encrypted_payload`] to forward the onion + * message or payment. + * + * [`encrypted_payload`]: BlindedHop::encrypted_payload + */ +struct LDKPublicKey BlindedPath_get_blinding_point(const struct LDKBlindedPath *NONNULL_PTR this_ptr); + +/** + * Used by the introduction node to decrypt its [`encrypted_payload`] to forward the onion + * message or payment. + * + * [`encrypted_payload`]: BlindedHop::encrypted_payload + */ +void BlindedPath_set_blinding_point(struct LDKBlindedPath *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * The hops composing the blinded path. + */ +struct LDKCVec_BlindedHopZ BlindedPath_get_blinded_hops(const struct LDKBlindedPath *NONNULL_PTR this_ptr); + +/** + * The hops composing the blinded path. + */ +void BlindedPath_set_blinded_hops(struct LDKBlindedPath *NONNULL_PTR this_ptr, struct LDKCVec_BlindedHopZ val); + +/** + * Constructs a new BlindedPath given each field + */ +MUST_USE_RES struct LDKBlindedPath BlindedPath_new(struct LDKPublicKey introduction_node_id_arg, struct LDKPublicKey blinding_point_arg, struct LDKCVec_BlindedHopZ blinded_hops_arg); + /** * Creates a copy of the BlindedPath */ @@ -40685,6 +44070,33 @@ bool BlindedPath_eq(const struct LDKBlindedPath *NONNULL_PTR a, const struct LDK */ void BlindedHop_free(struct LDKBlindedHop this_obj); +/** + * The blinded node id of this hop in a [`BlindedPath`]. + */ +struct LDKPublicKey BlindedHop_get_blinded_node_id(const struct LDKBlindedHop *NONNULL_PTR this_ptr); + +/** + * The blinded node id of this hop in a [`BlindedPath`]. + */ +void BlindedHop_set_blinded_node_id(struct LDKBlindedHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * The encrypted payload intended for this hop in a [`BlindedPath`]. + * + * Returns a copy of the field. + */ +struct LDKCVec_u8Z BlindedHop_get_encrypted_payload(const struct LDKBlindedHop *NONNULL_PTR this_ptr); + +/** + * The encrypted payload intended for this hop in a [`BlindedPath`]. + */ +void BlindedHop_set_encrypted_payload(struct LDKBlindedHop *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); + +/** + * Constructs a new BlindedHop given each field + */ +MUST_USE_RES struct LDKBlindedHop BlindedHop_new(struct LDKPublicKey blinded_node_id_arg, struct LDKCVec_u8Z encrypted_payload_arg); + /** * Creates a copy of the BlindedHop */ @@ -40710,6 +44122,11 @@ bool BlindedHop_eq(const struct LDKBlindedHop *NONNULL_PTR a, const struct LDKBl */ MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new_for_message(struct LDKCVec_PublicKeyZ node_pks, const struct LDKEntropySource *NONNULL_PTR entropy_source); +/** + * Create a one-hop blinded path for a payment. + */ +MUST_USE_RES struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ BlindedPath_one_hop_for_payment(struct LDKPublicKey payee_node_id, struct LDKReceiveTlvs payee_tlvs, const struct LDKEntropySource *NONNULL_PTR entropy_source); + /** * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read */ @@ -40730,6 +44147,270 @@ struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj) */ struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser); +/** + * Frees any resources used by the ForwardNode, if is_owned is set and inner is non-NULL. + */ +void ForwardNode_free(struct LDKForwardNode this_obj); + +/** + * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also + * used for [`BlindedPayInfo`] construction. + */ +struct LDKForwardTlvs ForwardNode_get_tlvs(const struct LDKForwardNode *NONNULL_PTR this_ptr); + +/** + * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also + * used for [`BlindedPayInfo`] construction. + */ +void ForwardNode_set_tlvs(struct LDKForwardNode *NONNULL_PTR this_ptr, struct LDKForwardTlvs val); + +/** + * This node's pubkey. + */ +struct LDKPublicKey ForwardNode_get_node_id(const struct LDKForwardNode *NONNULL_PTR this_ptr); + +/** + * This node's pubkey. + */ +void ForwardNode_set_node_id(struct LDKForwardNode *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * The maximum value, in msat, that may be accepted by this node. + */ +uint64_t ForwardNode_get_htlc_maximum_msat(const struct LDKForwardNode *NONNULL_PTR this_ptr); + +/** + * The maximum value, in msat, that may be accepted by this node. + */ +void ForwardNode_set_htlc_maximum_msat(struct LDKForwardNode *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new ForwardNode given each field + */ +MUST_USE_RES struct LDKForwardNode ForwardNode_new(struct LDKForwardTlvs tlvs_arg, struct LDKPublicKey node_id_arg, uint64_t htlc_maximum_msat_arg); + +/** + * Creates a copy of the ForwardNode + */ +struct LDKForwardNode ForwardNode_clone(const struct LDKForwardNode *NONNULL_PTR orig); + +/** + * Frees any resources used by the ForwardTlvs, if is_owned is set and inner is non-NULL. + */ +void ForwardTlvs_free(struct LDKForwardTlvs this_obj); + +/** + * The short channel id this payment should be forwarded out over. + */ +uint64_t ForwardTlvs_get_short_channel_id(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); + +/** + * The short channel id this payment should be forwarded out over. + */ +void ForwardTlvs_set_short_channel_id(struct LDKForwardTlvs *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Payment parameters for relaying over [`Self::short_channel_id`]. + */ +struct LDKPaymentRelay ForwardTlvs_get_payment_relay(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); + +/** + * Payment parameters for relaying over [`Self::short_channel_id`]. + */ +void ForwardTlvs_set_payment_relay(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentRelay val); + +/** + * Payment constraints for relaying over [`Self::short_channel_id`]. + */ +struct LDKPaymentConstraints ForwardTlvs_get_payment_constraints(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); + +/** + * Payment constraints for relaying over [`Self::short_channel_id`]. + */ +void ForwardTlvs_set_payment_constraints(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); + +/** + * Supported and required features when relaying a payment onion containing this object's + * corresponding [`BlindedHop::encrypted_payload`]. + * + * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload + */ +struct LDKBlindedHopFeatures ForwardTlvs_get_features(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); + +/** + * Supported and required features when relaying a payment onion containing this object's + * corresponding [`BlindedHop::encrypted_payload`]. + * + * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload + */ +void ForwardTlvs_set_features(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val); + +/** + * Constructs a new ForwardTlvs given each field + */ +MUST_USE_RES struct LDKForwardTlvs ForwardTlvs_new(uint64_t short_channel_id_arg, struct LDKPaymentRelay payment_relay_arg, struct LDKPaymentConstraints payment_constraints_arg, struct LDKBlindedHopFeatures features_arg); + +/** + * Creates a copy of the ForwardTlvs + */ +struct LDKForwardTlvs ForwardTlvs_clone(const struct LDKForwardTlvs *NONNULL_PTR orig); + +/** + * Frees any resources used by the ReceiveTlvs, if is_owned is set and inner is non-NULL. + */ +void ReceiveTlvs_free(struct LDKReceiveTlvs this_obj); + +/** + * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. + */ +const uint8_t (*ReceiveTlvs_get_payment_secret(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr))[32]; + +/** + * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. + */ +void ReceiveTlvs_set_payment_secret(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Constraints for the receiver of this payment. + */ +struct LDKPaymentConstraints ReceiveTlvs_get_payment_constraints(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr); + +/** + * Constraints for the receiver of this payment. + */ +void ReceiveTlvs_set_payment_constraints(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); + +/** + * Constructs a new ReceiveTlvs given each field + */ +MUST_USE_RES struct LDKReceiveTlvs ReceiveTlvs_new(struct LDKThirtyTwoBytes payment_secret_arg, struct LDKPaymentConstraints payment_constraints_arg); + +/** + * Creates a copy of the ReceiveTlvs + */ +struct LDKReceiveTlvs ReceiveTlvs_clone(const struct LDKReceiveTlvs *NONNULL_PTR orig); + +/** + * Frees any resources used by the PaymentRelay, if is_owned is set and inner is non-NULL. + */ +void PaymentRelay_free(struct LDKPaymentRelay this_obj); + +/** + * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`]. + */ +uint16_t PaymentRelay_get_cltv_expiry_delta(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); + +/** + * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`]. + */ +void PaymentRelay_set_cltv_expiry_delta(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint16_t val); + +/** + * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over + * this [`BlindedHop`], (i.e., 10,000 is 1%). + */ +uint32_t PaymentRelay_get_fee_proportional_millionths(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); + +/** + * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over + * this [`BlindedHop`], (i.e., 10,000 is 1%). + */ +void PaymentRelay_set_fee_proportional_millionths(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val); + +/** + * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. + */ +uint32_t PaymentRelay_get_fee_base_msat(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); + +/** + * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. + */ +void PaymentRelay_set_fee_base_msat(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val); + +/** + * Constructs a new PaymentRelay given each field + */ +MUST_USE_RES struct LDKPaymentRelay PaymentRelay_new(uint16_t cltv_expiry_delta_arg, uint32_t fee_proportional_millionths_arg, uint32_t fee_base_msat_arg); + +/** + * Creates a copy of the PaymentRelay + */ +struct LDKPaymentRelay PaymentRelay_clone(const struct LDKPaymentRelay *NONNULL_PTR orig); + +/** + * Frees any resources used by the PaymentConstraints, if is_owned is set and inner is non-NULL. + */ +void PaymentConstraints_free(struct LDKPaymentConstraints this_obj); + +/** + * The maximum total CLTV delta that is acceptable when relaying a payment over this + * [`BlindedHop`]. + */ +uint32_t PaymentConstraints_get_max_cltv_expiry(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr); + +/** + * The maximum total CLTV delta that is acceptable when relaying a payment over this + * [`BlindedHop`]. + */ +void PaymentConstraints_set_max_cltv_expiry(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint32_t val); + +/** + * The minimum value, in msat, that may be accepted by the node corresponding to this + * [`BlindedHop`]. + */ +uint64_t PaymentConstraints_get_htlc_minimum_msat(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr); + +/** + * The minimum value, in msat, that may be accepted by the node corresponding to this + * [`BlindedHop`]. + */ +void PaymentConstraints_set_htlc_minimum_msat(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new PaymentConstraints given each field + */ +MUST_USE_RES struct LDKPaymentConstraints PaymentConstraints_new(uint32_t max_cltv_expiry_arg, uint64_t htlc_minimum_msat_arg); + +/** + * Creates a copy of the PaymentConstraints + */ +struct LDKPaymentConstraints PaymentConstraints_clone(const struct LDKPaymentConstraints *NONNULL_PTR orig); + +/** + * Serialize the ForwardTlvs object into a byte array which can be read by ForwardTlvs_read + */ +struct LDKCVec_u8Z ForwardTlvs_write(const struct LDKForwardTlvs *NONNULL_PTR obj); + +/** + * Serialize the ReceiveTlvs object into a byte array which can be read by ReceiveTlvs_read + */ +struct LDKCVec_u8Z ReceiveTlvs_write(const struct LDKReceiveTlvs *NONNULL_PTR obj); + +/** + * Read a ReceiveTlvs from a byte array, created by ReceiveTlvs_write + */ +struct LDKCResult_ReceiveTlvsDecodeErrorZ ReceiveTlvs_read(struct LDKu8slice ser); + +/** + * Serialize the PaymentRelay object into a byte array which can be read by PaymentRelay_read + */ +struct LDKCVec_u8Z PaymentRelay_write(const struct LDKPaymentRelay *NONNULL_PTR obj); + +/** + * Read a PaymentRelay from a byte array, created by PaymentRelay_write + */ +struct LDKCResult_PaymentRelayDecodeErrorZ PaymentRelay_read(struct LDKu8slice ser); + +/** + * Serialize the PaymentConstraints object into a byte array which can be read by PaymentConstraints_read + */ +struct LDKCVec_u8Z PaymentConstraints_write(const struct LDKPaymentConstraints *NONNULL_PTR obj); + +/** + * Read a PaymentConstraints from a byte array, created by PaymentConstraints_write + */ +struct LDKCResult_PaymentConstraintsDecodeErrorZ PaymentConstraints_read(struct LDKu8slice ser); + /** * Frees any resources used by the PaymentPurpose */ @@ -40743,7 +44424,7 @@ struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NO /** * Utility method to constructs a new InvoicePayment-variant PaymentPurpose */ -struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKCOption_PaymentPreimageZ payment_preimage, struct LDKThirtyTwoBytes payment_secret); +struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret); /** * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose @@ -40766,6 +44447,102 @@ struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_ */ struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser); +/** + * Frees any resources used by the ClaimedHTLC, if is_owned is set and inner is non-NULL. + */ +void ClaimedHTLC_free(struct LDKClaimedHTLC this_obj); + +/** + * The `channel_id` of the channel over which the HTLC was received. + */ +const uint8_t (*ClaimedHTLC_get_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr))[32]; + +/** + * The `channel_id` of the channel over which the HTLC was received. + */ +void ClaimedHTLC_set_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The `user_channel_id` of the channel over which the HTLC was received. This is the value + * passed in to [`ChannelManager::create_channel`] for outbound channels, or to + * [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. + * + * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This + * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but + * was not actually claimed until after upgrading.) + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ +struct LDKU128 ClaimedHTLC_get_user_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); + +/** + * The `user_channel_id` of the channel over which the HTLC was received. This is the value + * passed in to [`ChannelManager::create_channel`] for outbound channels, or to + * [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. + * + * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This + * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but + * was not actually claimed until after upgrading.) + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ +void ClaimedHTLC_set_user_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKU128 val); + +/** + * The block height at which this HTLC expires. + */ +uint32_t ClaimedHTLC_get_cltv_expiry(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); + +/** + * The block height at which this HTLC expires. + */ +void ClaimedHTLC_set_cltv_expiry(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint32_t val); + +/** + * The amount (in msats) of this part of an MPP. + */ +uint64_t ClaimedHTLC_get_value_msat(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); + +/** + * The amount (in msats) of this part of an MPP. + */ +void ClaimedHTLC_set_value_msat(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new ClaimedHTLC given each field + */ +MUST_USE_RES struct LDKClaimedHTLC ClaimedHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKU128 user_channel_id_arg, uint32_t cltv_expiry_arg, uint64_t value_msat_arg); + +/** + * Creates a copy of the ClaimedHTLC + */ +struct LDKClaimedHTLC ClaimedHTLC_clone(const struct LDKClaimedHTLC *NONNULL_PTR orig); + +/** + * Checks if two ClaimedHTLCs contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool ClaimedHTLC_eq(const struct LDKClaimedHTLC *NONNULL_PTR a, const struct LDKClaimedHTLC *NONNULL_PTR b); + +/** + * Serialize the ClaimedHTLC object into a byte array which can be read by ClaimedHTLC_read + */ +struct LDKCVec_u8Z ClaimedHTLC_write(const struct LDKClaimedHTLC *NONNULL_PTR obj); + +/** + * Read a ClaimedHTLC from a byte array, created by ClaimedHTLC_write + */ +struct LDKCResult_ClaimedHTLCDecodeErrorZ ClaimedHTLC_read(struct LDKu8slice ser); + /** * Frees any resources used by the PathFailure */ @@ -40857,6 +44634,11 @@ struct LDKClosureReason ClosureReason_outdated_channel_manager(void); */ struct LDKClosureReason ClosureReason_counterparty_coop_closed_unfunded_channel(void); +/** + * Utility method to constructs a new FundingBatchClosure-variant ClosureReason + */ +struct LDKClosureReason ClosureReason_funding_batch_closure(void); + /** * Checks if two ClosureReasons contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -40988,17 +44770,17 @@ struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporar /** * Utility method to constructs a new PaymentClaimable-variant Event */ -struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields onion_fields, uint64_t amount_msat, uint64_t counterparty_skimmed_fee_msat, struct LDKPaymentPurpose purpose, struct LDKThirtyTwoBytes via_channel_id, struct LDKCOption_u128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline); +struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields onion_fields, uint64_t amount_msat, uint64_t counterparty_skimmed_fee_msat, struct LDKPaymentPurpose purpose, struct LDKCOption_ThirtyTwoBytesZ via_channel_id, struct LDKCOption_U128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline); /** * Utility method to constructs a new PaymentClaimed-variant Event */ -struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose); +struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKCVec_ClaimedHTLCZ htlcs, struct LDKCOption_u64Z sender_intended_total_msat); /** * Utility method to constructs a new PaymentSent-variant Event */ -struct LDKEvent Event_payment_sent(struct LDKCOption_PaymentIdZ payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat); +struct LDKEvent Event_payment_sent(struct LDKCOption_ThirtyTwoBytesZ payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat); /** * Utility method to constructs a new PaymentFailed-variant Event @@ -41008,12 +44790,12 @@ struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct /** * Utility method to constructs a new PaymentPathSuccessful-variant Event */ -struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_PaymentHashZ payment_hash, struct LDKPath path); +struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKPath path); /** * Utility method to constructs a new PaymentPathFailed-variant Event */ -struct LDKEvent Event_payment_path_failed(struct LDKCOption_PaymentIdZ payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKPath path, struct LDKCOption_u64Z short_channel_id); +struct LDKEvent Event_payment_path_failed(struct LDKCOption_ThirtyTwoBytesZ payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKPath path, struct LDKCOption_u64Z short_channel_id); /** * Utility method to constructs a new ProbeSuccessful-variant Event @@ -41038,17 +44820,17 @@ struct LDKEvent Event_htlcintercepted(struct LDKThirtyTwoBytes intercept_id, uin /** * Utility method to constructs a new SpendableOutputs-variant Event */ -struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs); +struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs, struct LDKCOption_ThirtyTwoBytesZ channel_id); /** * Utility method to constructs a new PaymentForwarded-variant Event */ -struct LDKEvent Event_payment_forwarded(struct LDKThirtyTwoBytes prev_channel_id, struct LDKThirtyTwoBytes next_channel_id, struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat); +struct LDKEvent Event_payment_forwarded(struct LDKCOption_ThirtyTwoBytesZ prev_channel_id, struct LDKCOption_ThirtyTwoBytesZ next_channel_id, struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat); /** * Utility method to constructs a new ChannelPending-variant Event */ -struct LDKEvent Event_channel_pending(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKThirtyTwoBytes former_temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding_txo); +struct LDKEvent Event_channel_pending(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding_txo); /** * Utility method to constructs a new ChannelReady-variant Event @@ -41058,7 +44840,7 @@ struct LDKEvent Event_channel_ready(struct LDKThirtyTwoBytes channel_id, struct /** * Utility method to constructs a new ChannelClosed-variant Event */ -struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason); +struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u64Z channel_capacity_sats); /** * Utility method to constructs a new DiscardFunding-variant Event @@ -41179,7 +44961,7 @@ struct LDKMessageSendEvent MessageSendEvent_send_tx_ack_rbf(struct LDKPublicKey /** * Utility method to constructs a new SendTxAbort-variant MessageSendEvent */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_abort(struct LDKPublicKey node_id, struct LDKTxAddInput msg); +struct LDKMessageSendEvent MessageSendEvent_send_tx_abort(struct LDKPublicKey node_id, struct LDKTxAbort msg); /** * Utility method to constructs a new SendChannelReady-variant MessageSendEvent @@ -41344,6 +45126,16 @@ struct LDKChannelDerivationParameters ChannelDerivationParameters_clone(const st */ bool ChannelDerivationParameters_eq(const struct LDKChannelDerivationParameters *NONNULL_PTR a, const struct LDKChannelDerivationParameters *NONNULL_PTR b); +/** + * Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read + */ +struct LDKCVec_u8Z ChannelDerivationParameters_write(const struct LDKChannelDerivationParameters *NONNULL_PTR obj); + +/** + * Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write + */ +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ ChannelDerivationParameters_read(struct LDKu8slice ser); + /** * Frees any resources used by the AnchorDescriptor, if is_owned is set and inner is non-NULL. */ @@ -41409,7 +45201,7 @@ MUST_USE_RES struct LDKCVec_u8Z AnchorDescriptor_witness_script(const struct LDK * Returns the fully signed witness required to spend the anchor output in the commitment * transaction. */ -MUST_USE_RES struct LDKWitness AnchorDescriptor_tx_input_witness(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, struct LDKSignature signature); +MUST_USE_RES struct LDKWitness AnchorDescriptor_tx_input_witness(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature); /** * Derives the channel signer required to sign the anchor input. @@ -41473,23 +45265,23 @@ void HTLCDescriptor_set_htlc(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, str * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be * taken. */ -struct LDKCOption_PaymentPreimageZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +struct LDKCOption_ThirtyTwoBytesZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be * taken. */ -void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_PaymentPreimageZ val); +void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** * The counterparty's signature required to spend the HTLC output. */ -struct LDKSignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +struct LDKECDSASignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** * The counterparty's signature required to spend the HTLC output. */ -void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKSignature val); +void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Creates a copy of the HTLCDescriptor @@ -41503,6 +45295,16 @@ struct LDKHTLCDescriptor HTLCDescriptor_clone(const struct LDKHTLCDescriptor *NO */ bool HTLCDescriptor_eq(const struct LDKHTLCDescriptor *NONNULL_PTR a, const struct LDKHTLCDescriptor *NONNULL_PTR b); +/** + * Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_read + */ +struct LDKCVec_u8Z HTLCDescriptor_write(const struct LDKHTLCDescriptor *NONNULL_PTR obj); + +/** + * Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_write + */ +struct LDKCResult_HTLCDescriptorDecodeErrorZ HTLCDescriptor_read(struct LDKu8slice ser); + /** * Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint * being spent by the HTLC input in the HTLC transaction. @@ -41536,7 +45338,7 @@ MUST_USE_RES struct LDKCVec_u8Z HTLCDescriptor_witness_script(const struct LDKHT * Returns the fully signed witness required to spend the HTLC output in the commitment * transaction. */ -MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKSignature signature, struct LDKu8slice witness_script); +MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature, struct LDKu8slice witness_script); /** * Derives the channel signer required to sign the HTLC input. @@ -41784,25 +45586,25 @@ MUST_USE_RES struct LDKBumpTransactionEventHandler BumpTransactionEventHandler_n void BumpTransactionEventHandler_handle_event(const struct LDKBumpTransactionEventHandler *NONNULL_PTR this_arg, const struct LDKBumpTransactionEvent *NONNULL_PTR event); /** - * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL. + * Frees any resources used by the FilesystemStore, if is_owned is set and inner is non-NULL. */ -void FilesystemPersister_free(struct LDKFilesystemPersister this_obj); +void FilesystemStore_free(struct LDKFilesystemStore this_obj); /** - * Initialize a new FilesystemPersister and set the path to the individual channels' - * files. + * Constructs a new [`FilesystemStore`]. */ -MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data); +MUST_USE_RES struct LDKFilesystemStore FilesystemStore_new(struct LDKStr data_dir); /** - * Get the directory which was provided when this persister was initialized. + * Returns the data directory. */ -MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKStr FilesystemStore_get_data_dir(const struct LDKFilesystemStore *NONNULL_PTR this_arg); /** - * Read `ChannelMonitor`s from disk. + * Constructs a new KVStore which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned KVStore must be freed before this_arg is */ -MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKEntropySource entropy_source, const struct LDKSignerProvider *NONNULL_PTR signer_provider); +struct LDKKVStore FilesystemStore_as_KVStore(const struct LDKFilesystemStore *NONNULL_PTR this_arg); /** * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL. @@ -41888,7 +45690,7 @@ MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKP * * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager */ -MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg); +MUST_USE_RES struct LDKCResult_NoneIOErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg); /** * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting @@ -41901,7 +45703,7 @@ MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBac * * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager */ -MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg); +MUST_USE_RES struct LDKCResult_NoneIOErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg); /** * Frees any resources used by the Bolt11ParseError @@ -42488,7 +46290,7 @@ MUST_USE_RES struct LDKBolt11InvoiceSignature SignedRawBolt11Invoice_signature(c /** * Recovers the public key used for signing the invoice from the recoverable signature. */ -MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawBolt11Invoice_recover_payee_pub_key(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_PayeePubKeySecp256k1ErrorZ SignedRawBolt11Invoice_recover_payee_pub_key(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg); /** * Checks if the signature is valid for the included payee public key or if none exists if it's @@ -42537,7 +46339,7 @@ MUST_USE_RES struct LDKExpiryTime RawBolt11Invoice_expiry_time(const struct LDKR */ MUST_USE_RES struct LDKMinFinalCltvExpiryDelta RawBolt11Invoice_min_final_cltv_expiry_delta(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); -MUST_USE_RES struct LDKCOption_PaymentSecretZ RawBolt11Invoice_payment_secret(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_ThirtyTwoBytesZ RawBolt11Invoice_payment_secret(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); MUST_USE_RES struct LDKCOption_CVec_u8ZZ RawBolt11Invoice_payment_metadata(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); @@ -42682,7 +46484,7 @@ MUST_USE_RES struct LDKPublicKey Bolt11Invoice_recover_payee_pub_key(const struc * Returns the Duration since the Unix epoch at which the invoice expires. * Returning None if overflow occurred. */ -MUST_USE_RES struct LDKCOption_DurationZ Bolt11Invoice_expires_at(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z Bolt11Invoice_expires_at(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`]. @@ -42720,7 +46522,7 @@ MUST_USE_RES uint64_t Bolt11Invoice_min_final_cltv_expiry_delta(const struct LDK /** * Returns a list of all fallback addresses as [`Address`]es */ -MUST_USE_RES struct LDKCVec_AddressZ Bolt11Invoice_fallback_addresses(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_StrZ Bolt11Invoice_fallback_addresses(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** * Returns a list of all routes included in the invoice @@ -42937,7 +46739,7 @@ struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NO * * If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`]. */ -struct LDKCResult_PaymentIdPaymentErrorZ pay_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); +struct LDKCResult_ThirtyTwoBytesPaymentErrorZ pay_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); /** * Pays the given [`Bolt11Invoice`] with a custom idempotency key, retrying if needed based on @@ -42964,7 +46766,7 @@ struct LDKCResult_NonePaymentErrorZ pay_invoice_with_id(const struct LDKBolt11In * If you wish to use a different payment idempotency token, see * [`pay_zero_value_invoice_with_id`]. */ -struct LDKCResult_PaymentIdPaymentErrorZ pay_zero_value_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); +struct LDKCResult_ThirtyTwoBytesPaymentErrorZ pay_zero_value_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); /** * Pays the given zero-value [`Bolt11Invoice`] using the given amount and custom idempotency key, @@ -42981,6 +46783,21 @@ struct LDKCResult_PaymentIdPaymentErrorZ pay_zero_value_invoice(const struct LDK */ struct LDKCResult_NonePaymentErrorZ pay_zero_value_invoice_with_id(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); +/** + * Sends payment probes over all paths of a route that would be used to pay the given invoice. + * + * See [`ChannelManager::send_preflight_probes`] for more information. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ preflight_probe_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKCOption_u64Z liquidity_limit_multiplier); + +/** + * Sends payment probes over all paths of a route that would be used to pay the given zero-value + * invoice using the given amount. + * + * See [`ChannelManager::send_preflight_probes`] for more information. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ preflight_probe_zero_value_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msat, const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKCOption_u64Z liquidity_limit_multiplier); + /** * Frees any resources used by the PaymentError */ @@ -43007,6 +46824,32 @@ struct LDKPaymentError PaymentError_sending(enum LDKRetryableSendFailure a); */ bool PaymentError_eq(const struct LDKPaymentError *NONNULL_PTR a, const struct LDKPaymentError *NONNULL_PTR b); +/** + * Frees any resources used by the ProbingError + */ +void ProbingError_free(struct LDKProbingError this_ptr); + +/** + * Creates a copy of the ProbingError + */ +struct LDKProbingError ProbingError_clone(const struct LDKProbingError *NONNULL_PTR orig); + +/** + * Utility method to constructs a new Invoice-variant ProbingError + */ +struct LDKProbingError ProbingError_invoice(struct LDKStr a); + +/** + * Utility method to constructs a new Sending-variant ProbingError + */ +struct LDKProbingError ProbingError_sending(struct LDKProbeSendFailure a); + +/** + * Checks if two ProbingErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool ProbingError_eq(const struct LDKProbingError *NONNULL_PTR a, const struct LDKProbingError *NONNULL_PTR b); + /** * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" * See [`PhantomKeysManager`] for more information on phantom node payments. @@ -43049,7 +46892,7 @@ bool PaymentError_eq(const struct LDKPaymentError *NONNULL_PTR a, const struct L * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not * available and the current time is supplied by the caller. */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKCOption_PaymentHashZ payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); /** * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" @@ -43091,7 +46934,7 @@ struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(struc * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not * available and the current time is supplied by the caller. */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKCOption_PaymentHashZ payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKCOption_ThirtyTwoBytesZ payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); /** * Utility to construct an invoice. Generally, unless you want to do something like a custom diff --git a/lightning-c-bindings/include/lightningpp.hpp b/lightning-c-bindings/include/lightningpp.hpp index 15be15d8..085eef7d 100644 --- a/lightning-c-bindings/include/lightningpp.hpp +++ b/lightning-c-bindings/include/lightningpp.hpp @@ -6,6 +6,7 @@ class Refund; class Retry; class RetryableSendFailure; class PaymentSendFailure; +class ProbeSendFailure; class RecipientOnionFields; class UnsignedBolt12Invoice; class Bolt12Invoice; @@ -38,11 +39,14 @@ class PaymentParameters; class Payee; class RouteHint; class RouteHintHop; +class ScoreLookUp; +class ScoreUpdate; class Score; class LockableScore; class WriteableScore; class MultiThreadedLockableScore; -class MultiThreadedScoreLock; +class MultiThreadedScoreLockRead; +class MultiThreadedScoreLockWrite; class ChannelUsage; class FixedPenaltyScorer; class ProbabilisticScorer; @@ -108,6 +112,7 @@ class ChannelConfig; class ChannelConfigUpdate; class UserConfig; class APIError; +class TaggedHash; class ChannelMonitorUpdate; class MonitorEvent; class HTLCUpdate; @@ -122,9 +127,12 @@ class SocketDescriptor; class PeerHandleError; class PeerManager; class RapidGossipSync; +class KVStore; class Persister; +class MonitorUpdatingPersister; class UnsignedInvoiceRequest; class InvoiceRequest; +class VerifiedInvoiceRequest; class DecodeError; class Init; class ErrorMessage; @@ -160,7 +168,8 @@ class RevokeAndACK; class UpdateFee; class ChannelReestablish; class AnnouncementSignatures; -class NetAddress; +class SocketAddress; +class SocketAddressParseError; class UnsignedGossipMessage; class UnsignedNodeAnnouncement; class NodeAnnouncement; @@ -208,9 +217,11 @@ class Bolt12SemanticError; class BroadcasterInterface; class ConfirmationTarget; class FeeEstimator; +class Packet; class OnionMessageContents; class CustomOnionMessageContents; class PaymentPurpose; +class ClaimedHTLC; class PathFailure; class ClosureReason; class HTLCDestination; @@ -221,7 +232,6 @@ class MessageSendEventsProvider; class OnionMessageProvider; class EventsProvider; class EventHandler; -class FilesystemPersister; class Bolt11ParseError; class ParseOrSemanticError; class Bolt11Invoice; @@ -250,7 +260,13 @@ class UntrustedString; class PrintableString; class CustomMessageReader; class Type; +class ForwardNode; +class ForwardTlvs; +class ReceiveTlvs; +class PaymentRelay; +class PaymentConstraints; class PaymentError; +class ProbingError; class UtxoLookupError; class UtxoResult; class UtxoLookup; @@ -262,6 +278,7 @@ class OnionMessagePath; class Destination; class SendError; class CustomOnionMessageHandler; +class FilesystemStore; class BlindedPath; class BlindedHop; class GraphSyncError; @@ -276,186 +293,189 @@ class CResult_TransactionU16LenLimitedNoneZ; class CVec_C2Tuple_BlindedPayInfoBlindedPathZZ; class CResult_PhantomRouteHintsDecodeErrorZ; class CResult_FundingCreatedDecodeErrorZ; -class CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ; class CVec_C2Tuple_u32TxOutZZ; -class CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ; -class COption_PaymentSecretZ; +class CResult_RetryDecodeErrorZ; +class CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ; class CResult_ChannelInfoDecodeErrorZ; class COption_MaxDustHTLCExposureZ; class CResult_NoneSendErrorZ; +class C2Tuple_CVec_u8ZusizeZ; class COption_OffersMessageZ; -class CResult_CVec_u8ZPeerHandleErrorZ; class COption_NetworkUpdateZ; class COption_u64Z; +class CResult_CVec_u8ZPeerHandleErrorZ; class CResult_GossipTimestampFilterDecodeErrorZ; -class CResult_PaymentPreimageAPIErrorZ; class CResult_RouteHintDecodeErrorZ; class COption_FilterZ; +class C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ; class COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ; class CResult_COption_APIErrorZDecodeErrorZ; class CVec_UpdateAddHTLCZ; class CResult_TxAbortDecodeErrorZ; class CResult_StaticPaymentOutputDescriptorDecodeErrorZ; class COption_u32Z; -class CResult_CommitmentSignedDecodeErrorZ; +class CResult_RecipientOnionFieldsNoneZ; +class C2Tuple__u1632_u1632Z; +class CResult_CVec_StrZIOErrorZ; class CResult_ClosingSignedFeeRangeDecodeErrorZ; class CResult_TransactionNoneZ; +class CResult_CommitmentSignedDecodeErrorZ; class CResult_CommitmentTransactionDecodeErrorZ; -class COption_DurationZ; -class C2Tuple_TxidCOption_BlockHashZZ; -class COption_PaymentHashZ; -class CResult_OpenChannelDecodeErrorZ; class CResult_ErrorMessageDecodeErrorZ; +class CResult_OpenChannelDecodeErrorZ; class COption_APIErrorZ; class CResult_QueryChannelRangeDecodeErrorZ; class CVec_TransactionZ; class CVec_InputZ; -class CResult_PartiallySignedTransactionNoneZ; class CResult_ChannelFeaturesDecodeErrorZ; class CResult_ChannelReadyDecodeErrorZ; class CResult_UpdateFeeDecodeErrorZ; class CResult_NoneBolt11SemanticErrorZ; class CResult_NoneRetryableSendFailureZ; -class COption_BlockHashZ; -class CResult_NodeIdDecodeErrorZ; class CResult_boolLightningErrorZ; +class CResult_NodeIdDecodeErrorZ; class CResult_ChannelShutdownStateDecodeErrorZ; +class CResult_HTLCOutputInCommitmentDecodeErrorZ; class CResult_NodeAnnouncementInfoDecodeErrorZ; -class C2Tuple_BlockHashChannelMonitorZ; +class CResult_ShutdownScriptInvalidShutdownScriptZ; class CResult_COption_NetworkUpdateZDecodeErrorZ; class CVec_UpdateFailMalformedHTLCZ; class CResult_ShutdownScriptNoneZ; -class CResult_HTLCOutputInCommitmentDecodeErrorZ; -class CResult_ShutdownScriptInvalidShutdownScriptZ; -class CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ; class COption_HTLCDestinationZ; class CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ; class CVec_RouteHopZ; +class CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ; class CResult_CVec_UtxoZNoneZ; +class CResult_CVec_u8ZIOErrorZ; class COption_CustomOnionMessageContentsZ; -class CVec_C2Tuple_BlockHashChannelMonitorZZ; -class CResult_COption_KeyPairZNoneZ; class CVec_ThirtyTwoBytesZ; +class CResult_ChannelMonitorUpdateStatusNoneZ; class CResult_ClosingSignedDecodeErrorZ; class CResult_NonePaymentErrorZ; class CVec_CResult_NoneAPIErrorZZ; +class CResult_SchnorrSignatureNoneZ; class CResult_CounterpartyCommitmentSecretsDecodeErrorZ; +class CResult_ReceiveTlvsDecodeErrorZ; +class CResult_HTLCDescriptorDecodeErrorZ; class CVec_RecentPaymentDetailsZ; -class CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ; class CVec_RouteHintHopZ; class CResult_UntrustedStringDecodeErrorZ; class CVec_U5Z; class CResult_PaymentParametersDecodeErrorZ; +class C2Tuple_ThirtyTwoBytesChannelMonitorZ; +class COption_U128Z; +class C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ; class CResult_TxAckRbfDecodeErrorZ; class CResult_Bolt11InvoiceBolt11SemanticErrorZ; class COption_UtxoLookupZ; class CResult_PongDecodeErrorZ; class CResult_UnsignedChannelAnnouncementDecodeErrorZ; class C2Tuple_OutPointCVec_MonitorUpdateIdZZ; -class CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ; -class C2Tuple_BlockHashChannelManagerZ; +class CResult_CVec_u8ZNoneZ; +class C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ; class CResult_ChannelTransactionParametersDecodeErrorZ; class CResult_WriteableEcdsaChannelSignerDecodeErrorZ; class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ; -class C2Tuple_PaymentHashPaymentIdZ; -class CResult_NoneErrorZ; class CResult_InFlightHtlcsDecodeErrorZ; class CResult_COption_HTLCDestinationZDecodeErrorZ; +class CResult_ThirtyTwoBytesNoneZ; class C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ; class CResult_BlindedHopDecodeErrorZ; -class CResult_NoneLightningErrorZ; +class C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ; class CResult_FixedPenaltyScorerDecodeErrorZ; class CVec_BlindedPathZ; -class CResult_PaymentHashRetryableSendFailureZ; -class C2Tuple_PublicKeyCOption_NetAddressZZ; -class COption_CVec_NetAddressZZ; +class CResult_NoneLightningErrorZ; class CResult_NonePeerHandleErrorZ; class CResult_TrustedCommitmentTransactionNoneZ; -class CResult_CVec_SignatureZNoneZ; +class CResult_COption_EventZDecodeErrorZ; +class CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ; class CResult_PaymentFailureReasonDecodeErrorZ; -class CResult__u832APIErrorZ; +class COption_SocketAddressZ; class CResult_COption_MonitorEventZDecodeErrorZ; -class CResult_COption_EventZDecodeErrorZ; -class CResult_RoutingFeesDecodeErrorZ; -class CResult_PayeePubKeyErrorZ; +class COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ; class CResult_DescriptionCreationErrorZ; -class CResult_PaymentIdPaymentErrorZ; +class CResult_RoutingFeesDecodeErrorZ; +class CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ; +class CResult_PaymentRelayDecodeErrorZ; +class CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ; class CResult_QueryShortChannelIdsDecodeErrorZ; +class CResult_VerifiedInvoiceRequestNoneZ; class CResult_UpdateAddHTLCDecodeErrorZ; class COption_MonitorEventZ; -class COption_CVec_ChainHashZZ; class COption_TypeZ; class CResult_COption_TypeZDecodeErrorZ; -class COption_KeyPairZ; +class CResult_COption_PathFailureZDecodeErrorZ; class CResult_Bolt11InvoiceSignOrCreationErrorZ; -class COption_ScriptZ; class CResult_UpdateFailHTLCDecodeErrorZ; -class CResult_COption_PathFailureZDecodeErrorZ; +class CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ; class CResult_RevokeAndACKDecodeErrorZ; class CResult_SpendableOutputDescriptorDecodeErrorZ; +class C2Tuple_PublicKeyCOption_SocketAddressZZ; class CResult_UnsignedChannelUpdateDecodeErrorZ; -class CVec_C2Tuple_u32ScriptZZ; -class CResult_InvoiceErrorDecodeErrorZ; +class CResult_PayeePubKeySecp256k1ErrorZ; +class COption_BigEndianScalarZ; +class CResult_PublicKeySecp256k1ErrorZ; +class CResult_CVec_ECDSASignatureZNoneZ; class CVec_BlindedHopZ; -class CResult_PaymentHashPaymentSendFailureZ; class CResult_COption_ClosureReasonZDecodeErrorZ; +class CResult_InvoiceErrorDecodeErrorZ; class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; class CResult_RouteParametersDecodeErrorZ; class CResult_PrivateRouteCreationErrorZ; class CResult_NodeAliasDecodeErrorZ; class CVec_UpdateFulfillHTLCZ; +class CVec_C2Tuple_u32CVec_u8ZZZ; class CResult_AnnouncementSignaturesDecodeErrorZ; class CResult_UpdateFulfillHTLCDecodeErrorZ; class CResult_TxCompleteDecodeErrorZ; +class CResult_StrSecp256k1ErrorZ; class CResult_NodeFeaturesDecodeErrorZ; class CResult_InMemorySignerDecodeErrorZ; class CResult_TxSignaturesDecodeErrorZ; class CVec_HTLCDescriptorZ; class CResult_ReplyShortChannelIdsEndDecodeErrorZ; -class COption_ScalarZ; class COption_PathFailureZ; +class CVec_ECDSASignatureZ; class CResult_ChannelUpdateInfoDecodeErrorZ; -class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; class CVec_UpdateFailHTLCZ; class CVec_TxOutZ; class CResult_BuiltCommitmentTransactionDecodeErrorZ; class CVec_SpendableOutputDescriptorZ; +class C2Tuple_OutPointCVec_u8ZZ; class COption_C2Tuple_u64u64ZZ; class CResult_ChannelAnnouncementDecodeErrorZ; class CResult_HTLCUpdateDecodeErrorZ; -class C2Tuple_SignatureCVec_SignatureZZ; -class C2Tuple_PartiallySignedTransactionusizeZ; class CResult_TxAddInputDecodeErrorZ; -class COption_WriteableScoreZ; -class CResult_TxInitRbfDecodeErrorZ; class CVec_OutPointZ; +class CResult_TxInitRbfDecodeErrorZ; +class COption_WriteableScoreZ; +class CVec_StrZ; class CResult_PositiveTimestampCreationErrorZ; -class C2Tuple__u168_u168Z; class CResult_ChannelMonitorUpdateDecodeErrorZ; class C2Tuple_BlindedPayInfoBlindedPathZ; class CResult_ReplyChannelRangeDecodeErrorZ; -class COption_PaymentPreimageZ; -class CResult_NetAddressDecodeErrorZ; class CResult_UnsignedNodeAnnouncementDecodeErrorZ; +class CResult_TrustedClosingTransactionNoneZ; +class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ; class C2Tuple_PublicKeyTypeZ; class CResult_TxRemoveOutputDecodeErrorZ; class CResult_ChannelReestablishDecodeErrorZ; -class CResult_ScriptNoneZ; class CResult_OnionMessageDecodeErrorZ; -class CResult_TrustedClosingTransactionNoneZ; +class CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ; +class CResult_C2Tuple_CVec_u8ZusizeZNoneZ; class CResult_Bolt11InvoiceParseOrSemanticErrorZ; class CResult_InitFeaturesDecodeErrorZ; class CResult_PublicKeyNoneZ; class CResult_PingDecodeErrorZ; class CResult_BlindedHopFeaturesDecodeErrorZ; -class COption_PackedLockTimeZ; class CVec_TransactionOutputsZ; class COption_HTLCClaimZ; +class COption_boolZ; class CVec_CVec_u8ZZ; -class CResult_COption_CustomOnionMessageContentsZDecodeErrorZ; class CResult_ProbabilisticScorerDecodeErrorZ; +class CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ; +class CResult_COption_CustomOnionMessageContentsZDecodeErrorZ; class CResult_ShutdownScriptDecodeErrorZ; -class CResult_SiPrefixBolt11ParseErrorZ; class C2Tuple_usizeTransactionZ; class CResult_NodeAnnouncementDecodeErrorZ; class CVec_FutureZ; @@ -465,12 +485,18 @@ class CResult_TxCreationKeysDecodeErrorZ; class CResult_RouteHopDecodeErrorZ; class CVec_HTLCOutputInCommitmentZ; class CResult_CoinSelectionNoneZ; +class C2Tuple_ThirtyTwoBytesPublicKeyZ; +class CResult_SiPrefixBolt11ParseErrorZ; class CResult_BlindedPathDecodeErrorZ; class CVec_BalanceZ; +class CResult_NoneIOErrorZ; class CResult_MaxDustHTLCExposureDecodeErrorZ; +class CVec_CommitmentTransactionZ; class CResult_FundingSignedDecodeErrorZ; class CResult_RecoverableSignatureNoneZ; +class CResult_SocketAddressDecodeErrorZ; class C2Tuple_Z; +class C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ; class CVec_PathZ; class CResult_NetworkGraphDecodeErrorZ; class CResult_NodeInfoDecodeErrorZ; @@ -478,80 +504,87 @@ class CVec_NodeIdZ; class CVec_u8Z; class CResult_RouteLightningErrorZ; class CResult_NonePaymentSendFailureZ; +class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ; class CResult_ChannelPublicKeysDecodeErrorZ; -class CVec_C2Tuple_TxidCOption_BlockHashZZZ; +class CVec_ClaimedHTLCZ; +class COption_CVec_ThirtyTwoBytesZZ; +class CVec_SocketAddressZ; +class CResult_ThirtyTwoBytesPaymentSendFailureZ; class CResult_HolderCommitmentTransactionDecodeErrorZ; class CResult_WarningMessageDecodeErrorZ; class CResult_ChannelCounterpartyDecodeErrorZ; -class CResult_SignatureNoneZ; -class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; class CResult_InitDecodeErrorZ; -class CVec_MonitorUpdateIdZ; +class CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ; +class CResult_ClaimedHTLCDecodeErrorZ; class CResult_PaymentPurposeDecodeErrorZ; +class CVec_MonitorUpdateIdZ; class CResult_OutPointDecodeErrorZ; class CVec_ChannelDetailsZ; class CResult_Bolt11InvoiceFeaturesDecodeErrorZ; class CVec_MessageSendEventZ; -class COption_NetAddressZ; -class C2Tuple_OutPointScriptZ; class CResult_RouteHintHopDecodeErrorZ; class CResult_UpdateFailMalformedHTLCDecodeErrorZ; class CResult_BlindedPayInfoDecodeErrorZ; +class CResult_ThirtyTwoBytesAPIErrorZ; class COption_ChannelShutdownStateZ; -class CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ; -class CResult_SharedSecretNoneZ; -class CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ; class CResult_CVec_CVec_u8ZZNoneZ; -class C2Tuple_PaymentHashPaymentSecretZ; class CResult_AcceptChannelDecodeErrorZ; class CResult_HostnameDecodeErrorZ; -class CVec_SignatureZ; +class C2Tuple_u64u16Z; +class COption_ThirtyTwoBytesZ; class CVec_u64Z; -class CResult_StringErrorZ; -class C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; -class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ; +class COption_SecretKeyZ; +class CResult_ThirtyTwoBytesPaymentErrorZ; class COption_EventZ; class CResult_ChannelTypeFeaturesDecodeErrorZ; -class COption_TxidZ; +class COption_CVec_SocketAddressZZ; class CVec_RouteHintZ; class COption_u16Z; class COption_PaymentFailureReasonZ; -class CVec_ChainHashZ; +class CResult_ECDSASignatureNoneZ; class CVec_WitnessZ; class CResult_BlindedTailDecodeErrorZ; +class CResult_SocketAddressSocketAddressParseErrorZ; +class COption_C2Tuple_u64u16ZZ; class CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ; +class CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ; +class CResult_ChannelDerivationParametersDecodeErrorZ; +class CResult_PaymentConstraintsDecodeErrorZ; +class C2Tuple_u32CVec_u8ZZ; class CVec_C2Tuple_PublicKeyTypeZZ; class CResult_OnionMessagePathNoneZ; class CResult_RefundBolt12ParseErrorZ; class C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ; +class CVec_C2Tuple_u64CVec_u8ZZZ; class CResult_u32GraphSyncErrorZ; class CVec_PhantomRouteHintsZ; -class CResult_OffersMessageDecodeErrorZ; class CResult_NoneAPIErrorZ; class CResult_Bolt12InvoiceFeaturesDecodeErrorZ; -class CVec_NetAddressZ; +class COption_f64Z; class CResult_ChannelDetailsDecodeErrorZ; class CVec_PublicKeyZ; class CVec_C2Tuple_usizeTransactionZZ; class CResult_TxRemoveInputDecodeErrorZ; -class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ; -class COption_PaymentIdZ; +class CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ; +class CResult_OffersMessageDecodeErrorZ; class C2Tuple_u64u64Z; +class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ; class CResult_RecipientOnionFieldsDecodeErrorZ; class C2Tuple_u32TxOutZ; class CVec_UtxoZ; -class CResult_PaymentSecretNoneZ; class CResult_ChannelConfigDecodeErrorZ; class CVec_PrivateRouteZ; class COption_i64Z; -class CResult_BlindedPathNoneZ; +class C2Tuple_ThirtyTwoBytesChannelManagerZ; class CResult_ShutdownDecodeErrorZ; +class C2Tuple_u64CVec_u8ZZ; class CResult_OfferBolt12ParseErrorZ; -class CResult_TxOutUtxoLookupErrorZ; +class CResult_ThirtyTwoBytesRetryableSendFailureZ; class CVec_MonitorEventZ; -class CVec_PaymentPreimageZ; class CResult_BigSizeDecodeErrorZ; -class CResult_PublicKeyErrorZ; +class CResult_TxOutUtxoLookupErrorZ; +class CResult_BlindedPathNoneZ; +class COption_usizeZ; class CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ; class CResult_NoneNoneZ; class CResult_boolPeerHandleErrorZ; @@ -559,14 +592,15 @@ class CResult_ChannelUpdateDecodeErrorZ; class CVec_APIErrorZ; class COption_TxOutZ; class COption_ClosureReasonZ; -class COption_u128Z; -class CVec_AddressZ; +class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ; class CResult_TransactionU16LenLimitedDecodeErrorZ; +class CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ; class CResult_CounterpartyForwardingInfoDecodeErrorZ; class CResult_OpenChannelV2DecodeErrorZ; -class C2Tuple_u32ScriptZ; -class COption_C2Tuple_EightU16sEightU16sZZ; +class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ; +class C2Tuple_PublicKeyOnionMessageZ; class CResult_RouteDecodeErrorZ; +class CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ; class COption_NoneZ; class CResult_TxAddOutputDecodeErrorZ; class COption_CVec_u8ZZ; @@ -645,6 +679,21 @@ class PaymentSendFailure { const LDKPaymentSendFailure* operator &() const { return &self; } const LDKPaymentSendFailure* operator ->() const { return &self; } }; +class ProbeSendFailure { +private: + LDKProbeSendFailure self; +public: + ProbeSendFailure(const ProbeSendFailure&) = delete; + ProbeSendFailure(ProbeSendFailure&& o) : self(o.self) { memset(&o, 0, sizeof(ProbeSendFailure)); } + ProbeSendFailure(LDKProbeSendFailure&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKProbeSendFailure)); } + operator LDKProbeSendFailure() && { LDKProbeSendFailure res = self; memset(&self, 0, sizeof(LDKProbeSendFailure)); return res; } + ~ProbeSendFailure() { ProbeSendFailure_free(self); } + ProbeSendFailure& operator=(ProbeSendFailure&& o) { ProbeSendFailure_free(self); self = o.self; memset(&o, 0, sizeof(ProbeSendFailure)); return *this; } + LDKProbeSendFailure* operator &() { return &self; } + LDKProbeSendFailure* operator ->() { return &self; } + const LDKProbeSendFailure* operator &() const { return &self; } + const LDKProbeSendFailure* operator ->() const { return &self; } +}; class RecipientOnionFields { private: LDKRecipientOnionFields self; @@ -796,7 +845,7 @@ class ChannelSigner { * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. */ - inline LDK::CResult_NoneNoneZ validate_holder_commitment(const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages); + inline LDK::CResult_NoneNoneZ validate_holder_commitment(const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_ThirtyTwoBytesZ preimages); /** * Returns an arbitrary identifier describing the set of keys which are provided back to you in * some [`SpendableOutputDescriptor`] types. This should be sufficient to identify this @@ -845,7 +894,7 @@ class EcdsaChannelSigner { * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. */ - inline LDK::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages); + inline LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment(const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ preimages); /** * Validate the counterparty's revocation. * @@ -870,7 +919,7 @@ class EcdsaChannelSigner { * * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ - inline LDK::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); + inline LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_holder_commitment_and_htlcs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); /** * Create a signature for the given input in a transaction spending an HTLC transaction output * or a commitment transaction `to_local` output when our counterparty broadcasts an old state. @@ -887,7 +936,7 @@ class EcdsaChannelSigner { * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do * so). */ - inline LDK::CResult_SignatureNoneZ sign_justice_revoked_output(struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]); + inline LDK::CResult_ECDSASignatureNoneZ sign_justice_revoked_output(struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]); /** * Create a signature for the given input in a transaction spending a commitment transaction * HTLC output when our counterparty broadcasts an old state. @@ -908,7 +957,7 @@ class EcdsaChannelSigner { * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script * (which is committed to in the BIP 143 signatures). */ - inline LDK::CResult_SignatureNoneZ sign_justice_revoked_htlc(struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); + inline LDK::CResult_ECDSASignatureNoneZ sign_justice_revoked_htlc(struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** * Computes the signature for a commitment transaction's HTLC output used as an input within * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned @@ -918,7 +967,7 @@ class EcdsaChannelSigner { * * [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All */ - inline LDK::CResult_SignatureNoneZ sign_holder_htlc_transaction(struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor); + inline LDK::CResult_ECDSASignatureNoneZ sign_holder_htlc_transaction(struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor); /** * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment * transaction, either offered or received. @@ -938,19 +987,19 @@ class EcdsaChannelSigner { * channel state keys, which are then included in the witness script and committed to in the * BIP 143 signature. */ - inline LDK::CResult_SignatureNoneZ sign_counterparty_htlc_transaction(struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); + inline LDK::CResult_ECDSASignatureNoneZ sign_counterparty_htlc_transaction(struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** * Create a signature for a (proposed) closing transaction. * * Note that, due to rounding, there may be one "missing" satoshi, and either party may have * chosen to forgo their output as dust. */ - inline LDK::CResult_SignatureNoneZ sign_closing_transaction(const struct LDKClosingTransaction *NONNULL_PTR closing_tx); + inline LDK::CResult_ECDSASignatureNoneZ sign_closing_transaction(const struct LDKClosingTransaction *NONNULL_PTR closing_tx); /** * Computes the signature for a commitment transaction's anchor output used as an * input within `anchor_tx`, which spends the commitment transaction, at index `input`. */ - inline LDK::CResult_SignatureNoneZ sign_holder_anchor_input(struct LDKTransaction anchor_tx, uintptr_t input); + inline LDK::CResult_ECDSASignatureNoneZ sign_holder_anchor_input(struct LDKTransaction anchor_tx, uintptr_t input); /** * Signs a channel announcement message with our funding key proving it comes from one of the * channel participants. @@ -962,7 +1011,7 @@ class EcdsaChannelSigner { * our counterparty may (though likely will not) close the channel on us for violating the * protocol. */ - inline LDK::CResult_SignatureNoneZ sign_channel_announcement_with_funding_key(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); + inline LDK::CResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); }; class WriteableEcdsaChannelSigner { private: @@ -1058,7 +1107,7 @@ class NodeSigner { * * Errors if the [`Recipient`] variant is not supported by the implementation. */ - inline LDK::CResult_SharedSecretNoneZ ecdh(enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak); + inline LDK::CResult_ThirtyTwoBytesNoneZ ecdh(enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_BigEndianScalarZ tweak); /** * Sign an invoice. * @@ -1073,6 +1122,34 @@ class NodeSigner { * Errors if the [`Recipient`] variant is not supported by the implementation. */ inline LDK::CResult_RecoverableSignatureNoneZ sign_invoice(struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient recipient); + /** + * Signs the [`TaggedHash`] of a BOLT 12 invoice request. + * + * May be called by a function passed to [`UnsignedInvoiceRequest::sign`] where + * `invoice_request` is the callee. + * + * Implementors may check that the `invoice_request` is expected rather than blindly signing + * the tagged hash. An `Ok` result should sign `invoice_request.tagged_hash().as_digest()` with + * the node's signing key or an ephemeral key to preserve privacy, whichever is associated with + * [`UnsignedInvoiceRequest::payer_id`]. + * + * [`TaggedHash`]: crate::offers::merkle::TaggedHash + */ + inline LDK::CResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR invoice_request); + /** + * Signs the [`TaggedHash`] of a BOLT 12 invoice. + * + * May be called by a function passed to [`UnsignedBolt12Invoice::sign`] where `invoice` is the + * callee. + * + * Implementors may check that the `invoice` is expected rather than blindly signing the tagged + * hash. An `Ok` result should sign `invoice.tagged_hash().as_digest()` with the node's signing + * key or an ephemeral key to preserve privacy, whichever is associated with + * [`UnsignedBolt12Invoice::signing_pubkey`]. + * + * [`TaggedHash`]: crate::offers::merkle::TaggedHash + */ + inline LDK::CResult_SchnorrSignatureNoneZ sign_bolt12_invoice(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR invoice); /** * Sign a gossip message. * @@ -1081,7 +1158,7 @@ class NodeSigner { * message to be broadcast, as otherwise it may prevent one from receiving funds over the * corresponding channel. */ - inline LDK::CResult_SignatureNoneZ sign_gossip_message(struct LDKUnsignedGossipMessage msg); + inline LDK::CResult_ECDSASignatureNoneZ sign_gossip_message(struct LDKUnsignedGossipMessage msg); }; class SignerProvider { private: @@ -1139,7 +1216,7 @@ class SignerProvider { * This method should return a different value each time it is called, to avoid linking * on-chain funds across channels as controlled to the same user. */ - inline LDK::CResult_ScriptNoneZ get_destination_script(); + inline LDK::CResult_CVec_u8ZNoneZ get_destination_script(); /** * Get a script pubkey which we will send funds to when closing a channel. * @@ -1443,20 +1520,20 @@ class RouteHintHop { const LDKRouteHintHop* operator &() const { return &self; } const LDKRouteHintHop* operator ->() const { return &self; } }; -class Score { +class ScoreLookUp { private: - LDKScore self; + LDKScoreLookUp self; public: - Score(const Score&) = delete; - Score(Score&& o) : self(o.self) { memset(&o, 0, sizeof(Score)); } - Score(LDKScore&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKScore)); } - operator LDKScore() && { LDKScore res = self; memset(&self, 0, sizeof(LDKScore)); return res; } - ~Score() { Score_free(self); } - Score& operator=(Score&& o) { Score_free(self); self = o.self; memset(&o, 0, sizeof(Score)); return *this; } - LDKScore* operator &() { return &self; } - LDKScore* operator ->() { return &self; } - const LDKScore* operator &() const { return &self; } - const LDKScore* operator ->() const { return &self; } + ScoreLookUp(const ScoreLookUp&) = delete; + ScoreLookUp(ScoreLookUp&& o) : self(o.self) { memset(&o, 0, sizeof(ScoreLookUp)); } + ScoreLookUp(LDKScoreLookUp&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKScoreLookUp)); } + operator LDKScoreLookUp() && { LDKScoreLookUp res = self; memset(&self, 0, sizeof(LDKScoreLookUp)); return res; } + ~ScoreLookUp() { ScoreLookUp_free(self); } + ScoreLookUp& operator=(ScoreLookUp&& o) { ScoreLookUp_free(self); self = o.self; memset(&o, 0, sizeof(ScoreLookUp)); return *this; } + LDKScoreLookUp* operator &() { return &self; } + LDKScoreLookUp* operator ->() { return &self; } + const LDKScoreLookUp* operator &() const { return &self; } + const LDKScoreLookUp* operator ->() const { return &self; } /** * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the * given channel in the direction from `source` to `target`. @@ -1468,6 +1545,21 @@ class Score { * Thus, implementations should be overflow-safe. */ inline uint64_t channel_penalty_msat(uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, struct LDKChannelUsage usage, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params); +}; +class ScoreUpdate { +private: + LDKScoreUpdate self; +public: + ScoreUpdate(const ScoreUpdate&) = delete; + ScoreUpdate(ScoreUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(ScoreUpdate)); } + ScoreUpdate(LDKScoreUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKScoreUpdate)); } + operator LDKScoreUpdate() && { LDKScoreUpdate res = self; memset(&self, 0, sizeof(LDKScoreUpdate)); return res; } + ~ScoreUpdate() { ScoreUpdate_free(self); } + ScoreUpdate& operator=(ScoreUpdate&& o) { ScoreUpdate_free(self); self = o.self; memset(&o, 0, sizeof(ScoreUpdate)); return *this; } + LDKScoreUpdate* operator &() { return &self; } + LDKScoreUpdate* operator ->() { return &self; } + const LDKScoreUpdate* operator &() const { return &self; } + const LDKScoreUpdate* operator ->() const { return &self; } /** * Handles updating channel penalties after failing to route through a channel. */ @@ -1485,6 +1577,21 @@ class Score { */ inline void probe_successful(const struct LDKPath *NONNULL_PTR path); }; +class Score { +private: + LDKScore self; +public: + Score(const Score&) = delete; + Score(Score&& o) : self(o.self) { memset(&o, 0, sizeof(Score)); } + Score(LDKScore&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKScore)); } + operator LDKScore() && { LDKScore res = self; memset(&self, 0, sizeof(LDKScore)); return res; } + ~Score() { Score_free(self); } + Score& operator=(Score&& o) { Score_free(self); self = o.self; memset(&o, 0, sizeof(Score)); return *this; } + LDKScore* operator &() { return &self; } + LDKScore* operator ->() { return &self; } + const LDKScore* operator &() const { return &self; } + const LDKScore* operator ->() const { return &self; } +}; class LockableScore { private: LDKLockableScore self; @@ -1500,9 +1607,13 @@ class LockableScore { const LDKLockableScore* operator &() const { return &self; } const LDKLockableScore* operator ->() const { return &self; } /** - * Returns the locked scorer. + * Returns read locked scorer. + */ + inline LDK::ScoreLookUp read_lock(); + /** + * Returns write locked scorer. */ - inline LDK::Score lock(); + inline LDK::ScoreUpdate write_lock(); }; class WriteableScore { private: @@ -1534,20 +1645,35 @@ class MultiThreadedLockableScore { const LDKMultiThreadedLockableScore* operator &() const { return &self; } const LDKMultiThreadedLockableScore* operator ->() const { return &self; } }; -class MultiThreadedScoreLock { +class MultiThreadedScoreLockRead { +private: + LDKMultiThreadedScoreLockRead self; +public: + MultiThreadedScoreLockRead(const MultiThreadedScoreLockRead&) = delete; + MultiThreadedScoreLockRead(MultiThreadedScoreLockRead&& o) : self(o.self) { memset(&o, 0, sizeof(MultiThreadedScoreLockRead)); } + MultiThreadedScoreLockRead(LDKMultiThreadedScoreLockRead&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMultiThreadedScoreLockRead)); } + operator LDKMultiThreadedScoreLockRead() && { LDKMultiThreadedScoreLockRead res = self; memset(&self, 0, sizeof(LDKMultiThreadedScoreLockRead)); return res; } + ~MultiThreadedScoreLockRead() { MultiThreadedScoreLockRead_free(self); } + MultiThreadedScoreLockRead& operator=(MultiThreadedScoreLockRead&& o) { MultiThreadedScoreLockRead_free(self); self = o.self; memset(&o, 0, sizeof(MultiThreadedScoreLockRead)); return *this; } + LDKMultiThreadedScoreLockRead* operator &() { return &self; } + LDKMultiThreadedScoreLockRead* operator ->() { return &self; } + const LDKMultiThreadedScoreLockRead* operator &() const { return &self; } + const LDKMultiThreadedScoreLockRead* operator ->() const { return &self; } +}; +class MultiThreadedScoreLockWrite { private: - LDKMultiThreadedScoreLock self; + LDKMultiThreadedScoreLockWrite self; public: - MultiThreadedScoreLock(const MultiThreadedScoreLock&) = delete; - MultiThreadedScoreLock(MultiThreadedScoreLock&& o) : self(o.self) { memset(&o, 0, sizeof(MultiThreadedScoreLock)); } - MultiThreadedScoreLock(LDKMultiThreadedScoreLock&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMultiThreadedScoreLock)); } - operator LDKMultiThreadedScoreLock() && { LDKMultiThreadedScoreLock res = self; memset(&self, 0, sizeof(LDKMultiThreadedScoreLock)); return res; } - ~MultiThreadedScoreLock() { MultiThreadedScoreLock_free(self); } - MultiThreadedScoreLock& operator=(MultiThreadedScoreLock&& o) { MultiThreadedScoreLock_free(self); self = o.self; memset(&o, 0, sizeof(MultiThreadedScoreLock)); return *this; } - LDKMultiThreadedScoreLock* operator &() { return &self; } - LDKMultiThreadedScoreLock* operator ->() { return &self; } - const LDKMultiThreadedScoreLock* operator &() const { return &self; } - const LDKMultiThreadedScoreLock* operator ->() const { return &self; } + MultiThreadedScoreLockWrite(const MultiThreadedScoreLockWrite&) = delete; + MultiThreadedScoreLockWrite(MultiThreadedScoreLockWrite&& o) : self(o.self) { memset(&o, 0, sizeof(MultiThreadedScoreLockWrite)); } + MultiThreadedScoreLockWrite(LDKMultiThreadedScoreLockWrite&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMultiThreadedScoreLockWrite)); } + operator LDKMultiThreadedScoreLockWrite() && { LDKMultiThreadedScoreLockWrite res = self; memset(&self, 0, sizeof(LDKMultiThreadedScoreLockWrite)); return res; } + ~MultiThreadedScoreLockWrite() { MultiThreadedScoreLockWrite_free(self); } + MultiThreadedScoreLockWrite& operator=(MultiThreadedScoreLockWrite&& o) { MultiThreadedScoreLockWrite_free(self); self = o.self; memset(&o, 0, sizeof(MultiThreadedScoreLockWrite)); return *this; } + LDKMultiThreadedScoreLockWrite* operator &() { return &self; } + LDKMultiThreadedScoreLockWrite* operator ->() { return &self; } + const LDKMultiThreadedScoreLockWrite* operator &() const { return &self; } + const LDKMultiThreadedScoreLockWrite* operator ->() const { return &self; } }; class ChannelUsage { private: @@ -1739,7 +1865,7 @@ class Confirm { * [`transactions_confirmed`]: Self::transactions_confirmed * [`transaction_unconfirmed`]: Self::transaction_unconfirmed */ - inline LDK::CVec_C2Tuple_TxidCOption_BlockHashZZZ get_relevant_txids(); + inline LDK::CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ get_relevant_txids(); }; class ChannelMonitorUpdateStatus { private: @@ -1776,21 +1902,33 @@ class Watch { * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means * calling [`block_connected`] and [`block_disconnected`] on the monitor. * - * Note: this interface MUST error with [`ChannelMonitorUpdateStatus::PermanentFailure`] if - * the given `funding_txo` has previously been registered via `watch_channel`. + * A return of `Err(())` indicates that the channel should immediately be force-closed without + * broadcasting the funding transaction. + * + * If the given `funding_txo` has previously been registered via `watch_channel`, `Err(())` + * must be returned. * * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected */ - inline LDK::ChannelMonitorUpdateStatus watch_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); + inline LDK::CResult_ChannelMonitorUpdateStatusNoneZ watch_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); /** * Updates a channel identified by `funding_txo` by applying `update` to its monitor. * - * Implementations must call [`update_monitor`] with the given update. See - * [`ChannelMonitorUpdateStatus`] for invariants around returning an error. + * Implementations must call [`ChannelMonitor::update_monitor`] with the given update. This + * may fail (returning an `Err(())`), in which case this should return + * [`ChannelMonitorUpdateStatus::InProgress`] (and the update should never complete). This + * generally implies the channel has been closed (either by the funding outpoint being spent + * on-chain or the [`ChannelMonitor`] having decided to do so and broadcasted a transaction), + * and the [`ChannelManager`] state will be updated once it sees the funding spend on-chain. + * + * In general, persistence failures should be retried after returning + * [`ChannelMonitorUpdateStatus::InProgress`] and eventually complete. If a failure truly + * cannot be retried, the node should shut down immediately after returning + * [`ChannelMonitorUpdateStatus::UnrecoverableError`], see its documentation for more info. * - * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ inline LDK::ChannelMonitorUpdateStatus update_channel(struct LDKOutPoint funding_txo, const struct LDKChannelMonitorUpdate *NONNULL_PTR update); /** @@ -2401,7 +2539,7 @@ class WalletSource { * Returns a script to use for change above dust resulting from a successful coin selection * attempt. */ - inline LDK::CResult_ScriptNoneZ get_change_script(); + inline LDK::CResult_CVec_u8ZNoneZ get_change_script(); /** * Signs and provides the full [`TxIn::script_sig`] and [`TxIn::witness`] for all inputs within * the transaction known to the wallet (i.e., any provided via @@ -2447,7 +2585,8 @@ class FailureCode { FailureCode(FailureCode&& o) : self(o.self) { memset(&o, 0, sizeof(FailureCode)); } FailureCode(LDKFailureCode&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFailureCode)); } operator LDKFailureCode() && { LDKFailureCode res = self; memset(&self, 0, sizeof(LDKFailureCode)); return res; } - FailureCode& operator=(FailureCode&& o) { self = o.self; memset(&o, 0, sizeof(FailureCode)); return *this; } + ~FailureCode() { FailureCode_free(self); } + FailureCode& operator=(FailureCode&& o) { FailureCode_free(self); self = o.self; memset(&o, 0, sizeof(FailureCode)); return *this; } LDKFailureCode* operator &() { return &self; } LDKFailureCode* operator ->() { return &self; } const LDKFailureCode* operator &() const { return &self; } @@ -2692,6 +2831,21 @@ class APIError { const LDKAPIError* operator &() const { return &self; } const LDKAPIError* operator ->() const { return &self; } }; +class TaggedHash { +private: + LDKTaggedHash self; +public: + TaggedHash(const TaggedHash&) = delete; + TaggedHash(TaggedHash&& o) : self(o.self) { memset(&o, 0, sizeof(TaggedHash)); } + TaggedHash(LDKTaggedHash&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKTaggedHash)); } + operator LDKTaggedHash() && { LDKTaggedHash res = self; memset(&self, 0, sizeof(LDKTaggedHash)); return res; } + ~TaggedHash() { TaggedHash_free(self); } + TaggedHash& operator=(TaggedHash&& o) { TaggedHash_free(self); self = o.self; memset(&o, 0, sizeof(TaggedHash)); return *this; } + LDKTaggedHash* operator &() { return &self; } + LDKTaggedHash* operator ->() { return &self; } + const LDKTaggedHash* operator &() const { return &self; } + const LDKTaggedHash* operator ->() const { return &self; } +}; class ChannelMonitorUpdate { private: LDKChannelMonitorUpdate self; @@ -2964,6 +3118,64 @@ class RapidGossipSync { const LDKRapidGossipSync* operator &() const { return &self; } const LDKRapidGossipSync* operator ->() const { return &self; } }; +class KVStore { +private: + LDKKVStore self; +public: + KVStore(const KVStore&) = delete; + KVStore(KVStore&& o) : self(o.self) { memset(&o, 0, sizeof(KVStore)); } + KVStore(LDKKVStore&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKKVStore)); } + operator LDKKVStore() && { LDKKVStore res = self; memset(&self, 0, sizeof(LDKKVStore)); return res; } + ~KVStore() { KVStore_free(self); } + KVStore& operator=(KVStore&& o) { KVStore_free(self); self = o.self; memset(&o, 0, sizeof(KVStore)); return *this; } + LDKKVStore* operator &() { return &self; } + LDKKVStore* operator ->() { return &self; } + const LDKKVStore* operator &() const { return &self; } + const LDKKVStore* operator ->() const { return &self; } + /** + * Returns the data stored for the given `primary_namespace`, `secondary_namespace`, and + * `key`. + * + * Returns an [`ErrorKind::NotFound`] if the given `key` could not be found in the given + * `primary_namespace` and `secondary_namespace`. + * + * [`ErrorKind::NotFound`]: io::ErrorKind::NotFound + */ + inline LDK::CResult_CVec_u8ZIOErrorZ read(struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key); + /** + * Persists the given data under the given `key`. + * + * Will create the given `primary_namespace` and `secondary_namespace` if not already present + * in the store. + */ + inline LDK::CResult_NoneIOErrorZ write(struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key, struct LDKu8slice buf); + /** + * Removes any data that had previously been persisted under the given `key`. + * + * If the `lazy` flag is set to `true`, the backend implementation might choose to lazily + * remove the given `key` at some point in time after the method returns, e.g., as part of an + * eventual batch deletion of multiple keys. As a consequence, subsequent calls to + * [`KVStore::list`] might include the removed key until the changes are actually persisted. + * + * Note that while setting the `lazy` flag reduces the I/O burden of multiple subsequent + * `remove` calls, it also influences the atomicity guarantees as lazy `remove`s could + * potentially get lost on crash after the method returns. Therefore, this flag should only be + * set for `remove` operations that can be safely replayed at a later time. + * + * Returns successfully if no data will be stored for the given `primary_namespace`, + * `secondary_namespace`, and `key`, independently of whether it was present before its + * invokation or not. + */ + inline LDK::CResult_NoneIOErrorZ remove(struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key, bool lazy); + /** + * Returns a list of keys that are stored under the given `secondary_namespace` in + * `primary_namespace`. + * + * Returns the keys in arbitrary order, so users requiring a particular order need to sort the + * returned keys. Returns an empty list if `primary_namespace` or `secondary_namespace` is unknown. + */ + inline LDK::CResult_CVec_StrZIOErrorZ list(struct LDKStr primary_namespace, struct LDKStr secondary_namespace); +}; class Persister { private: LDKPersister self; @@ -2981,15 +3193,30 @@ class Persister { /** * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed. */ - inline LDK::CResult_NoneErrorZ persist_manager(const struct LDKChannelManager *NONNULL_PTR channel_manager); + inline LDK::CResult_NoneIOErrorZ persist_manager(const struct LDKChannelManager *NONNULL_PTR channel_manager); /** * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed. */ - inline LDK::CResult_NoneErrorZ persist_graph(const struct LDKNetworkGraph *NONNULL_PTR network_graph); + inline LDK::CResult_NoneIOErrorZ persist_graph(const struct LDKNetworkGraph *NONNULL_PTR network_graph); /** * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed. */ - inline LDK::CResult_NoneErrorZ persist_scorer(const struct LDKWriteableScore *NONNULL_PTR scorer); + inline LDK::CResult_NoneIOErrorZ persist_scorer(const struct LDKWriteableScore *NONNULL_PTR scorer); +}; +class MonitorUpdatingPersister { +private: + LDKMonitorUpdatingPersister self; +public: + MonitorUpdatingPersister(const MonitorUpdatingPersister&) = delete; + MonitorUpdatingPersister(MonitorUpdatingPersister&& o) : self(o.self) { memset(&o, 0, sizeof(MonitorUpdatingPersister)); } + MonitorUpdatingPersister(LDKMonitorUpdatingPersister&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMonitorUpdatingPersister)); } + operator LDKMonitorUpdatingPersister() && { LDKMonitorUpdatingPersister res = self; memset(&self, 0, sizeof(LDKMonitorUpdatingPersister)); return res; } + ~MonitorUpdatingPersister() { MonitorUpdatingPersister_free(self); } + MonitorUpdatingPersister& operator=(MonitorUpdatingPersister&& o) { MonitorUpdatingPersister_free(self); self = o.self; memset(&o, 0, sizeof(MonitorUpdatingPersister)); return *this; } + LDKMonitorUpdatingPersister* operator &() { return &self; } + LDKMonitorUpdatingPersister* operator ->() { return &self; } + const LDKMonitorUpdatingPersister* operator &() const { return &self; } + const LDKMonitorUpdatingPersister* operator ->() const { return &self; } }; class UnsignedInvoiceRequest { private: @@ -3021,6 +3248,21 @@ class InvoiceRequest { const LDKInvoiceRequest* operator &() const { return &self; } const LDKInvoiceRequest* operator ->() const { return &self; } }; +class VerifiedInvoiceRequest { +private: + LDKVerifiedInvoiceRequest self; +public: + VerifiedInvoiceRequest(const VerifiedInvoiceRequest&) = delete; + VerifiedInvoiceRequest(VerifiedInvoiceRequest&& o) : self(o.self) { memset(&o, 0, sizeof(VerifiedInvoiceRequest)); } + VerifiedInvoiceRequest(LDKVerifiedInvoiceRequest&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKVerifiedInvoiceRequest)); } + operator LDKVerifiedInvoiceRequest() && { LDKVerifiedInvoiceRequest res = self; memset(&self, 0, sizeof(LDKVerifiedInvoiceRequest)); return res; } + ~VerifiedInvoiceRequest() { VerifiedInvoiceRequest_free(self); } + VerifiedInvoiceRequest& operator=(VerifiedInvoiceRequest&& o) { VerifiedInvoiceRequest_free(self); self = o.self; memset(&o, 0, sizeof(VerifiedInvoiceRequest)); return *this; } + LDKVerifiedInvoiceRequest* operator &() { return &self; } + LDKVerifiedInvoiceRequest* operator ->() { return &self; } + const LDKVerifiedInvoiceRequest* operator &() const { return &self; } + const LDKVerifiedInvoiceRequest* operator ->() const { return &self; } +}; class DecodeError { private: LDKDecodeError self; @@ -3546,20 +3788,34 @@ class AnnouncementSignatures { const LDKAnnouncementSignatures* operator &() const { return &self; } const LDKAnnouncementSignatures* operator ->() const { return &self; } }; -class NetAddress { +class SocketAddress { private: - LDKNetAddress self; + LDKSocketAddress self; public: - NetAddress(const NetAddress&) = delete; - NetAddress(NetAddress&& o) : self(o.self) { memset(&o, 0, sizeof(NetAddress)); } - NetAddress(LDKNetAddress&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNetAddress)); } - operator LDKNetAddress() && { LDKNetAddress res = self; memset(&self, 0, sizeof(LDKNetAddress)); return res; } - ~NetAddress() { NetAddress_free(self); } - NetAddress& operator=(NetAddress&& o) { NetAddress_free(self); self = o.self; memset(&o, 0, sizeof(NetAddress)); return *this; } - LDKNetAddress* operator &() { return &self; } - LDKNetAddress* operator ->() { return &self; } - const LDKNetAddress* operator &() const { return &self; } - const LDKNetAddress* operator ->() const { return &self; } + SocketAddress(const SocketAddress&) = delete; + SocketAddress(SocketAddress&& o) : self(o.self) { memset(&o, 0, sizeof(SocketAddress)); } + SocketAddress(LDKSocketAddress&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSocketAddress)); } + operator LDKSocketAddress() && { LDKSocketAddress res = self; memset(&self, 0, sizeof(LDKSocketAddress)); return res; } + ~SocketAddress() { SocketAddress_free(self); } + SocketAddress& operator=(SocketAddress&& o) { SocketAddress_free(self); self = o.self; memset(&o, 0, sizeof(SocketAddress)); return *this; } + LDKSocketAddress* operator &() { return &self; } + LDKSocketAddress* operator ->() { return &self; } + const LDKSocketAddress* operator &() const { return &self; } + const LDKSocketAddress* operator ->() const { return &self; } +}; +class SocketAddressParseError { +private: + LDKSocketAddressParseError self; +public: + SocketAddressParseError(const SocketAddressParseError&) = delete; + SocketAddressParseError(SocketAddressParseError&& o) : self(o.self) { memset(&o, 0, sizeof(SocketAddressParseError)); } + SocketAddressParseError(LDKSocketAddressParseError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSocketAddressParseError)); } + operator LDKSocketAddressParseError() && { LDKSocketAddressParseError res = self; memset(&self, 0, sizeof(LDKSocketAddressParseError)); return res; } + SocketAddressParseError& operator=(SocketAddressParseError&& o) { self = o.self; memset(&o, 0, sizeof(SocketAddressParseError)); return *this; } + LDKSocketAddressParseError* operator &() { return &self; } + LDKSocketAddressParseError* operator ->() { return &self; } + const LDKSocketAddressParseError* operator &() const { return &self; } + const LDKSocketAddressParseError* operator ->() const { return &self; } }; class UnsignedGossipMessage { private: @@ -3948,7 +4204,7 @@ class ChannelMessageHandler { * If it's `None`, then no particular network chain hash compatibility will be enforced when * connecting to peers. */ - inline LDK::COption_CVec_ChainHashZZ get_genesis_hashes(); + inline LDK::COption_CVec_ThirtyTwoBytesZZ get_genesis_hashes(); }; class RoutingMessageHandler { private: @@ -4568,6 +4824,21 @@ class FeeEstimator { */ inline uint32_t get_est_sat_per_1000_weight(enum LDKConfirmationTarget confirmation_target); }; +class Packet { +private: + LDKPacket self; +public: + Packet(const Packet&) = delete; + Packet(Packet&& o) : self(o.self) { memset(&o, 0, sizeof(Packet)); } + Packet(LDKPacket&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPacket)); } + operator LDKPacket() && { LDKPacket res = self; memset(&self, 0, sizeof(LDKPacket)); return res; } + ~Packet() { Packet_free(self); } + Packet& operator=(Packet&& o) { Packet_free(self); self = o.self; memset(&o, 0, sizeof(Packet)); return *this; } + LDKPacket* operator &() { return &self; } + LDKPacket* operator ->() { return &self; } + const LDKPacket* operator &() const { return &self; } + const LDKPacket* operator ->() const { return &self; } +}; class OnionMessageContents { private: LDKOnionMessageContents self; @@ -4617,6 +4888,21 @@ class PaymentPurpose { const LDKPaymentPurpose* operator &() const { return &self; } const LDKPaymentPurpose* operator ->() const { return &self; } }; +class ClaimedHTLC { +private: + LDKClaimedHTLC self; +public: + ClaimedHTLC(const ClaimedHTLC&) = delete; + ClaimedHTLC(ClaimedHTLC&& o) : self(o.self) { memset(&o, 0, sizeof(ClaimedHTLC)); } + ClaimedHTLC(LDKClaimedHTLC&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKClaimedHTLC)); } + operator LDKClaimedHTLC() && { LDKClaimedHTLC res = self; memset(&self, 0, sizeof(LDKClaimedHTLC)); return res; } + ~ClaimedHTLC() { ClaimedHTLC_free(self); } + ClaimedHTLC& operator=(ClaimedHTLC&& o) { ClaimedHTLC_free(self); self = o.self; memset(&o, 0, sizeof(ClaimedHTLC)); return *this; } + LDKClaimedHTLC* operator &() { return &self; } + LDKClaimedHTLC* operator ->() { return &self; } + const LDKClaimedHTLC* operator &() const { return &self; } + const LDKClaimedHTLC* operator ->() const { return &self; } +}; class PathFailure { private: LDKPathFailure self; @@ -4789,21 +5075,6 @@ class EventHandler { */ inline void handle_event(struct LDKEvent event); }; -class FilesystemPersister { -private: - LDKFilesystemPersister self; -public: - FilesystemPersister(const FilesystemPersister&) = delete; - FilesystemPersister(FilesystemPersister&& o) : self(o.self) { memset(&o, 0, sizeof(FilesystemPersister)); } - FilesystemPersister(LDKFilesystemPersister&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFilesystemPersister)); } - operator LDKFilesystemPersister() && { LDKFilesystemPersister res = self; memset(&self, 0, sizeof(LDKFilesystemPersister)); return res; } - ~FilesystemPersister() { FilesystemPersister_free(self); } - FilesystemPersister& operator=(FilesystemPersister&& o) { FilesystemPersister_free(self); self = o.self; memset(&o, 0, sizeof(FilesystemPersister)); return *this; } - LDKFilesystemPersister* operator &() { return &self; } - LDKFilesystemPersister* operator ->() { return &self; } - const LDKFilesystemPersister* operator &() const { return &self; } - const LDKFilesystemPersister* operator ->() const { return &self; } -}; class Bolt11ParseError { private: LDKBolt11ParseError self; @@ -5235,6 +5506,81 @@ class Type { */ inline LDK::Str debug_str(); }; +class ForwardNode { +private: + LDKForwardNode self; +public: + ForwardNode(const ForwardNode&) = delete; + ForwardNode(ForwardNode&& o) : self(o.self) { memset(&o, 0, sizeof(ForwardNode)); } + ForwardNode(LDKForwardNode&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKForwardNode)); } + operator LDKForwardNode() && { LDKForwardNode res = self; memset(&self, 0, sizeof(LDKForwardNode)); return res; } + ~ForwardNode() { ForwardNode_free(self); } + ForwardNode& operator=(ForwardNode&& o) { ForwardNode_free(self); self = o.self; memset(&o, 0, sizeof(ForwardNode)); return *this; } + LDKForwardNode* operator &() { return &self; } + LDKForwardNode* operator ->() { return &self; } + const LDKForwardNode* operator &() const { return &self; } + const LDKForwardNode* operator ->() const { return &self; } +}; +class ForwardTlvs { +private: + LDKForwardTlvs self; +public: + ForwardTlvs(const ForwardTlvs&) = delete; + ForwardTlvs(ForwardTlvs&& o) : self(o.self) { memset(&o, 0, sizeof(ForwardTlvs)); } + ForwardTlvs(LDKForwardTlvs&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKForwardTlvs)); } + operator LDKForwardTlvs() && { LDKForwardTlvs res = self; memset(&self, 0, sizeof(LDKForwardTlvs)); return res; } + ~ForwardTlvs() { ForwardTlvs_free(self); } + ForwardTlvs& operator=(ForwardTlvs&& o) { ForwardTlvs_free(self); self = o.self; memset(&o, 0, sizeof(ForwardTlvs)); return *this; } + LDKForwardTlvs* operator &() { return &self; } + LDKForwardTlvs* operator ->() { return &self; } + const LDKForwardTlvs* operator &() const { return &self; } + const LDKForwardTlvs* operator ->() const { return &self; } +}; +class ReceiveTlvs { +private: + LDKReceiveTlvs self; +public: + ReceiveTlvs(const ReceiveTlvs&) = delete; + ReceiveTlvs(ReceiveTlvs&& o) : self(o.self) { memset(&o, 0, sizeof(ReceiveTlvs)); } + ReceiveTlvs(LDKReceiveTlvs&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKReceiveTlvs)); } + operator LDKReceiveTlvs() && { LDKReceiveTlvs res = self; memset(&self, 0, sizeof(LDKReceiveTlvs)); return res; } + ~ReceiveTlvs() { ReceiveTlvs_free(self); } + ReceiveTlvs& operator=(ReceiveTlvs&& o) { ReceiveTlvs_free(self); self = o.self; memset(&o, 0, sizeof(ReceiveTlvs)); return *this; } + LDKReceiveTlvs* operator &() { return &self; } + LDKReceiveTlvs* operator ->() { return &self; } + const LDKReceiveTlvs* operator &() const { return &self; } + const LDKReceiveTlvs* operator ->() const { return &self; } +}; +class PaymentRelay { +private: + LDKPaymentRelay self; +public: + PaymentRelay(const PaymentRelay&) = delete; + PaymentRelay(PaymentRelay&& o) : self(o.self) { memset(&o, 0, sizeof(PaymentRelay)); } + PaymentRelay(LDKPaymentRelay&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPaymentRelay)); } + operator LDKPaymentRelay() && { LDKPaymentRelay res = self; memset(&self, 0, sizeof(LDKPaymentRelay)); return res; } + ~PaymentRelay() { PaymentRelay_free(self); } + PaymentRelay& operator=(PaymentRelay&& o) { PaymentRelay_free(self); self = o.self; memset(&o, 0, sizeof(PaymentRelay)); return *this; } + LDKPaymentRelay* operator &() { return &self; } + LDKPaymentRelay* operator ->() { return &self; } + const LDKPaymentRelay* operator &() const { return &self; } + const LDKPaymentRelay* operator ->() const { return &self; } +}; +class PaymentConstraints { +private: + LDKPaymentConstraints self; +public: + PaymentConstraints(const PaymentConstraints&) = delete; + PaymentConstraints(PaymentConstraints&& o) : self(o.self) { memset(&o, 0, sizeof(PaymentConstraints)); } + PaymentConstraints(LDKPaymentConstraints&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPaymentConstraints)); } + operator LDKPaymentConstraints() && { LDKPaymentConstraints res = self; memset(&self, 0, sizeof(LDKPaymentConstraints)); return res; } + ~PaymentConstraints() { PaymentConstraints_free(self); } + PaymentConstraints& operator=(PaymentConstraints&& o) { PaymentConstraints_free(self); self = o.self; memset(&o, 0, sizeof(PaymentConstraints)); return *this; } + LDKPaymentConstraints* operator &() { return &self; } + LDKPaymentConstraints* operator ->() { return &self; } + const LDKPaymentConstraints* operator &() const { return &self; } + const LDKPaymentConstraints* operator ->() const { return &self; } +}; class PaymentError { private: LDKPaymentError self; @@ -5250,6 +5596,21 @@ class PaymentError { const LDKPaymentError* operator &() const { return &self; } const LDKPaymentError* operator ->() const { return &self; } }; +class ProbingError { +private: + LDKProbingError self; +public: + ProbingError(const ProbingError&) = delete; + ProbingError(ProbingError&& o) : self(o.self) { memset(&o, 0, sizeof(ProbingError)); } + ProbingError(LDKProbingError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKProbingError)); } + operator LDKProbingError() && { LDKProbingError res = self; memset(&self, 0, sizeof(LDKProbingError)); return res; } + ~ProbingError() { ProbingError_free(self); } + ProbingError& operator=(ProbingError&& o) { ProbingError_free(self); self = o.self; memset(&o, 0, sizeof(ProbingError)); return *this; } + LDKProbingError* operator &() { return &self; } + LDKProbingError* operator ->() { return &self; } + const LDKProbingError* operator &() const { return &self; } + const LDKProbingError* operator ->() const { return &self; } +}; class UtxoLookupError { private: LDKUtxoLookupError self; @@ -5437,6 +5798,21 @@ class CustomOnionMessageHandler { */ inline LDK::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message(uint64_t message_type, struct LDKu8slice buffer); }; +class FilesystemStore { +private: + LDKFilesystemStore self; +public: + FilesystemStore(const FilesystemStore&) = delete; + FilesystemStore(FilesystemStore&& o) : self(o.self) { memset(&o, 0, sizeof(FilesystemStore)); } + FilesystemStore(LDKFilesystemStore&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFilesystemStore)); } + operator LDKFilesystemStore() && { LDKFilesystemStore res = self; memset(&self, 0, sizeof(LDKFilesystemStore)); return res; } + ~FilesystemStore() { FilesystemStore_free(self); } + FilesystemStore& operator=(FilesystemStore&& o) { FilesystemStore_free(self); self = o.self; memset(&o, 0, sizeof(FilesystemStore)); return *this; } + LDKFilesystemStore* operator &() { return &self; } + LDKFilesystemStore* operator ->() { return &self; } + const LDKFilesystemStore* operator &() const { return &self; } + const LDKFilesystemStore* operator ->() const { return &self; } +}; class BlindedPath { private: LDKBlindedPath self; @@ -5567,8 +5943,8 @@ class Persist { * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more * details. * - * During blockchain synchronization operations, this may be called with no - * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted. + * During blockchain synchronization operations, and in some rare cases, this may be called with + * no [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted. * Note that after the full [`ChannelMonitor`] is persisted any previous * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be * applied to the persisted [`ChannelMonitor`] as they were already applied. @@ -5703,21 +6079,6 @@ class CResult_FundingCreatedDecodeErrorZ { const LDKCResult_FundingCreatedDecodeErrorZ* operator &() const { return &self; } const LDKCResult_FundingCreatedDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { -private: - LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ self; -public: - CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(const CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&) = delete; - CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); } - CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); } - operator LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() && { LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return res; } - ~CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); } - CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ& operator=(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return *this; } - LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() { return &self; } - LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() const { return &self; } -}; class CVec_C2Tuple_u32TxOutZZ { private: LDKCVec_C2Tuple_u32TxOutZZ self; @@ -5733,35 +6094,35 @@ class CVec_C2Tuple_u32TxOutZZ { const LDKCVec_C2Tuple_u32TxOutZZ* operator &() const { return &self; } const LDKCVec_C2Tuple_u32TxOutZZ* operator ->() const { return &self; } }; -class CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { +class CResult_RetryDecodeErrorZ { private: - LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ self; + LDKCResult_RetryDecodeErrorZ self; public: - CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(const CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ&) = delete; - CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ)); } - CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ)); } - operator LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ() && { LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ)); return res; } - ~CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ() { CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(self); } - CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ& operator=(CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ&& o) { CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ)); return *this; } - LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator &() { return &self; } - LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator ->() { return &self; } - const LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator &() const { return &self; } - const LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator ->() const { return &self; } + CResult_RetryDecodeErrorZ(const CResult_RetryDecodeErrorZ&) = delete; + CResult_RetryDecodeErrorZ(CResult_RetryDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RetryDecodeErrorZ)); } + CResult_RetryDecodeErrorZ(LDKCResult_RetryDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RetryDecodeErrorZ)); } + operator LDKCResult_RetryDecodeErrorZ() && { LDKCResult_RetryDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RetryDecodeErrorZ)); return res; } + ~CResult_RetryDecodeErrorZ() { CResult_RetryDecodeErrorZ_free(self); } + CResult_RetryDecodeErrorZ& operator=(CResult_RetryDecodeErrorZ&& o) { CResult_RetryDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RetryDecodeErrorZ)); return *this; } + LDKCResult_RetryDecodeErrorZ* operator &() { return &self; } + LDKCResult_RetryDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RetryDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RetryDecodeErrorZ* operator ->() const { return &self; } }; -class COption_PaymentSecretZ { +class CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ { private: - LDKCOption_PaymentSecretZ self; + LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ self; public: - COption_PaymentSecretZ(const COption_PaymentSecretZ&) = delete; - COption_PaymentSecretZ(COption_PaymentSecretZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_PaymentSecretZ)); } - COption_PaymentSecretZ(LDKCOption_PaymentSecretZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_PaymentSecretZ)); } - operator LDKCOption_PaymentSecretZ() && { LDKCOption_PaymentSecretZ res = self; memset(&self, 0, sizeof(LDKCOption_PaymentSecretZ)); return res; } - ~COption_PaymentSecretZ() { COption_PaymentSecretZ_free(self); } - COption_PaymentSecretZ& operator=(COption_PaymentSecretZ&& o) { COption_PaymentSecretZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_PaymentSecretZ)); return *this; } - LDKCOption_PaymentSecretZ* operator &() { return &self; } - LDKCOption_PaymentSecretZ* operator ->() { return &self; } - const LDKCOption_PaymentSecretZ* operator &() const { return &self; } - const LDKCOption_PaymentSecretZ* operator ->() const { return &self; } + CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ(const CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ&) = delete; + CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ(CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ)); } + CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ)); } + operator LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ() && { LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ)); return res; } + ~CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ() { CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(self); } + CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ& operator=(CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ&& o) { CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ)); return *this; } + LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* operator &() { return &self; } + LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* operator ->() const { return &self; } }; class CResult_ChannelInfoDecodeErrorZ { private: @@ -5808,6 +6169,21 @@ class CResult_NoneSendErrorZ { const LDKCResult_NoneSendErrorZ* operator &() const { return &self; } const LDKCResult_NoneSendErrorZ* operator ->() const { return &self; } }; +class C2Tuple_CVec_u8ZusizeZ { +private: + LDKC2Tuple_CVec_u8ZusizeZ self; +public: + C2Tuple_CVec_u8ZusizeZ(const C2Tuple_CVec_u8ZusizeZ&) = delete; + C2Tuple_CVec_u8ZusizeZ(C2Tuple_CVec_u8ZusizeZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_CVec_u8ZusizeZ)); } + C2Tuple_CVec_u8ZusizeZ(LDKC2Tuple_CVec_u8ZusizeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_CVec_u8ZusizeZ)); } + operator LDKC2Tuple_CVec_u8ZusizeZ() && { LDKC2Tuple_CVec_u8ZusizeZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_CVec_u8ZusizeZ)); return res; } + ~C2Tuple_CVec_u8ZusizeZ() { C2Tuple_CVec_u8ZusizeZ_free(self); } + C2Tuple_CVec_u8ZusizeZ& operator=(C2Tuple_CVec_u8ZusizeZ&& o) { C2Tuple_CVec_u8ZusizeZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_CVec_u8ZusizeZ)); return *this; } + LDKC2Tuple_CVec_u8ZusizeZ* operator &() { return &self; } + LDKC2Tuple_CVec_u8ZusizeZ* operator ->() { return &self; } + const LDKC2Tuple_CVec_u8ZusizeZ* operator &() const { return &self; } + const LDKC2Tuple_CVec_u8ZusizeZ* operator ->() const { return &self; } +}; class COption_OffersMessageZ { private: LDKCOption_OffersMessageZ self; @@ -5823,21 +6199,6 @@ class COption_OffersMessageZ { const LDKCOption_OffersMessageZ* operator &() const { return &self; } const LDKCOption_OffersMessageZ* operator ->() const { return &self; } }; -class CResult_CVec_u8ZPeerHandleErrorZ { -private: - LDKCResult_CVec_u8ZPeerHandleErrorZ self; -public: - CResult_CVec_u8ZPeerHandleErrorZ(const CResult_CVec_u8ZPeerHandleErrorZ&) = delete; - CResult_CVec_u8ZPeerHandleErrorZ(CResult_CVec_u8ZPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_u8ZPeerHandleErrorZ)); } - CResult_CVec_u8ZPeerHandleErrorZ(LDKCResult_CVec_u8ZPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); } - operator LDKCResult_CVec_u8ZPeerHandleErrorZ() && { LDKCResult_CVec_u8ZPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); return res; } - ~CResult_CVec_u8ZPeerHandleErrorZ() { CResult_CVec_u8ZPeerHandleErrorZ_free(self); } - CResult_CVec_u8ZPeerHandleErrorZ& operator=(CResult_CVec_u8ZPeerHandleErrorZ&& o) { CResult_CVec_u8ZPeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_u8ZPeerHandleErrorZ)); return *this; } - LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() { return &self; } - LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() { return &self; } - const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() const { return &self; } - const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() const { return &self; } -}; class COption_NetworkUpdateZ { private: LDKCOption_NetworkUpdateZ self; @@ -5868,6 +6229,21 @@ class COption_u64Z { const LDKCOption_u64Z* operator &() const { return &self; } const LDKCOption_u64Z* operator ->() const { return &self; } }; +class CResult_CVec_u8ZPeerHandleErrorZ { +private: + LDKCResult_CVec_u8ZPeerHandleErrorZ self; +public: + CResult_CVec_u8ZPeerHandleErrorZ(const CResult_CVec_u8ZPeerHandleErrorZ&) = delete; + CResult_CVec_u8ZPeerHandleErrorZ(CResult_CVec_u8ZPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_u8ZPeerHandleErrorZ)); } + CResult_CVec_u8ZPeerHandleErrorZ(LDKCResult_CVec_u8ZPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); } + operator LDKCResult_CVec_u8ZPeerHandleErrorZ() && { LDKCResult_CVec_u8ZPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); return res; } + ~CResult_CVec_u8ZPeerHandleErrorZ() { CResult_CVec_u8ZPeerHandleErrorZ_free(self); } + CResult_CVec_u8ZPeerHandleErrorZ& operator=(CResult_CVec_u8ZPeerHandleErrorZ&& o) { CResult_CVec_u8ZPeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_u8ZPeerHandleErrorZ)); return *this; } + LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() { return &self; } + LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() { return &self; } + const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() const { return &self; } + const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() const { return &self; } +}; class CResult_GossipTimestampFilterDecodeErrorZ { private: LDKCResult_GossipTimestampFilterDecodeErrorZ self; @@ -5883,21 +6259,6 @@ class CResult_GossipTimestampFilterDecodeErrorZ { const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() const { return &self; } const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_PaymentPreimageAPIErrorZ { -private: - LDKCResult_PaymentPreimageAPIErrorZ self; -public: - CResult_PaymentPreimageAPIErrorZ(const CResult_PaymentPreimageAPIErrorZ&) = delete; - CResult_PaymentPreimageAPIErrorZ(CResult_PaymentPreimageAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentPreimageAPIErrorZ)); } - CResult_PaymentPreimageAPIErrorZ(LDKCResult_PaymentPreimageAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentPreimageAPIErrorZ)); } - operator LDKCResult_PaymentPreimageAPIErrorZ() && { LDKCResult_PaymentPreimageAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentPreimageAPIErrorZ)); return res; } - ~CResult_PaymentPreimageAPIErrorZ() { CResult_PaymentPreimageAPIErrorZ_free(self); } - CResult_PaymentPreimageAPIErrorZ& operator=(CResult_PaymentPreimageAPIErrorZ&& o) { CResult_PaymentPreimageAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentPreimageAPIErrorZ)); return *this; } - LDKCResult_PaymentPreimageAPIErrorZ* operator &() { return &self; } - LDKCResult_PaymentPreimageAPIErrorZ* operator ->() { return &self; } - const LDKCResult_PaymentPreimageAPIErrorZ* operator &() const { return &self; } - const LDKCResult_PaymentPreimageAPIErrorZ* operator ->() const { return &self; } -}; class CResult_RouteHintDecodeErrorZ { private: LDKCResult_RouteHintDecodeErrorZ self; @@ -5928,6 +6289,21 @@ class COption_FilterZ { const LDKCOption_FilterZ* operator &() const { return &self; } const LDKCOption_FilterZ* operator ->() const { return &self; } }; +class C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { +private: + LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ self; +public: + C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ(const C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ&) = delete; + C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ(C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ)); } + C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ)); } + operator LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ() && { LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ)); return res; } + ~C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ() { C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(self); } + C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ& operator=(C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ&& o) { C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ)); return *this; } + LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* operator &() { return &self; } + LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* operator ->() { return &self; } + const LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* operator &() const { return &self; } + const LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* operator ->() const { return &self; } +}; class COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { private: LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ self; @@ -6018,20 +6394,50 @@ class COption_u32Z { const LDKCOption_u32Z* operator &() const { return &self; } const LDKCOption_u32Z* operator ->() const { return &self; } }; -class CResult_CommitmentSignedDecodeErrorZ { -private: - LDKCResult_CommitmentSignedDecodeErrorZ self; -public: - CResult_CommitmentSignedDecodeErrorZ(const CResult_CommitmentSignedDecodeErrorZ&) = delete; - CResult_CommitmentSignedDecodeErrorZ(CResult_CommitmentSignedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CommitmentSignedDecodeErrorZ)); } - CResult_CommitmentSignedDecodeErrorZ(LDKCResult_CommitmentSignedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CommitmentSignedDecodeErrorZ)); } - operator LDKCResult_CommitmentSignedDecodeErrorZ() && { LDKCResult_CommitmentSignedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CommitmentSignedDecodeErrorZ)); return res; } - ~CResult_CommitmentSignedDecodeErrorZ() { CResult_CommitmentSignedDecodeErrorZ_free(self); } - CResult_CommitmentSignedDecodeErrorZ& operator=(CResult_CommitmentSignedDecodeErrorZ&& o) { CResult_CommitmentSignedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CommitmentSignedDecodeErrorZ)); return *this; } - LDKCResult_CommitmentSignedDecodeErrorZ* operator &() { return &self; } - LDKCResult_CommitmentSignedDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_CommitmentSignedDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_CommitmentSignedDecodeErrorZ* operator ->() const { return &self; } +class CResult_RecipientOnionFieldsNoneZ { +private: + LDKCResult_RecipientOnionFieldsNoneZ self; +public: + CResult_RecipientOnionFieldsNoneZ(const CResult_RecipientOnionFieldsNoneZ&) = delete; + CResult_RecipientOnionFieldsNoneZ(CResult_RecipientOnionFieldsNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RecipientOnionFieldsNoneZ)); } + CResult_RecipientOnionFieldsNoneZ(LDKCResult_RecipientOnionFieldsNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RecipientOnionFieldsNoneZ)); } + operator LDKCResult_RecipientOnionFieldsNoneZ() && { LDKCResult_RecipientOnionFieldsNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_RecipientOnionFieldsNoneZ)); return res; } + ~CResult_RecipientOnionFieldsNoneZ() { CResult_RecipientOnionFieldsNoneZ_free(self); } + CResult_RecipientOnionFieldsNoneZ& operator=(CResult_RecipientOnionFieldsNoneZ&& o) { CResult_RecipientOnionFieldsNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RecipientOnionFieldsNoneZ)); return *this; } + LDKCResult_RecipientOnionFieldsNoneZ* operator &() { return &self; } + LDKCResult_RecipientOnionFieldsNoneZ* operator ->() { return &self; } + const LDKCResult_RecipientOnionFieldsNoneZ* operator &() const { return &self; } + const LDKCResult_RecipientOnionFieldsNoneZ* operator ->() const { return &self; } +}; +class C2Tuple__u1632_u1632Z { +private: + LDKC2Tuple__u1632_u1632Z self; +public: + C2Tuple__u1632_u1632Z(const C2Tuple__u1632_u1632Z&) = delete; + C2Tuple__u1632_u1632Z(C2Tuple__u1632_u1632Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple__u1632_u1632Z)); } + C2Tuple__u1632_u1632Z(LDKC2Tuple__u1632_u1632Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple__u1632_u1632Z)); } + operator LDKC2Tuple__u1632_u1632Z() && { LDKC2Tuple__u1632_u1632Z res = self; memset(&self, 0, sizeof(LDKC2Tuple__u1632_u1632Z)); return res; } + ~C2Tuple__u1632_u1632Z() { C2Tuple__u1632_u1632Z_free(self); } + C2Tuple__u1632_u1632Z& operator=(C2Tuple__u1632_u1632Z&& o) { C2Tuple__u1632_u1632Z_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple__u1632_u1632Z)); return *this; } + LDKC2Tuple__u1632_u1632Z* operator &() { return &self; } + LDKC2Tuple__u1632_u1632Z* operator ->() { return &self; } + const LDKC2Tuple__u1632_u1632Z* operator &() const { return &self; } + const LDKC2Tuple__u1632_u1632Z* operator ->() const { return &self; } +}; +class CResult_CVec_StrZIOErrorZ { +private: + LDKCResult_CVec_StrZIOErrorZ self; +public: + CResult_CVec_StrZIOErrorZ(const CResult_CVec_StrZIOErrorZ&) = delete; + CResult_CVec_StrZIOErrorZ(CResult_CVec_StrZIOErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_StrZIOErrorZ)); } + CResult_CVec_StrZIOErrorZ(LDKCResult_CVec_StrZIOErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_StrZIOErrorZ)); } + operator LDKCResult_CVec_StrZIOErrorZ() && { LDKCResult_CVec_StrZIOErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_StrZIOErrorZ)); return res; } + ~CResult_CVec_StrZIOErrorZ() { CResult_CVec_StrZIOErrorZ_free(self); } + CResult_CVec_StrZIOErrorZ& operator=(CResult_CVec_StrZIOErrorZ&& o) { CResult_CVec_StrZIOErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_StrZIOErrorZ)); return *this; } + LDKCResult_CVec_StrZIOErrorZ* operator &() { return &self; } + LDKCResult_CVec_StrZIOErrorZ* operator ->() { return &self; } + const LDKCResult_CVec_StrZIOErrorZ* operator &() const { return &self; } + const LDKCResult_CVec_StrZIOErrorZ* operator ->() const { return &self; } }; class CResult_ClosingSignedFeeRangeDecodeErrorZ { private: @@ -6063,6 +6469,21 @@ class CResult_TransactionNoneZ { const LDKCResult_TransactionNoneZ* operator &() const { return &self; } const LDKCResult_TransactionNoneZ* operator ->() const { return &self; } }; +class CResult_CommitmentSignedDecodeErrorZ { +private: + LDKCResult_CommitmentSignedDecodeErrorZ self; +public: + CResult_CommitmentSignedDecodeErrorZ(const CResult_CommitmentSignedDecodeErrorZ&) = delete; + CResult_CommitmentSignedDecodeErrorZ(CResult_CommitmentSignedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CommitmentSignedDecodeErrorZ)); } + CResult_CommitmentSignedDecodeErrorZ(LDKCResult_CommitmentSignedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CommitmentSignedDecodeErrorZ)); } + operator LDKCResult_CommitmentSignedDecodeErrorZ() && { LDKCResult_CommitmentSignedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CommitmentSignedDecodeErrorZ)); return res; } + ~CResult_CommitmentSignedDecodeErrorZ() { CResult_CommitmentSignedDecodeErrorZ_free(self); } + CResult_CommitmentSignedDecodeErrorZ& operator=(CResult_CommitmentSignedDecodeErrorZ&& o) { CResult_CommitmentSignedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CommitmentSignedDecodeErrorZ)); return *this; } + LDKCResult_CommitmentSignedDecodeErrorZ* operator &() { return &self; } + LDKCResult_CommitmentSignedDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_CommitmentSignedDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_CommitmentSignedDecodeErrorZ* operator ->() const { return &self; } +}; class CResult_CommitmentTransactionDecodeErrorZ { private: LDKCResult_CommitmentTransactionDecodeErrorZ self; @@ -6078,50 +6499,20 @@ class CResult_CommitmentTransactionDecodeErrorZ { const LDKCResult_CommitmentTransactionDecodeErrorZ* operator &() const { return &self; } const LDKCResult_CommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } }; -class COption_DurationZ { -private: - LDKCOption_DurationZ self; -public: - COption_DurationZ(const COption_DurationZ&) = delete; - COption_DurationZ(COption_DurationZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_DurationZ)); } - COption_DurationZ(LDKCOption_DurationZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_DurationZ)); } - operator LDKCOption_DurationZ() && { LDKCOption_DurationZ res = self; memset(&self, 0, sizeof(LDKCOption_DurationZ)); return res; } - ~COption_DurationZ() { COption_DurationZ_free(self); } - COption_DurationZ& operator=(COption_DurationZ&& o) { COption_DurationZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_DurationZ)); return *this; } - LDKCOption_DurationZ* operator &() { return &self; } - LDKCOption_DurationZ* operator ->() { return &self; } - const LDKCOption_DurationZ* operator &() const { return &self; } - const LDKCOption_DurationZ* operator ->() const { return &self; } -}; -class C2Tuple_TxidCOption_BlockHashZZ { -private: - LDKC2Tuple_TxidCOption_BlockHashZZ self; -public: - C2Tuple_TxidCOption_BlockHashZZ(const C2Tuple_TxidCOption_BlockHashZZ&) = delete; - C2Tuple_TxidCOption_BlockHashZZ(C2Tuple_TxidCOption_BlockHashZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_TxidCOption_BlockHashZZ)); } - C2Tuple_TxidCOption_BlockHashZZ(LDKC2Tuple_TxidCOption_BlockHashZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ)); } - operator LDKC2Tuple_TxidCOption_BlockHashZZ() && { LDKC2Tuple_TxidCOption_BlockHashZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ)); return res; } - ~C2Tuple_TxidCOption_BlockHashZZ() { C2Tuple_TxidCOption_BlockHashZZ_free(self); } - C2Tuple_TxidCOption_BlockHashZZ& operator=(C2Tuple_TxidCOption_BlockHashZZ&& o) { C2Tuple_TxidCOption_BlockHashZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_TxidCOption_BlockHashZZ)); return *this; } - LDKC2Tuple_TxidCOption_BlockHashZZ* operator &() { return &self; } - LDKC2Tuple_TxidCOption_BlockHashZZ* operator ->() { return &self; } - const LDKC2Tuple_TxidCOption_BlockHashZZ* operator &() const { return &self; } - const LDKC2Tuple_TxidCOption_BlockHashZZ* operator ->() const { return &self; } -}; -class COption_PaymentHashZ { -private: - LDKCOption_PaymentHashZ self; -public: - COption_PaymentHashZ(const COption_PaymentHashZ&) = delete; - COption_PaymentHashZ(COption_PaymentHashZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_PaymentHashZ)); } - COption_PaymentHashZ(LDKCOption_PaymentHashZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_PaymentHashZ)); } - operator LDKCOption_PaymentHashZ() && { LDKCOption_PaymentHashZ res = self; memset(&self, 0, sizeof(LDKCOption_PaymentHashZ)); return res; } - ~COption_PaymentHashZ() { COption_PaymentHashZ_free(self); } - COption_PaymentHashZ& operator=(COption_PaymentHashZ&& o) { COption_PaymentHashZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_PaymentHashZ)); return *this; } - LDKCOption_PaymentHashZ* operator &() { return &self; } - LDKCOption_PaymentHashZ* operator ->() { return &self; } - const LDKCOption_PaymentHashZ* operator &() const { return &self; } - const LDKCOption_PaymentHashZ* operator ->() const { return &self; } +class CResult_ErrorMessageDecodeErrorZ { +private: + LDKCResult_ErrorMessageDecodeErrorZ self; +public: + CResult_ErrorMessageDecodeErrorZ(const CResult_ErrorMessageDecodeErrorZ&) = delete; + CResult_ErrorMessageDecodeErrorZ(CResult_ErrorMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ErrorMessageDecodeErrorZ)); } + CResult_ErrorMessageDecodeErrorZ(LDKCResult_ErrorMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ErrorMessageDecodeErrorZ)); } + operator LDKCResult_ErrorMessageDecodeErrorZ() && { LDKCResult_ErrorMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ErrorMessageDecodeErrorZ)); return res; } + ~CResult_ErrorMessageDecodeErrorZ() { CResult_ErrorMessageDecodeErrorZ_free(self); } + CResult_ErrorMessageDecodeErrorZ& operator=(CResult_ErrorMessageDecodeErrorZ&& o) { CResult_ErrorMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ErrorMessageDecodeErrorZ)); return *this; } + LDKCResult_ErrorMessageDecodeErrorZ* operator &() { return &self; } + LDKCResult_ErrorMessageDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ErrorMessageDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ErrorMessageDecodeErrorZ* operator ->() const { return &self; } }; class CResult_OpenChannelDecodeErrorZ { private: @@ -6138,21 +6529,6 @@ class CResult_OpenChannelDecodeErrorZ { const LDKCResult_OpenChannelDecodeErrorZ* operator &() const { return &self; } const LDKCResult_OpenChannelDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_ErrorMessageDecodeErrorZ { -private: - LDKCResult_ErrorMessageDecodeErrorZ self; -public: - CResult_ErrorMessageDecodeErrorZ(const CResult_ErrorMessageDecodeErrorZ&) = delete; - CResult_ErrorMessageDecodeErrorZ(CResult_ErrorMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ErrorMessageDecodeErrorZ)); } - CResult_ErrorMessageDecodeErrorZ(LDKCResult_ErrorMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ErrorMessageDecodeErrorZ)); } - operator LDKCResult_ErrorMessageDecodeErrorZ() && { LDKCResult_ErrorMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ErrorMessageDecodeErrorZ)); return res; } - ~CResult_ErrorMessageDecodeErrorZ() { CResult_ErrorMessageDecodeErrorZ_free(self); } - CResult_ErrorMessageDecodeErrorZ& operator=(CResult_ErrorMessageDecodeErrorZ&& o) { CResult_ErrorMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ErrorMessageDecodeErrorZ)); return *this; } - LDKCResult_ErrorMessageDecodeErrorZ* operator &() { return &self; } - LDKCResult_ErrorMessageDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ErrorMessageDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ErrorMessageDecodeErrorZ* operator ->() const { return &self; } -}; class COption_APIErrorZ { private: LDKCOption_APIErrorZ self; @@ -6213,21 +6589,6 @@ class CVec_InputZ { const LDKCVec_InputZ* operator &() const { return &self; } const LDKCVec_InputZ* operator ->() const { return &self; } }; -class CResult_PartiallySignedTransactionNoneZ { -private: - LDKCResult_PartiallySignedTransactionNoneZ self; -public: - CResult_PartiallySignedTransactionNoneZ(const CResult_PartiallySignedTransactionNoneZ&) = delete; - CResult_PartiallySignedTransactionNoneZ(CResult_PartiallySignedTransactionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PartiallySignedTransactionNoneZ)); } - CResult_PartiallySignedTransactionNoneZ(LDKCResult_PartiallySignedTransactionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PartiallySignedTransactionNoneZ)); } - operator LDKCResult_PartiallySignedTransactionNoneZ() && { LDKCResult_PartiallySignedTransactionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_PartiallySignedTransactionNoneZ)); return res; } - ~CResult_PartiallySignedTransactionNoneZ() { CResult_PartiallySignedTransactionNoneZ_free(self); } - CResult_PartiallySignedTransactionNoneZ& operator=(CResult_PartiallySignedTransactionNoneZ&& o) { CResult_PartiallySignedTransactionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PartiallySignedTransactionNoneZ)); return *this; } - LDKCResult_PartiallySignedTransactionNoneZ* operator &() { return &self; } - LDKCResult_PartiallySignedTransactionNoneZ* operator ->() { return &self; } - const LDKCResult_PartiallySignedTransactionNoneZ* operator &() const { return &self; } - const LDKCResult_PartiallySignedTransactionNoneZ* operator ->() const { return &self; } -}; class CResult_ChannelFeaturesDecodeErrorZ { private: LDKCResult_ChannelFeaturesDecodeErrorZ self; @@ -6303,20 +6664,20 @@ class CResult_NoneRetryableSendFailureZ { const LDKCResult_NoneRetryableSendFailureZ* operator &() const { return &self; } const LDKCResult_NoneRetryableSendFailureZ* operator ->() const { return &self; } }; -class COption_BlockHashZ { +class CResult_boolLightningErrorZ { private: - LDKCOption_BlockHashZ self; + LDKCResult_boolLightningErrorZ self; public: - COption_BlockHashZ(const COption_BlockHashZ&) = delete; - COption_BlockHashZ(COption_BlockHashZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_BlockHashZ)); } - COption_BlockHashZ(LDKCOption_BlockHashZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_BlockHashZ)); } - operator LDKCOption_BlockHashZ() && { LDKCOption_BlockHashZ res = self; memset(&self, 0, sizeof(LDKCOption_BlockHashZ)); return res; } - ~COption_BlockHashZ() { COption_BlockHashZ_free(self); } - COption_BlockHashZ& operator=(COption_BlockHashZ&& o) { COption_BlockHashZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_BlockHashZ)); return *this; } - LDKCOption_BlockHashZ* operator &() { return &self; } - LDKCOption_BlockHashZ* operator ->() { return &self; } - const LDKCOption_BlockHashZ* operator &() const { return &self; } - const LDKCOption_BlockHashZ* operator ->() const { return &self; } + CResult_boolLightningErrorZ(const CResult_boolLightningErrorZ&) = delete; + CResult_boolLightningErrorZ(CResult_boolLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolLightningErrorZ)); } + CResult_boolLightningErrorZ(LDKCResult_boolLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolLightningErrorZ)); } + operator LDKCResult_boolLightningErrorZ() && { LDKCResult_boolLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolLightningErrorZ)); return res; } + ~CResult_boolLightningErrorZ() { CResult_boolLightningErrorZ_free(self); } + CResult_boolLightningErrorZ& operator=(CResult_boolLightningErrorZ&& o) { CResult_boolLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_boolLightningErrorZ)); return *this; } + LDKCResult_boolLightningErrorZ* operator &() { return &self; } + LDKCResult_boolLightningErrorZ* operator ->() { return &self; } + const LDKCResult_boolLightningErrorZ* operator &() const { return &self; } + const LDKCResult_boolLightningErrorZ* operator ->() const { return &self; } }; class CResult_NodeIdDecodeErrorZ { private: @@ -6333,22 +6694,7 @@ class CResult_NodeIdDecodeErrorZ { const LDKCResult_NodeIdDecodeErrorZ* operator &() const { return &self; } const LDKCResult_NodeIdDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_boolLightningErrorZ { -private: - LDKCResult_boolLightningErrorZ self; -public: - CResult_boolLightningErrorZ(const CResult_boolLightningErrorZ&) = delete; - CResult_boolLightningErrorZ(CResult_boolLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolLightningErrorZ)); } - CResult_boolLightningErrorZ(LDKCResult_boolLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolLightningErrorZ)); } - operator LDKCResult_boolLightningErrorZ() && { LDKCResult_boolLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolLightningErrorZ)); return res; } - ~CResult_boolLightningErrorZ() { CResult_boolLightningErrorZ_free(self); } - CResult_boolLightningErrorZ& operator=(CResult_boolLightningErrorZ&& o) { CResult_boolLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_boolLightningErrorZ)); return *this; } - LDKCResult_boolLightningErrorZ* operator &() { return &self; } - LDKCResult_boolLightningErrorZ* operator ->() { return &self; } - const LDKCResult_boolLightningErrorZ* operator &() const { return &self; } - const LDKCResult_boolLightningErrorZ* operator ->() const { return &self; } -}; -class CResult_ChannelShutdownStateDecodeErrorZ { +class CResult_ChannelShutdownStateDecodeErrorZ { private: LDKCResult_ChannelShutdownStateDecodeErrorZ self; public: @@ -6363,6 +6709,21 @@ class CResult_ChannelShutdownStateDecodeErrorZ { const LDKCResult_ChannelShutdownStateDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelShutdownStateDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_HTLCOutputInCommitmentDecodeErrorZ { +private: + LDKCResult_HTLCOutputInCommitmentDecodeErrorZ self; +public: + CResult_HTLCOutputInCommitmentDecodeErrorZ(const CResult_HTLCOutputInCommitmentDecodeErrorZ&) = delete; + CResult_HTLCOutputInCommitmentDecodeErrorZ(CResult_HTLCOutputInCommitmentDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HTLCOutputInCommitmentDecodeErrorZ)); } + CResult_HTLCOutputInCommitmentDecodeErrorZ(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ)); } + operator LDKCResult_HTLCOutputInCommitmentDecodeErrorZ() && { LDKCResult_HTLCOutputInCommitmentDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ)); return res; } + ~CResult_HTLCOutputInCommitmentDecodeErrorZ() { CResult_HTLCOutputInCommitmentDecodeErrorZ_free(self); } + CResult_HTLCOutputInCommitmentDecodeErrorZ& operator=(CResult_HTLCOutputInCommitmentDecodeErrorZ&& o) { CResult_HTLCOutputInCommitmentDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HTLCOutputInCommitmentDecodeErrorZ)); return *this; } + LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator &() { return &self; } + LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator ->() const { return &self; } +}; class CResult_NodeAnnouncementInfoDecodeErrorZ { private: LDKCResult_NodeAnnouncementInfoDecodeErrorZ self; @@ -6378,20 +6739,20 @@ class CResult_NodeAnnouncementInfoDecodeErrorZ { const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() const { return &self; } const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() const { return &self; } }; -class C2Tuple_BlockHashChannelMonitorZ { +class CResult_ShutdownScriptInvalidShutdownScriptZ { private: - LDKC2Tuple_BlockHashChannelMonitorZ self; + LDKCResult_ShutdownScriptInvalidShutdownScriptZ self; public: - C2Tuple_BlockHashChannelMonitorZ(const C2Tuple_BlockHashChannelMonitorZ&) = delete; - C2Tuple_BlockHashChannelMonitorZ(C2Tuple_BlockHashChannelMonitorZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_BlockHashChannelMonitorZ)); } - C2Tuple_BlockHashChannelMonitorZ(LDKC2Tuple_BlockHashChannelMonitorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_BlockHashChannelMonitorZ)); } - operator LDKC2Tuple_BlockHashChannelMonitorZ() && { LDKC2Tuple_BlockHashChannelMonitorZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_BlockHashChannelMonitorZ)); return res; } - ~C2Tuple_BlockHashChannelMonitorZ() { C2Tuple_BlockHashChannelMonitorZ_free(self); } - C2Tuple_BlockHashChannelMonitorZ& operator=(C2Tuple_BlockHashChannelMonitorZ&& o) { C2Tuple_BlockHashChannelMonitorZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_BlockHashChannelMonitorZ)); return *this; } - LDKC2Tuple_BlockHashChannelMonitorZ* operator &() { return &self; } - LDKC2Tuple_BlockHashChannelMonitorZ* operator ->() { return &self; } - const LDKC2Tuple_BlockHashChannelMonitorZ* operator &() const { return &self; } - const LDKC2Tuple_BlockHashChannelMonitorZ* operator ->() const { return &self; } + CResult_ShutdownScriptInvalidShutdownScriptZ(const CResult_ShutdownScriptInvalidShutdownScriptZ&) = delete; + CResult_ShutdownScriptInvalidShutdownScriptZ(CResult_ShutdownScriptInvalidShutdownScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ShutdownScriptInvalidShutdownScriptZ)); } + CResult_ShutdownScriptInvalidShutdownScriptZ(LDKCResult_ShutdownScriptInvalidShutdownScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ)); } + operator LDKCResult_ShutdownScriptInvalidShutdownScriptZ() && { LDKCResult_ShutdownScriptInvalidShutdownScriptZ res = self; memset(&self, 0, sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ)); return res; } + ~CResult_ShutdownScriptInvalidShutdownScriptZ() { CResult_ShutdownScriptInvalidShutdownScriptZ_free(self); } + CResult_ShutdownScriptInvalidShutdownScriptZ& operator=(CResult_ShutdownScriptInvalidShutdownScriptZ&& o) { CResult_ShutdownScriptInvalidShutdownScriptZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ShutdownScriptInvalidShutdownScriptZ)); return *this; } + LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator &() { return &self; } + LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator ->() { return &self; } + const LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator &() const { return &self; } + const LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator ->() const { return &self; } }; class CResult_COption_NetworkUpdateZDecodeErrorZ { private: @@ -6438,51 +6799,6 @@ class CResult_ShutdownScriptNoneZ { const LDKCResult_ShutdownScriptNoneZ* operator &() const { return &self; } const LDKCResult_ShutdownScriptNoneZ* operator ->() const { return &self; } }; -class CResult_HTLCOutputInCommitmentDecodeErrorZ { -private: - LDKCResult_HTLCOutputInCommitmentDecodeErrorZ self; -public: - CResult_HTLCOutputInCommitmentDecodeErrorZ(const CResult_HTLCOutputInCommitmentDecodeErrorZ&) = delete; - CResult_HTLCOutputInCommitmentDecodeErrorZ(CResult_HTLCOutputInCommitmentDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HTLCOutputInCommitmentDecodeErrorZ)); } - CResult_HTLCOutputInCommitmentDecodeErrorZ(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ)); } - operator LDKCResult_HTLCOutputInCommitmentDecodeErrorZ() && { LDKCResult_HTLCOutputInCommitmentDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ)); return res; } - ~CResult_HTLCOutputInCommitmentDecodeErrorZ() { CResult_HTLCOutputInCommitmentDecodeErrorZ_free(self); } - CResult_HTLCOutputInCommitmentDecodeErrorZ& operator=(CResult_HTLCOutputInCommitmentDecodeErrorZ&& o) { CResult_HTLCOutputInCommitmentDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HTLCOutputInCommitmentDecodeErrorZ)); return *this; } - LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator &() { return &self; } - LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_ShutdownScriptInvalidShutdownScriptZ { -private: - LDKCResult_ShutdownScriptInvalidShutdownScriptZ self; -public: - CResult_ShutdownScriptInvalidShutdownScriptZ(const CResult_ShutdownScriptInvalidShutdownScriptZ&) = delete; - CResult_ShutdownScriptInvalidShutdownScriptZ(CResult_ShutdownScriptInvalidShutdownScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ShutdownScriptInvalidShutdownScriptZ)); } - CResult_ShutdownScriptInvalidShutdownScriptZ(LDKCResult_ShutdownScriptInvalidShutdownScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ)); } - operator LDKCResult_ShutdownScriptInvalidShutdownScriptZ() && { LDKCResult_ShutdownScriptInvalidShutdownScriptZ res = self; memset(&self, 0, sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ)); return res; } - ~CResult_ShutdownScriptInvalidShutdownScriptZ() { CResult_ShutdownScriptInvalidShutdownScriptZ_free(self); } - CResult_ShutdownScriptInvalidShutdownScriptZ& operator=(CResult_ShutdownScriptInvalidShutdownScriptZ&& o) { CResult_ShutdownScriptInvalidShutdownScriptZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ShutdownScriptInvalidShutdownScriptZ)); return *this; } - LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator &() { return &self; } - LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator ->() { return &self; } - const LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator &() const { return &self; } - const LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator ->() const { return &self; } -}; -class CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ { -private: - LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ self; -public: - CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ(const CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ&) = delete; - CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ(CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ)); } - CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ(LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ)); } - operator LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ() && { LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ)); return res; } - ~CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ() { CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(self); } - CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ& operator=(CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ&& o) { CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ)); return *this; } - LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ* operator &() { return &self; } - LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ* operator ->() const { return &self; } -}; class COption_HTLCDestinationZ { private: LDKCOption_HTLCDestinationZ self; @@ -6528,6 +6844,21 @@ class CVec_RouteHopZ { const LDKCVec_RouteHopZ* operator &() const { return &self; } const LDKCVec_RouteHopZ* operator ->() const { return &self; } }; +class CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ { +private: + LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ self; +public: + CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ(const CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ&) = delete; + CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ(CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ)); } + CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ(LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ)); } + operator LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ() && { LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ)); return res; } + ~CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ() { CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(self); } + CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ& operator=(CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ&& o) { CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ)); return *this; } + LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ* operator &() { return &self; } + LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ* operator ->() const { return &self; } +}; class CResult_CVec_UtxoZNoneZ { private: LDKCResult_CVec_UtxoZNoneZ self; @@ -6543,6 +6874,21 @@ class CResult_CVec_UtxoZNoneZ { const LDKCResult_CVec_UtxoZNoneZ* operator &() const { return &self; } const LDKCResult_CVec_UtxoZNoneZ* operator ->() const { return &self; } }; +class CResult_CVec_u8ZIOErrorZ { +private: + LDKCResult_CVec_u8ZIOErrorZ self; +public: + CResult_CVec_u8ZIOErrorZ(const CResult_CVec_u8ZIOErrorZ&) = delete; + CResult_CVec_u8ZIOErrorZ(CResult_CVec_u8ZIOErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_u8ZIOErrorZ)); } + CResult_CVec_u8ZIOErrorZ(LDKCResult_CVec_u8ZIOErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_u8ZIOErrorZ)); } + operator LDKCResult_CVec_u8ZIOErrorZ() && { LDKCResult_CVec_u8ZIOErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_u8ZIOErrorZ)); return res; } + ~CResult_CVec_u8ZIOErrorZ() { CResult_CVec_u8ZIOErrorZ_free(self); } + CResult_CVec_u8ZIOErrorZ& operator=(CResult_CVec_u8ZIOErrorZ&& o) { CResult_CVec_u8ZIOErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_u8ZIOErrorZ)); return *this; } + LDKCResult_CVec_u8ZIOErrorZ* operator &() { return &self; } + LDKCResult_CVec_u8ZIOErrorZ* operator ->() { return &self; } + const LDKCResult_CVec_u8ZIOErrorZ* operator &() const { return &self; } + const LDKCResult_CVec_u8ZIOErrorZ* operator ->() const { return &self; } +}; class COption_CustomOnionMessageContentsZ { private: LDKCOption_CustomOnionMessageContentsZ self; @@ -6558,36 +6904,6 @@ class COption_CustomOnionMessageContentsZ { const LDKCOption_CustomOnionMessageContentsZ* operator &() const { return &self; } const LDKCOption_CustomOnionMessageContentsZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_BlockHashChannelMonitorZZ { -private: - LDKCVec_C2Tuple_BlockHashChannelMonitorZZ self; -public: - CVec_C2Tuple_BlockHashChannelMonitorZZ(const CVec_C2Tuple_BlockHashChannelMonitorZZ&) = delete; - CVec_C2Tuple_BlockHashChannelMonitorZZ(CVec_C2Tuple_BlockHashChannelMonitorZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_BlockHashChannelMonitorZZ)); } - CVec_C2Tuple_BlockHashChannelMonitorZZ(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ)); } - operator LDKCVec_C2Tuple_BlockHashChannelMonitorZZ() && { LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ)); return res; } - ~CVec_C2Tuple_BlockHashChannelMonitorZZ() { CVec_C2Tuple_BlockHashChannelMonitorZZ_free(self); } - CVec_C2Tuple_BlockHashChannelMonitorZZ& operator=(CVec_C2Tuple_BlockHashChannelMonitorZZ&& o) { CVec_C2Tuple_BlockHashChannelMonitorZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_BlockHashChannelMonitorZZ)); return *this; } - LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator &() { return &self; } - LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator ->() const { return &self; } -}; -class CResult_COption_KeyPairZNoneZ { -private: - LDKCResult_COption_KeyPairZNoneZ self; -public: - CResult_COption_KeyPairZNoneZ(const CResult_COption_KeyPairZNoneZ&) = delete; - CResult_COption_KeyPairZNoneZ(CResult_COption_KeyPairZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_KeyPairZNoneZ)); } - CResult_COption_KeyPairZNoneZ(LDKCResult_COption_KeyPairZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_KeyPairZNoneZ)); } - operator LDKCResult_COption_KeyPairZNoneZ() && { LDKCResult_COption_KeyPairZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_KeyPairZNoneZ)); return res; } - ~CResult_COption_KeyPairZNoneZ() { CResult_COption_KeyPairZNoneZ_free(self); } - CResult_COption_KeyPairZNoneZ& operator=(CResult_COption_KeyPairZNoneZ&& o) { CResult_COption_KeyPairZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_KeyPairZNoneZ)); return *this; } - LDKCResult_COption_KeyPairZNoneZ* operator &() { return &self; } - LDKCResult_COption_KeyPairZNoneZ* operator ->() { return &self; } - const LDKCResult_COption_KeyPairZNoneZ* operator &() const { return &self; } - const LDKCResult_COption_KeyPairZNoneZ* operator ->() const { return &self; } -}; class CVec_ThirtyTwoBytesZ { private: LDKCVec_ThirtyTwoBytesZ self; @@ -6603,6 +6919,21 @@ class CVec_ThirtyTwoBytesZ { const LDKCVec_ThirtyTwoBytesZ* operator &() const { return &self; } const LDKCVec_ThirtyTwoBytesZ* operator ->() const { return &self; } }; +class CResult_ChannelMonitorUpdateStatusNoneZ { +private: + LDKCResult_ChannelMonitorUpdateStatusNoneZ self; +public: + CResult_ChannelMonitorUpdateStatusNoneZ(const CResult_ChannelMonitorUpdateStatusNoneZ&) = delete; + CResult_ChannelMonitorUpdateStatusNoneZ(CResult_ChannelMonitorUpdateStatusNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelMonitorUpdateStatusNoneZ)); } + CResult_ChannelMonitorUpdateStatusNoneZ(LDKCResult_ChannelMonitorUpdateStatusNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ)); } + operator LDKCResult_ChannelMonitorUpdateStatusNoneZ() && { LDKCResult_ChannelMonitorUpdateStatusNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ)); return res; } + ~CResult_ChannelMonitorUpdateStatusNoneZ() { CResult_ChannelMonitorUpdateStatusNoneZ_free(self); } + CResult_ChannelMonitorUpdateStatusNoneZ& operator=(CResult_ChannelMonitorUpdateStatusNoneZ&& o) { CResult_ChannelMonitorUpdateStatusNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelMonitorUpdateStatusNoneZ)); return *this; } + LDKCResult_ChannelMonitorUpdateStatusNoneZ* operator &() { return &self; } + LDKCResult_ChannelMonitorUpdateStatusNoneZ* operator ->() { return &self; } + const LDKCResult_ChannelMonitorUpdateStatusNoneZ* operator &() const { return &self; } + const LDKCResult_ChannelMonitorUpdateStatusNoneZ* operator ->() const { return &self; } +}; class CResult_ClosingSignedDecodeErrorZ { private: LDKCResult_ClosingSignedDecodeErrorZ self; @@ -6648,6 +6979,21 @@ class CVec_CResult_NoneAPIErrorZZ { const LDKCVec_CResult_NoneAPIErrorZZ* operator &() const { return &self; } const LDKCVec_CResult_NoneAPIErrorZZ* operator ->() const { return &self; } }; +class CResult_SchnorrSignatureNoneZ { +private: + LDKCResult_SchnorrSignatureNoneZ self; +public: + CResult_SchnorrSignatureNoneZ(const CResult_SchnorrSignatureNoneZ&) = delete; + CResult_SchnorrSignatureNoneZ(CResult_SchnorrSignatureNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SchnorrSignatureNoneZ)); } + CResult_SchnorrSignatureNoneZ(LDKCResult_SchnorrSignatureNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SchnorrSignatureNoneZ)); } + operator LDKCResult_SchnorrSignatureNoneZ() && { LDKCResult_SchnorrSignatureNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SchnorrSignatureNoneZ)); return res; } + ~CResult_SchnorrSignatureNoneZ() { CResult_SchnorrSignatureNoneZ_free(self); } + CResult_SchnorrSignatureNoneZ& operator=(CResult_SchnorrSignatureNoneZ&& o) { CResult_SchnorrSignatureNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SchnorrSignatureNoneZ)); return *this; } + LDKCResult_SchnorrSignatureNoneZ* operator &() { return &self; } + LDKCResult_SchnorrSignatureNoneZ* operator ->() { return &self; } + const LDKCResult_SchnorrSignatureNoneZ* operator &() const { return &self; } + const LDKCResult_SchnorrSignatureNoneZ* operator ->() const { return &self; } +}; class CResult_CounterpartyCommitmentSecretsDecodeErrorZ { private: LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ self; @@ -6663,6 +7009,36 @@ class CResult_CounterpartyCommitmentSecretsDecodeErrorZ { const LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator &() const { return &self; } const LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_ReceiveTlvsDecodeErrorZ { +private: + LDKCResult_ReceiveTlvsDecodeErrorZ self; +public: + CResult_ReceiveTlvsDecodeErrorZ(const CResult_ReceiveTlvsDecodeErrorZ&) = delete; + CResult_ReceiveTlvsDecodeErrorZ(CResult_ReceiveTlvsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReceiveTlvsDecodeErrorZ)); } + CResult_ReceiveTlvsDecodeErrorZ(LDKCResult_ReceiveTlvsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ)); } + operator LDKCResult_ReceiveTlvsDecodeErrorZ() && { LDKCResult_ReceiveTlvsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ)); return res; } + ~CResult_ReceiveTlvsDecodeErrorZ() { CResult_ReceiveTlvsDecodeErrorZ_free(self); } + CResult_ReceiveTlvsDecodeErrorZ& operator=(CResult_ReceiveTlvsDecodeErrorZ&& o) { CResult_ReceiveTlvsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReceiveTlvsDecodeErrorZ)); return *this; } + LDKCResult_ReceiveTlvsDecodeErrorZ* operator &() { return &self; } + LDKCResult_ReceiveTlvsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ReceiveTlvsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ReceiveTlvsDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_HTLCDescriptorDecodeErrorZ { +private: + LDKCResult_HTLCDescriptorDecodeErrorZ self; +public: + CResult_HTLCDescriptorDecodeErrorZ(const CResult_HTLCDescriptorDecodeErrorZ&) = delete; + CResult_HTLCDescriptorDecodeErrorZ(CResult_HTLCDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HTLCDescriptorDecodeErrorZ)); } + CResult_HTLCDescriptorDecodeErrorZ(LDKCResult_HTLCDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ)); } + operator LDKCResult_HTLCDescriptorDecodeErrorZ() && { LDKCResult_HTLCDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ)); return res; } + ~CResult_HTLCDescriptorDecodeErrorZ() { CResult_HTLCDescriptorDecodeErrorZ_free(self); } + CResult_HTLCDescriptorDecodeErrorZ& operator=(CResult_HTLCDescriptorDecodeErrorZ&& o) { CResult_HTLCDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HTLCDescriptorDecodeErrorZ)); return *this; } + LDKCResult_HTLCDescriptorDecodeErrorZ* operator &() { return &self; } + LDKCResult_HTLCDescriptorDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_HTLCDescriptorDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_HTLCDescriptorDecodeErrorZ* operator ->() const { return &self; } +}; class CVec_RecentPaymentDetailsZ { private: LDKCVec_RecentPaymentDetailsZ self; @@ -6678,21 +7054,6 @@ class CVec_RecentPaymentDetailsZ { const LDKCVec_RecentPaymentDetailsZ* operator &() const { return &self; } const LDKCVec_RecentPaymentDetailsZ* operator ->() const { return &self; } }; -class CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { -private: - LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ self; -public: - CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ(const CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&) = delete; - CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); } - CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); } - operator LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ() && { LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); return res; } - ~CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ() { CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(self); } - CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ& operator=(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&& o) { CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); return *this; } - LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator &() { return &self; } - LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator ->() const { return &self; } -}; class CVec_RouteHintHopZ { private: LDKCVec_RouteHintHopZ self; @@ -6753,6 +7114,51 @@ class CResult_PaymentParametersDecodeErrorZ { const LDKCResult_PaymentParametersDecodeErrorZ* operator &() const { return &self; } const LDKCResult_PaymentParametersDecodeErrorZ* operator ->() const { return &self; } }; +class C2Tuple_ThirtyTwoBytesChannelMonitorZ { +private: + LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ self; +public: + C2Tuple_ThirtyTwoBytesChannelMonitorZ(const C2Tuple_ThirtyTwoBytesChannelMonitorZ&) = delete; + C2Tuple_ThirtyTwoBytesChannelMonitorZ(C2Tuple_ThirtyTwoBytesChannelMonitorZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesChannelMonitorZ)); } + C2Tuple_ThirtyTwoBytesChannelMonitorZ(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ)); } + operator LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ() && { LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ)); return res; } + ~C2Tuple_ThirtyTwoBytesChannelMonitorZ() { C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(self); } + C2Tuple_ThirtyTwoBytesChannelMonitorZ& operator=(C2Tuple_ThirtyTwoBytesChannelMonitorZ&& o) { C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesChannelMonitorZ)); return *this; } + LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* operator &() { return &self; } + LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* operator ->() { return &self; } + const LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* operator &() const { return &self; } + const LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* operator ->() const { return &self; } +}; +class COption_U128Z { +private: + LDKCOption_U128Z self; +public: + COption_U128Z(const COption_U128Z&) = delete; + COption_U128Z(COption_U128Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_U128Z)); } + COption_U128Z(LDKCOption_U128Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_U128Z)); } + operator LDKCOption_U128Z() && { LDKCOption_U128Z res = self; memset(&self, 0, sizeof(LDKCOption_U128Z)); return res; } + ~COption_U128Z() { COption_U128Z_free(self); } + COption_U128Z& operator=(COption_U128Z&& o) { COption_U128Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_U128Z)); return *this; } + LDKCOption_U128Z* operator &() { return &self; } + LDKCOption_U128Z* operator ->() { return &self; } + const LDKCOption_U128Z* operator &() const { return &self; } + const LDKCOption_U128Z* operator ->() const { return &self; } +}; +class C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { +private: + LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ self; +public: + C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ(const C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ&) = delete; + C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ(C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ)); } + C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ)); } + operator LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ() && { LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ)); return res; } + ~C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ() { C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(self); } + C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ& operator=(C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ&& o) { C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ)); return *this; } + LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* operator &() { return &self; } + LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* operator ->() { return &self; } + const LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* operator &() const { return &self; } + const LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* operator ->() const { return &self; } +}; class CResult_TxAckRbfDecodeErrorZ { private: LDKCResult_TxAckRbfDecodeErrorZ self; @@ -6843,35 +7249,35 @@ class C2Tuple_OutPointCVec_MonitorUpdateIdZZ { const LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* operator &() const { return &self; } const LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* operator ->() const { return &self; } }; -class CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { +class CResult_CVec_u8ZNoneZ { private: - LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ self; + LDKCResult_CVec_u8ZNoneZ self; public: - CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&) = delete; - CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); } - CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); } - operator LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); return res; } - ~CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(self); } - CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); return *this; } - LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator &() { return &self; } - LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator ->() const { return &self; } + CResult_CVec_u8ZNoneZ(const CResult_CVec_u8ZNoneZ&) = delete; + CResult_CVec_u8ZNoneZ(CResult_CVec_u8ZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_u8ZNoneZ)); } + CResult_CVec_u8ZNoneZ(LDKCResult_CVec_u8ZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_u8ZNoneZ)); } + operator LDKCResult_CVec_u8ZNoneZ() && { LDKCResult_CVec_u8ZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_u8ZNoneZ)); return res; } + ~CResult_CVec_u8ZNoneZ() { CResult_CVec_u8ZNoneZ_free(self); } + CResult_CVec_u8ZNoneZ& operator=(CResult_CVec_u8ZNoneZ&& o) { CResult_CVec_u8ZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_u8ZNoneZ)); return *this; } + LDKCResult_CVec_u8ZNoneZ* operator &() { return &self; } + LDKCResult_CVec_u8ZNoneZ* operator ->() { return &self; } + const LDKCResult_CVec_u8ZNoneZ* operator &() const { return &self; } + const LDKCResult_CVec_u8ZNoneZ* operator ->() const { return &self; } }; -class C2Tuple_BlockHashChannelManagerZ { +class C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { private: - LDKC2Tuple_BlockHashChannelManagerZ self; + LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ self; public: - C2Tuple_BlockHashChannelManagerZ(const C2Tuple_BlockHashChannelManagerZ&) = delete; - C2Tuple_BlockHashChannelManagerZ(C2Tuple_BlockHashChannelManagerZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_BlockHashChannelManagerZ)); } - C2Tuple_BlockHashChannelManagerZ(LDKC2Tuple_BlockHashChannelManagerZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_BlockHashChannelManagerZ)); } - operator LDKC2Tuple_BlockHashChannelManagerZ() && { LDKC2Tuple_BlockHashChannelManagerZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_BlockHashChannelManagerZ)); return res; } - ~C2Tuple_BlockHashChannelManagerZ() { C2Tuple_BlockHashChannelManagerZ_free(self); } - C2Tuple_BlockHashChannelManagerZ& operator=(C2Tuple_BlockHashChannelManagerZ&& o) { C2Tuple_BlockHashChannelManagerZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_BlockHashChannelManagerZ)); return *this; } - LDKC2Tuple_BlockHashChannelManagerZ* operator &() { return &self; } - LDKC2Tuple_BlockHashChannelManagerZ* operator ->() { return &self; } - const LDKC2Tuple_BlockHashChannelManagerZ* operator &() const { return &self; } - const LDKC2Tuple_BlockHashChannelManagerZ* operator ->() const { return &self; } + C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ(const C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ&) = delete; + C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ(C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ)); } + C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ)); } + operator LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ() && { LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ)); return res; } + ~C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ() { C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(self); } + C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ& operator=(C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ&& o) { C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ)); return *this; } + LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* operator &() { return &self; } + LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* operator ->() { return &self; } + const LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* operator &() const { return &self; } + const LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* operator ->() const { return &self; } }; class CResult_ChannelTransactionParametersDecodeErrorZ { private: @@ -6918,36 +7324,6 @@ class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { const LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator &() const { return &self; } const LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator ->() const { return &self; } }; -class C2Tuple_PaymentHashPaymentIdZ { -private: - LDKC2Tuple_PaymentHashPaymentIdZ self; -public: - C2Tuple_PaymentHashPaymentIdZ(const C2Tuple_PaymentHashPaymentIdZ&) = delete; - C2Tuple_PaymentHashPaymentIdZ(C2Tuple_PaymentHashPaymentIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PaymentHashPaymentIdZ)); } - C2Tuple_PaymentHashPaymentIdZ(LDKC2Tuple_PaymentHashPaymentIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PaymentHashPaymentIdZ)); } - operator LDKC2Tuple_PaymentHashPaymentIdZ() && { LDKC2Tuple_PaymentHashPaymentIdZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PaymentHashPaymentIdZ)); return res; } - ~C2Tuple_PaymentHashPaymentIdZ() { C2Tuple_PaymentHashPaymentIdZ_free(self); } - C2Tuple_PaymentHashPaymentIdZ& operator=(C2Tuple_PaymentHashPaymentIdZ&& o) { C2Tuple_PaymentHashPaymentIdZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PaymentHashPaymentIdZ)); return *this; } - LDKC2Tuple_PaymentHashPaymentIdZ* operator &() { return &self; } - LDKC2Tuple_PaymentHashPaymentIdZ* operator ->() { return &self; } - const LDKC2Tuple_PaymentHashPaymentIdZ* operator &() const { return &self; } - const LDKC2Tuple_PaymentHashPaymentIdZ* operator ->() const { return &self; } -}; -class CResult_NoneErrorZ { -private: - LDKCResult_NoneErrorZ self; -public: - CResult_NoneErrorZ(const CResult_NoneErrorZ&) = delete; - CResult_NoneErrorZ(CResult_NoneErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneErrorZ)); } - CResult_NoneErrorZ(LDKCResult_NoneErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneErrorZ)); } - operator LDKCResult_NoneErrorZ() && { LDKCResult_NoneErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneErrorZ)); return res; } - ~CResult_NoneErrorZ() { CResult_NoneErrorZ_free(self); } - CResult_NoneErrorZ& operator=(CResult_NoneErrorZ&& o) { CResult_NoneErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneErrorZ)); return *this; } - LDKCResult_NoneErrorZ* operator &() { return &self; } - LDKCResult_NoneErrorZ* operator ->() { return &self; } - const LDKCResult_NoneErrorZ* operator &() const { return &self; } - const LDKCResult_NoneErrorZ* operator ->() const { return &self; } -}; class CResult_InFlightHtlcsDecodeErrorZ { private: LDKCResult_InFlightHtlcsDecodeErrorZ self; @@ -6978,6 +7354,21 @@ class CResult_COption_HTLCDestinationZDecodeErrorZ { const LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_ThirtyTwoBytesNoneZ { +private: + LDKCResult_ThirtyTwoBytesNoneZ self; +public: + CResult_ThirtyTwoBytesNoneZ(const CResult_ThirtyTwoBytesNoneZ&) = delete; + CResult_ThirtyTwoBytesNoneZ(CResult_ThirtyTwoBytesNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ThirtyTwoBytesNoneZ)); } + CResult_ThirtyTwoBytesNoneZ(LDKCResult_ThirtyTwoBytesNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ThirtyTwoBytesNoneZ)); } + operator LDKCResult_ThirtyTwoBytesNoneZ() && { LDKCResult_ThirtyTwoBytesNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_ThirtyTwoBytesNoneZ)); return res; } + ~CResult_ThirtyTwoBytesNoneZ() { CResult_ThirtyTwoBytesNoneZ_free(self); } + CResult_ThirtyTwoBytesNoneZ& operator=(CResult_ThirtyTwoBytesNoneZ&& o) { CResult_ThirtyTwoBytesNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ThirtyTwoBytesNoneZ)); return *this; } + LDKCResult_ThirtyTwoBytesNoneZ* operator &() { return &self; } + LDKCResult_ThirtyTwoBytesNoneZ* operator ->() { return &self; } + const LDKCResult_ThirtyTwoBytesNoneZ* operator &() const { return &self; } + const LDKCResult_ThirtyTwoBytesNoneZ* operator ->() const { return &self; } +}; class C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { private: LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ self; @@ -7008,20 +7399,20 @@ class CResult_BlindedHopDecodeErrorZ { const LDKCResult_BlindedHopDecodeErrorZ* operator &() const { return &self; } const LDKCResult_BlindedHopDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_NoneLightningErrorZ { +class C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { private: - LDKCResult_NoneLightningErrorZ self; + LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ self; public: - CResult_NoneLightningErrorZ(const CResult_NoneLightningErrorZ&) = delete; - CResult_NoneLightningErrorZ(CResult_NoneLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneLightningErrorZ)); } - CResult_NoneLightningErrorZ(LDKCResult_NoneLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneLightningErrorZ)); } - operator LDKCResult_NoneLightningErrorZ() && { LDKCResult_NoneLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneLightningErrorZ)); return res; } - ~CResult_NoneLightningErrorZ() { CResult_NoneLightningErrorZ_free(self); } - CResult_NoneLightningErrorZ& operator=(CResult_NoneLightningErrorZ&& o) { CResult_NoneLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneLightningErrorZ)); return *this; } - LDKCResult_NoneLightningErrorZ* operator &() { return &self; } - LDKCResult_NoneLightningErrorZ* operator ->() { return &self; } - const LDKCResult_NoneLightningErrorZ* operator &() const { return &self; } - const LDKCResult_NoneLightningErrorZ* operator ->() const { return &self; } + C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ(const C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ&) = delete; + C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ(C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ)); } + C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ)); } + operator LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ() && { LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ)); return res; } + ~C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ() { C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(self); } + C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ& operator=(C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ&& o) { C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ)); return *this; } + LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* operator &() { return &self; } + LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* operator ->() { return &self; } + const LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* operator &() const { return &self; } + const LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* operator ->() const { return &self; } }; class CResult_FixedPenaltyScorerDecodeErrorZ { private: @@ -7053,50 +7444,20 @@ class CVec_BlindedPathZ { const LDKCVec_BlindedPathZ* operator &() const { return &self; } const LDKCVec_BlindedPathZ* operator ->() const { return &self; } }; -class CResult_PaymentHashRetryableSendFailureZ { -private: - LDKCResult_PaymentHashRetryableSendFailureZ self; -public: - CResult_PaymentHashRetryableSendFailureZ(const CResult_PaymentHashRetryableSendFailureZ&) = delete; - CResult_PaymentHashRetryableSendFailureZ(CResult_PaymentHashRetryableSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentHashRetryableSendFailureZ)); } - CResult_PaymentHashRetryableSendFailureZ(LDKCResult_PaymentHashRetryableSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentHashRetryableSendFailureZ)); } - operator LDKCResult_PaymentHashRetryableSendFailureZ() && { LDKCResult_PaymentHashRetryableSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentHashRetryableSendFailureZ)); return res; } - ~CResult_PaymentHashRetryableSendFailureZ() { CResult_PaymentHashRetryableSendFailureZ_free(self); } - CResult_PaymentHashRetryableSendFailureZ& operator=(CResult_PaymentHashRetryableSendFailureZ&& o) { CResult_PaymentHashRetryableSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentHashRetryableSendFailureZ)); return *this; } - LDKCResult_PaymentHashRetryableSendFailureZ* operator &() { return &self; } - LDKCResult_PaymentHashRetryableSendFailureZ* operator ->() { return &self; } - const LDKCResult_PaymentHashRetryableSendFailureZ* operator &() const { return &self; } - const LDKCResult_PaymentHashRetryableSendFailureZ* operator ->() const { return &self; } -}; -class C2Tuple_PublicKeyCOption_NetAddressZZ { -private: - LDKC2Tuple_PublicKeyCOption_NetAddressZZ self; -public: - C2Tuple_PublicKeyCOption_NetAddressZZ(const C2Tuple_PublicKeyCOption_NetAddressZZ&) = delete; - C2Tuple_PublicKeyCOption_NetAddressZZ(C2Tuple_PublicKeyCOption_NetAddressZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PublicKeyCOption_NetAddressZZ)); } - C2Tuple_PublicKeyCOption_NetAddressZZ(LDKC2Tuple_PublicKeyCOption_NetAddressZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ)); } - operator LDKC2Tuple_PublicKeyCOption_NetAddressZZ() && { LDKC2Tuple_PublicKeyCOption_NetAddressZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ)); return res; } - ~C2Tuple_PublicKeyCOption_NetAddressZZ() { C2Tuple_PublicKeyCOption_NetAddressZZ_free(self); } - C2Tuple_PublicKeyCOption_NetAddressZZ& operator=(C2Tuple_PublicKeyCOption_NetAddressZZ&& o) { C2Tuple_PublicKeyCOption_NetAddressZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PublicKeyCOption_NetAddressZZ)); return *this; } - LDKC2Tuple_PublicKeyCOption_NetAddressZZ* operator &() { return &self; } - LDKC2Tuple_PublicKeyCOption_NetAddressZZ* operator ->() { return &self; } - const LDKC2Tuple_PublicKeyCOption_NetAddressZZ* operator &() const { return &self; } - const LDKC2Tuple_PublicKeyCOption_NetAddressZZ* operator ->() const { return &self; } -}; -class COption_CVec_NetAddressZZ { -private: - LDKCOption_CVec_NetAddressZZ self; -public: - COption_CVec_NetAddressZZ(const COption_CVec_NetAddressZZ&) = delete; - COption_CVec_NetAddressZZ(COption_CVec_NetAddressZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_CVec_NetAddressZZ)); } - COption_CVec_NetAddressZZ(LDKCOption_CVec_NetAddressZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_CVec_NetAddressZZ)); } - operator LDKCOption_CVec_NetAddressZZ() && { LDKCOption_CVec_NetAddressZZ res = self; memset(&self, 0, sizeof(LDKCOption_CVec_NetAddressZZ)); return res; } - ~COption_CVec_NetAddressZZ() { COption_CVec_NetAddressZZ_free(self); } - COption_CVec_NetAddressZZ& operator=(COption_CVec_NetAddressZZ&& o) { COption_CVec_NetAddressZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_CVec_NetAddressZZ)); return *this; } - LDKCOption_CVec_NetAddressZZ* operator &() { return &self; } - LDKCOption_CVec_NetAddressZZ* operator ->() { return &self; } - const LDKCOption_CVec_NetAddressZZ* operator &() const { return &self; } - const LDKCOption_CVec_NetAddressZZ* operator ->() const { return &self; } +class CResult_NoneLightningErrorZ { +private: + LDKCResult_NoneLightningErrorZ self; +public: + CResult_NoneLightningErrorZ(const CResult_NoneLightningErrorZ&) = delete; + CResult_NoneLightningErrorZ(CResult_NoneLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneLightningErrorZ)); } + CResult_NoneLightningErrorZ(LDKCResult_NoneLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneLightningErrorZ)); } + operator LDKCResult_NoneLightningErrorZ() && { LDKCResult_NoneLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneLightningErrorZ)); return res; } + ~CResult_NoneLightningErrorZ() { CResult_NoneLightningErrorZ_free(self); } + CResult_NoneLightningErrorZ& operator=(CResult_NoneLightningErrorZ&& o) { CResult_NoneLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneLightningErrorZ)); return *this; } + LDKCResult_NoneLightningErrorZ* operator &() { return &self; } + LDKCResult_NoneLightningErrorZ* operator ->() { return &self; } + const LDKCResult_NoneLightningErrorZ* operator &() const { return &self; } + const LDKCResult_NoneLightningErrorZ* operator ->() const { return &self; } }; class CResult_NonePeerHandleErrorZ { private: @@ -7128,20 +7489,35 @@ class CResult_TrustedCommitmentTransactionNoneZ { const LDKCResult_TrustedCommitmentTransactionNoneZ* operator &() const { return &self; } const LDKCResult_TrustedCommitmentTransactionNoneZ* operator ->() const { return &self; } }; -class CResult_CVec_SignatureZNoneZ { +class CResult_COption_EventZDecodeErrorZ { +private: + LDKCResult_COption_EventZDecodeErrorZ self; +public: + CResult_COption_EventZDecodeErrorZ(const CResult_COption_EventZDecodeErrorZ&) = delete; + CResult_COption_EventZDecodeErrorZ(CResult_COption_EventZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_EventZDecodeErrorZ)); } + CResult_COption_EventZDecodeErrorZ(LDKCResult_COption_EventZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_EventZDecodeErrorZ)); } + operator LDKCResult_COption_EventZDecodeErrorZ() && { LDKCResult_COption_EventZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_EventZDecodeErrorZ)); return res; } + ~CResult_COption_EventZDecodeErrorZ() { CResult_COption_EventZDecodeErrorZ_free(self); } + CResult_COption_EventZDecodeErrorZ& operator=(CResult_COption_EventZDecodeErrorZ&& o) { CResult_COption_EventZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_EventZDecodeErrorZ)); return *this; } + LDKCResult_COption_EventZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_EventZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_EventZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_EventZDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { private: - LDKCResult_CVec_SignatureZNoneZ self; + LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ self; public: - CResult_CVec_SignatureZNoneZ(const CResult_CVec_SignatureZNoneZ&) = delete; - CResult_CVec_SignatureZNoneZ(CResult_CVec_SignatureZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_SignatureZNoneZ)); } - CResult_CVec_SignatureZNoneZ(LDKCResult_CVec_SignatureZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); } - operator LDKCResult_CVec_SignatureZNoneZ() && { LDKCResult_CVec_SignatureZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); return res; } - ~CResult_CVec_SignatureZNoneZ() { CResult_CVec_SignatureZNoneZ_free(self); } - CResult_CVec_SignatureZNoneZ& operator=(CResult_CVec_SignatureZNoneZ&& o) { CResult_CVec_SignatureZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_SignatureZNoneZ)); return *this; } - LDKCResult_CVec_SignatureZNoneZ* operator &() { return &self; } - LDKCResult_CVec_SignatureZNoneZ* operator ->() { return &self; } - const LDKCResult_CVec_SignatureZNoneZ* operator &() const { return &self; } - const LDKCResult_CVec_SignatureZNoneZ* operator ->() const { return &self; } + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ(const CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ&) = delete; + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ(CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ)); } + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ)); } + operator LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ() && { LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ)); return res; } + ~CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ() { CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(self); } + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ& operator=(CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ&& o) { CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ)); return *this; } + LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* operator &() { return &self; } + LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* operator ->() { return &self; } + const LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* operator &() const { return &self; } + const LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* operator ->() const { return &self; } }; class CResult_PaymentFailureReasonDecodeErrorZ { private: @@ -7158,20 +7534,20 @@ class CResult_PaymentFailureReasonDecodeErrorZ { const LDKCResult_PaymentFailureReasonDecodeErrorZ* operator &() const { return &self; } const LDKCResult_PaymentFailureReasonDecodeErrorZ* operator ->() const { return &self; } }; -class CResult__u832APIErrorZ { +class COption_SocketAddressZ { private: - LDKCResult__u832APIErrorZ self; + LDKCOption_SocketAddressZ self; public: - CResult__u832APIErrorZ(const CResult__u832APIErrorZ&) = delete; - CResult__u832APIErrorZ(CResult__u832APIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult__u832APIErrorZ)); } - CResult__u832APIErrorZ(LDKCResult__u832APIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult__u832APIErrorZ)); } - operator LDKCResult__u832APIErrorZ() && { LDKCResult__u832APIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult__u832APIErrorZ)); return res; } - ~CResult__u832APIErrorZ() { CResult__u832APIErrorZ_free(self); } - CResult__u832APIErrorZ& operator=(CResult__u832APIErrorZ&& o) { CResult__u832APIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult__u832APIErrorZ)); return *this; } - LDKCResult__u832APIErrorZ* operator &() { return &self; } - LDKCResult__u832APIErrorZ* operator ->() { return &self; } - const LDKCResult__u832APIErrorZ* operator &() const { return &self; } - const LDKCResult__u832APIErrorZ* operator ->() const { return &self; } + COption_SocketAddressZ(const COption_SocketAddressZ&) = delete; + COption_SocketAddressZ(COption_SocketAddressZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_SocketAddressZ)); } + COption_SocketAddressZ(LDKCOption_SocketAddressZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_SocketAddressZ)); } + operator LDKCOption_SocketAddressZ() && { LDKCOption_SocketAddressZ res = self; memset(&self, 0, sizeof(LDKCOption_SocketAddressZ)); return res; } + ~COption_SocketAddressZ() { COption_SocketAddressZ_free(self); } + COption_SocketAddressZ& operator=(COption_SocketAddressZ&& o) { COption_SocketAddressZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_SocketAddressZ)); return *this; } + LDKCOption_SocketAddressZ* operator &() { return &self; } + LDKCOption_SocketAddressZ* operator ->() { return &self; } + const LDKCOption_SocketAddressZ* operator &() const { return &self; } + const LDKCOption_SocketAddressZ* operator ->() const { return &self; } }; class CResult_COption_MonitorEventZDecodeErrorZ { private: @@ -7188,50 +7564,20 @@ class CResult_COption_MonitorEventZDecodeErrorZ { const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_COption_EventZDecodeErrorZ { +class COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { private: - LDKCResult_COption_EventZDecodeErrorZ self; + LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ self; public: - CResult_COption_EventZDecodeErrorZ(const CResult_COption_EventZDecodeErrorZ&) = delete; - CResult_COption_EventZDecodeErrorZ(CResult_COption_EventZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_EventZDecodeErrorZ)); } - CResult_COption_EventZDecodeErrorZ(LDKCResult_COption_EventZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_EventZDecodeErrorZ)); } - operator LDKCResult_COption_EventZDecodeErrorZ() && { LDKCResult_COption_EventZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_EventZDecodeErrorZ)); return res; } - ~CResult_COption_EventZDecodeErrorZ() { CResult_COption_EventZDecodeErrorZ_free(self); } - CResult_COption_EventZDecodeErrorZ& operator=(CResult_COption_EventZDecodeErrorZ&& o) { CResult_COption_EventZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_EventZDecodeErrorZ)); return *this; } - LDKCResult_COption_EventZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_EventZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_EventZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_EventZDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_RoutingFeesDecodeErrorZ { -private: - LDKCResult_RoutingFeesDecodeErrorZ self; -public: - CResult_RoutingFeesDecodeErrorZ(const CResult_RoutingFeesDecodeErrorZ&) = delete; - CResult_RoutingFeesDecodeErrorZ(CResult_RoutingFeesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); } - CResult_RoutingFeesDecodeErrorZ(LDKCResult_RoutingFeesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); } - operator LDKCResult_RoutingFeesDecodeErrorZ() && { LDKCResult_RoutingFeesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); return res; } - ~CResult_RoutingFeesDecodeErrorZ() { CResult_RoutingFeesDecodeErrorZ_free(self); } - CResult_RoutingFeesDecodeErrorZ& operator=(CResult_RoutingFeesDecodeErrorZ&& o) { CResult_RoutingFeesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); return *this; } - LDKCResult_RoutingFeesDecodeErrorZ* operator &() { return &self; } - LDKCResult_RoutingFeesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RoutingFeesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RoutingFeesDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_PayeePubKeyErrorZ { -private: - LDKCResult_PayeePubKeyErrorZ self; -public: - CResult_PayeePubKeyErrorZ(const CResult_PayeePubKeyErrorZ&) = delete; - CResult_PayeePubKeyErrorZ(CResult_PayeePubKeyErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PayeePubKeyErrorZ)); } - CResult_PayeePubKeyErrorZ(LDKCResult_PayeePubKeyErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PayeePubKeyErrorZ)); } - operator LDKCResult_PayeePubKeyErrorZ() && { LDKCResult_PayeePubKeyErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PayeePubKeyErrorZ)); return res; } - ~CResult_PayeePubKeyErrorZ() { CResult_PayeePubKeyErrorZ_free(self); } - CResult_PayeePubKeyErrorZ& operator=(CResult_PayeePubKeyErrorZ&& o) { CResult_PayeePubKeyErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PayeePubKeyErrorZ)); return *this; } - LDKCResult_PayeePubKeyErrorZ* operator &() { return &self; } - LDKCResult_PayeePubKeyErrorZ* operator ->() { return &self; } - const LDKCResult_PayeePubKeyErrorZ* operator &() const { return &self; } - const LDKCResult_PayeePubKeyErrorZ* operator ->() const { return &self; } + COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ(const COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ&) = delete; + COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ(COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ)); } + COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ)); } + operator LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ() && { LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ)); return res; } + ~COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ() { COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(self); } + COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ& operator=(COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ&& o) { COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ)); return *this; } + LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ* operator &() { return &self; } + LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ* operator ->() const { return &self; } }; class CResult_DescriptionCreationErrorZ { private: @@ -7248,20 +7594,65 @@ class CResult_DescriptionCreationErrorZ { const LDKCResult_DescriptionCreationErrorZ* operator &() const { return &self; } const LDKCResult_DescriptionCreationErrorZ* operator ->() const { return &self; } }; -class CResult_PaymentIdPaymentErrorZ { +class CResult_RoutingFeesDecodeErrorZ { private: - LDKCResult_PaymentIdPaymentErrorZ self; + LDKCResult_RoutingFeesDecodeErrorZ self; public: - CResult_PaymentIdPaymentErrorZ(const CResult_PaymentIdPaymentErrorZ&) = delete; - CResult_PaymentIdPaymentErrorZ(CResult_PaymentIdPaymentErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentIdPaymentErrorZ)); } - CResult_PaymentIdPaymentErrorZ(LDKCResult_PaymentIdPaymentErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentIdPaymentErrorZ)); } - operator LDKCResult_PaymentIdPaymentErrorZ() && { LDKCResult_PaymentIdPaymentErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentIdPaymentErrorZ)); return res; } - ~CResult_PaymentIdPaymentErrorZ() { CResult_PaymentIdPaymentErrorZ_free(self); } - CResult_PaymentIdPaymentErrorZ& operator=(CResult_PaymentIdPaymentErrorZ&& o) { CResult_PaymentIdPaymentErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentIdPaymentErrorZ)); return *this; } - LDKCResult_PaymentIdPaymentErrorZ* operator &() { return &self; } - LDKCResult_PaymentIdPaymentErrorZ* operator ->() { return &self; } - const LDKCResult_PaymentIdPaymentErrorZ* operator &() const { return &self; } - const LDKCResult_PaymentIdPaymentErrorZ* operator ->() const { return &self; } + CResult_RoutingFeesDecodeErrorZ(const CResult_RoutingFeesDecodeErrorZ&) = delete; + CResult_RoutingFeesDecodeErrorZ(CResult_RoutingFeesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); } + CResult_RoutingFeesDecodeErrorZ(LDKCResult_RoutingFeesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); } + operator LDKCResult_RoutingFeesDecodeErrorZ() && { LDKCResult_RoutingFeesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); return res; } + ~CResult_RoutingFeesDecodeErrorZ() { CResult_RoutingFeesDecodeErrorZ_free(self); } + CResult_RoutingFeesDecodeErrorZ& operator=(CResult_RoutingFeesDecodeErrorZ&& o) { CResult_RoutingFeesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); return *this; } + LDKCResult_RoutingFeesDecodeErrorZ* operator &() { return &self; } + LDKCResult_RoutingFeesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RoutingFeesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RoutingFeesDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { +private: + LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ self; +public: + CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ(const CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ&) = delete; + CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ(CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ)); } + CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ(LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ)); } + operator LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ() && { LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ)); return res; } + ~CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ() { CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(self); } + CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ& operator=(CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ&& o) { CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ)); return *this; } + LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ* operator &() { return &self; } + LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ* operator ->() const { return &self; } +}; +class CResult_PaymentRelayDecodeErrorZ { +private: + LDKCResult_PaymentRelayDecodeErrorZ self; +public: + CResult_PaymentRelayDecodeErrorZ(const CResult_PaymentRelayDecodeErrorZ&) = delete; + CResult_PaymentRelayDecodeErrorZ(CResult_PaymentRelayDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentRelayDecodeErrorZ)); } + CResult_PaymentRelayDecodeErrorZ(LDKCResult_PaymentRelayDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentRelayDecodeErrorZ)); } + operator LDKCResult_PaymentRelayDecodeErrorZ() && { LDKCResult_PaymentRelayDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentRelayDecodeErrorZ)); return res; } + ~CResult_PaymentRelayDecodeErrorZ() { CResult_PaymentRelayDecodeErrorZ_free(self); } + CResult_PaymentRelayDecodeErrorZ& operator=(CResult_PaymentRelayDecodeErrorZ&& o) { CResult_PaymentRelayDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentRelayDecodeErrorZ)); return *this; } + LDKCResult_PaymentRelayDecodeErrorZ* operator &() { return &self; } + LDKCResult_PaymentRelayDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PaymentRelayDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PaymentRelayDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { +private: + LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ self; +public: + CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ(const CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ&) = delete; + CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ(CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ)); } + CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ)); } + operator LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ() && { LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ)); return res; } + ~CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ() { CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(self); } + CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ& operator=(CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ&& o) { CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ)); return *this; } + LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* operator &() { return &self; } + LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* operator ->() const { return &self; } }; class CResult_QueryShortChannelIdsDecodeErrorZ { private: @@ -7278,6 +7669,21 @@ class CResult_QueryShortChannelIdsDecodeErrorZ { const LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator &() const { return &self; } const LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_VerifiedInvoiceRequestNoneZ { +private: + LDKCResult_VerifiedInvoiceRequestNoneZ self; +public: + CResult_VerifiedInvoiceRequestNoneZ(const CResult_VerifiedInvoiceRequestNoneZ&) = delete; + CResult_VerifiedInvoiceRequestNoneZ(CResult_VerifiedInvoiceRequestNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_VerifiedInvoiceRequestNoneZ)); } + CResult_VerifiedInvoiceRequestNoneZ(LDKCResult_VerifiedInvoiceRequestNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ)); } + operator LDKCResult_VerifiedInvoiceRequestNoneZ() && { LDKCResult_VerifiedInvoiceRequestNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ)); return res; } + ~CResult_VerifiedInvoiceRequestNoneZ() { CResult_VerifiedInvoiceRequestNoneZ_free(self); } + CResult_VerifiedInvoiceRequestNoneZ& operator=(CResult_VerifiedInvoiceRequestNoneZ&& o) { CResult_VerifiedInvoiceRequestNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_VerifiedInvoiceRequestNoneZ)); return *this; } + LDKCResult_VerifiedInvoiceRequestNoneZ* operator &() { return &self; } + LDKCResult_VerifiedInvoiceRequestNoneZ* operator ->() { return &self; } + const LDKCResult_VerifiedInvoiceRequestNoneZ* operator &() const { return &self; } + const LDKCResult_VerifiedInvoiceRequestNoneZ* operator ->() const { return &self; } +}; class CResult_UpdateAddHTLCDecodeErrorZ { private: LDKCResult_UpdateAddHTLCDecodeErrorZ self; @@ -7308,21 +7714,6 @@ class COption_MonitorEventZ { const LDKCOption_MonitorEventZ* operator &() const { return &self; } const LDKCOption_MonitorEventZ* operator ->() const { return &self; } }; -class COption_CVec_ChainHashZZ { -private: - LDKCOption_CVec_ChainHashZZ self; -public: - COption_CVec_ChainHashZZ(const COption_CVec_ChainHashZZ&) = delete; - COption_CVec_ChainHashZZ(COption_CVec_ChainHashZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_CVec_ChainHashZZ)); } - COption_CVec_ChainHashZZ(LDKCOption_CVec_ChainHashZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_CVec_ChainHashZZ)); } - operator LDKCOption_CVec_ChainHashZZ() && { LDKCOption_CVec_ChainHashZZ res = self; memset(&self, 0, sizeof(LDKCOption_CVec_ChainHashZZ)); return res; } - ~COption_CVec_ChainHashZZ() { COption_CVec_ChainHashZZ_free(self); } - COption_CVec_ChainHashZZ& operator=(COption_CVec_ChainHashZZ&& o) { COption_CVec_ChainHashZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_CVec_ChainHashZZ)); return *this; } - LDKCOption_CVec_ChainHashZZ* operator &() { return &self; } - LDKCOption_CVec_ChainHashZZ* operator ->() { return &self; } - const LDKCOption_CVec_ChainHashZZ* operator &() const { return &self; } - const LDKCOption_CVec_ChainHashZZ* operator ->() const { return &self; } -}; class COption_TypeZ { private: LDKCOption_TypeZ self; @@ -7353,20 +7744,20 @@ class CResult_COption_TypeZDecodeErrorZ { const LDKCResult_COption_TypeZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_TypeZDecodeErrorZ* operator ->() const { return &self; } }; -class COption_KeyPairZ { +class CResult_COption_PathFailureZDecodeErrorZ { private: - LDKCOption_KeyPairZ self; + LDKCResult_COption_PathFailureZDecodeErrorZ self; public: - COption_KeyPairZ(const COption_KeyPairZ&) = delete; - COption_KeyPairZ(COption_KeyPairZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_KeyPairZ)); } - COption_KeyPairZ(LDKCOption_KeyPairZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_KeyPairZ)); } - operator LDKCOption_KeyPairZ() && { LDKCOption_KeyPairZ res = self; memset(&self, 0, sizeof(LDKCOption_KeyPairZ)); return res; } - ~COption_KeyPairZ() { COption_KeyPairZ_free(self); } - COption_KeyPairZ& operator=(COption_KeyPairZ&& o) { COption_KeyPairZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_KeyPairZ)); return *this; } - LDKCOption_KeyPairZ* operator &() { return &self; } - LDKCOption_KeyPairZ* operator ->() { return &self; } - const LDKCOption_KeyPairZ* operator &() const { return &self; } - const LDKCOption_KeyPairZ* operator ->() const { return &self; } + CResult_COption_PathFailureZDecodeErrorZ(const CResult_COption_PathFailureZDecodeErrorZ&) = delete; + CResult_COption_PathFailureZDecodeErrorZ(CResult_COption_PathFailureZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_PathFailureZDecodeErrorZ)); } + CResult_COption_PathFailureZDecodeErrorZ(LDKCResult_COption_PathFailureZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ)); } + operator LDKCResult_COption_PathFailureZDecodeErrorZ() && { LDKCResult_COption_PathFailureZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ)); return res; } + ~CResult_COption_PathFailureZDecodeErrorZ() { CResult_COption_PathFailureZDecodeErrorZ_free(self); } + CResult_COption_PathFailureZDecodeErrorZ& operator=(CResult_COption_PathFailureZDecodeErrorZ&& o) { CResult_COption_PathFailureZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_PathFailureZDecodeErrorZ)); return *this; } + LDKCResult_COption_PathFailureZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_PathFailureZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_PathFailureZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_PathFailureZDecodeErrorZ* operator ->() const { return &self; } }; class CResult_Bolt11InvoiceSignOrCreationErrorZ { private: @@ -7383,21 +7774,6 @@ class CResult_Bolt11InvoiceSignOrCreationErrorZ { const LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* operator &() const { return &self; } const LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* operator ->() const { return &self; } }; -class COption_ScriptZ { -private: - LDKCOption_ScriptZ self; -public: - COption_ScriptZ(const COption_ScriptZ&) = delete; - COption_ScriptZ(COption_ScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_ScriptZ)); } - COption_ScriptZ(LDKCOption_ScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_ScriptZ)); } - operator LDKCOption_ScriptZ() && { LDKCOption_ScriptZ res = self; memset(&self, 0, sizeof(LDKCOption_ScriptZ)); return res; } - ~COption_ScriptZ() { COption_ScriptZ_free(self); } - COption_ScriptZ& operator=(COption_ScriptZ&& o) { COption_ScriptZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_ScriptZ)); return *this; } - LDKCOption_ScriptZ* operator &() { return &self; } - LDKCOption_ScriptZ* operator ->() { return &self; } - const LDKCOption_ScriptZ* operator &() const { return &self; } - const LDKCOption_ScriptZ* operator ->() const { return &self; } -}; class CResult_UpdateFailHTLCDecodeErrorZ { private: LDKCResult_UpdateFailHTLCDecodeErrorZ self; @@ -7413,20 +7789,20 @@ class CResult_UpdateFailHTLCDecodeErrorZ { const LDKCResult_UpdateFailHTLCDecodeErrorZ* operator &() const { return &self; } const LDKCResult_UpdateFailHTLCDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_COption_PathFailureZDecodeErrorZ { +class CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { private: - LDKCResult_COption_PathFailureZDecodeErrorZ self; + LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ self; public: - CResult_COption_PathFailureZDecodeErrorZ(const CResult_COption_PathFailureZDecodeErrorZ&) = delete; - CResult_COption_PathFailureZDecodeErrorZ(CResult_COption_PathFailureZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_PathFailureZDecodeErrorZ)); } - CResult_COption_PathFailureZDecodeErrorZ(LDKCResult_COption_PathFailureZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ)); } - operator LDKCResult_COption_PathFailureZDecodeErrorZ() && { LDKCResult_COption_PathFailureZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ)); return res; } - ~CResult_COption_PathFailureZDecodeErrorZ() { CResult_COption_PathFailureZDecodeErrorZ_free(self); } - CResult_COption_PathFailureZDecodeErrorZ& operator=(CResult_COption_PathFailureZDecodeErrorZ&& o) { CResult_COption_PathFailureZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_PathFailureZDecodeErrorZ)); return *this; } - LDKCResult_COption_PathFailureZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_PathFailureZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_PathFailureZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_PathFailureZDecodeErrorZ* operator ->() const { return &self; } + CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ(const CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ&) = delete; + CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ(CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ)); } + CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ(LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ)); } + operator LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ() && { LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ)); return res; } + ~CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ() { CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(self); } + CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ& operator=(CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ&& o) { CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ)); return *this; } + LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ* operator &() { return &self; } + LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ* operator ->() const { return &self; } }; class CResult_RevokeAndACKDecodeErrorZ { private: @@ -7458,6 +7834,21 @@ class CResult_SpendableOutputDescriptorDecodeErrorZ { const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator &() const { return &self; } const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator ->() const { return &self; } }; +class C2Tuple_PublicKeyCOption_SocketAddressZZ { +private: + LDKC2Tuple_PublicKeyCOption_SocketAddressZZ self; +public: + C2Tuple_PublicKeyCOption_SocketAddressZZ(const C2Tuple_PublicKeyCOption_SocketAddressZZ&) = delete; + C2Tuple_PublicKeyCOption_SocketAddressZZ(C2Tuple_PublicKeyCOption_SocketAddressZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PublicKeyCOption_SocketAddressZZ)); } + C2Tuple_PublicKeyCOption_SocketAddressZZ(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ)); } + operator LDKC2Tuple_PublicKeyCOption_SocketAddressZZ() && { LDKC2Tuple_PublicKeyCOption_SocketAddressZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ)); return res; } + ~C2Tuple_PublicKeyCOption_SocketAddressZZ() { C2Tuple_PublicKeyCOption_SocketAddressZZ_free(self); } + C2Tuple_PublicKeyCOption_SocketAddressZZ& operator=(C2Tuple_PublicKeyCOption_SocketAddressZZ&& o) { C2Tuple_PublicKeyCOption_SocketAddressZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PublicKeyCOption_SocketAddressZZ)); return *this; } + LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* operator &() { return &self; } + LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* operator ->() { return &self; } + const LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* operator &() const { return &self; } + const LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* operator ->() const { return &self; } +}; class CResult_UnsignedChannelUpdateDecodeErrorZ { private: LDKCResult_UnsignedChannelUpdateDecodeErrorZ self; @@ -7473,35 +7864,65 @@ class CResult_UnsignedChannelUpdateDecodeErrorZ { const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator &() const { return &self; } const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_u32ScriptZZ { -private: - LDKCVec_C2Tuple_u32ScriptZZ self; -public: - CVec_C2Tuple_u32ScriptZZ(const CVec_C2Tuple_u32ScriptZZ&) = delete; - CVec_C2Tuple_u32ScriptZZ(CVec_C2Tuple_u32ScriptZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_u32ScriptZZ)); } - CVec_C2Tuple_u32ScriptZZ(LDKCVec_C2Tuple_u32ScriptZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_u32ScriptZZ)); } - operator LDKCVec_C2Tuple_u32ScriptZZ() && { LDKCVec_C2Tuple_u32ScriptZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_u32ScriptZZ)); return res; } - ~CVec_C2Tuple_u32ScriptZZ() { CVec_C2Tuple_u32ScriptZZ_free(self); } - CVec_C2Tuple_u32ScriptZZ& operator=(CVec_C2Tuple_u32ScriptZZ&& o) { CVec_C2Tuple_u32ScriptZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_u32ScriptZZ)); return *this; } - LDKCVec_C2Tuple_u32ScriptZZ* operator &() { return &self; } - LDKCVec_C2Tuple_u32ScriptZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_u32ScriptZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_u32ScriptZZ* operator ->() const { return &self; } -}; -class CResult_InvoiceErrorDecodeErrorZ { -private: - LDKCResult_InvoiceErrorDecodeErrorZ self; -public: - CResult_InvoiceErrorDecodeErrorZ(const CResult_InvoiceErrorDecodeErrorZ&) = delete; - CResult_InvoiceErrorDecodeErrorZ(CResult_InvoiceErrorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceErrorDecodeErrorZ)); } - CResult_InvoiceErrorDecodeErrorZ(LDKCResult_InvoiceErrorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceErrorDecodeErrorZ)); } - operator LDKCResult_InvoiceErrorDecodeErrorZ() && { LDKCResult_InvoiceErrorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceErrorDecodeErrorZ)); return res; } - ~CResult_InvoiceErrorDecodeErrorZ() { CResult_InvoiceErrorDecodeErrorZ_free(self); } - CResult_InvoiceErrorDecodeErrorZ& operator=(CResult_InvoiceErrorDecodeErrorZ&& o) { CResult_InvoiceErrorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceErrorDecodeErrorZ)); return *this; } - LDKCResult_InvoiceErrorDecodeErrorZ* operator &() { return &self; } - LDKCResult_InvoiceErrorDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_InvoiceErrorDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_InvoiceErrorDecodeErrorZ* operator ->() const { return &self; } +class CResult_PayeePubKeySecp256k1ErrorZ { +private: + LDKCResult_PayeePubKeySecp256k1ErrorZ self; +public: + CResult_PayeePubKeySecp256k1ErrorZ(const CResult_PayeePubKeySecp256k1ErrorZ&) = delete; + CResult_PayeePubKeySecp256k1ErrorZ(CResult_PayeePubKeySecp256k1ErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PayeePubKeySecp256k1ErrorZ)); } + CResult_PayeePubKeySecp256k1ErrorZ(LDKCResult_PayeePubKeySecp256k1ErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ)); } + operator LDKCResult_PayeePubKeySecp256k1ErrorZ() && { LDKCResult_PayeePubKeySecp256k1ErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ)); return res; } + ~CResult_PayeePubKeySecp256k1ErrorZ() { CResult_PayeePubKeySecp256k1ErrorZ_free(self); } + CResult_PayeePubKeySecp256k1ErrorZ& operator=(CResult_PayeePubKeySecp256k1ErrorZ&& o) { CResult_PayeePubKeySecp256k1ErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PayeePubKeySecp256k1ErrorZ)); return *this; } + LDKCResult_PayeePubKeySecp256k1ErrorZ* operator &() { return &self; } + LDKCResult_PayeePubKeySecp256k1ErrorZ* operator ->() { return &self; } + const LDKCResult_PayeePubKeySecp256k1ErrorZ* operator &() const { return &self; } + const LDKCResult_PayeePubKeySecp256k1ErrorZ* operator ->() const { return &self; } +}; +class COption_BigEndianScalarZ { +private: + LDKCOption_BigEndianScalarZ self; +public: + COption_BigEndianScalarZ(const COption_BigEndianScalarZ&) = delete; + COption_BigEndianScalarZ(COption_BigEndianScalarZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_BigEndianScalarZ)); } + COption_BigEndianScalarZ(LDKCOption_BigEndianScalarZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_BigEndianScalarZ)); } + operator LDKCOption_BigEndianScalarZ() && { LDKCOption_BigEndianScalarZ res = self; memset(&self, 0, sizeof(LDKCOption_BigEndianScalarZ)); return res; } + ~COption_BigEndianScalarZ() { COption_BigEndianScalarZ_free(self); } + COption_BigEndianScalarZ& operator=(COption_BigEndianScalarZ&& o) { COption_BigEndianScalarZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_BigEndianScalarZ)); return *this; } + LDKCOption_BigEndianScalarZ* operator &() { return &self; } + LDKCOption_BigEndianScalarZ* operator ->() { return &self; } + const LDKCOption_BigEndianScalarZ* operator &() const { return &self; } + const LDKCOption_BigEndianScalarZ* operator ->() const { return &self; } +}; +class CResult_PublicKeySecp256k1ErrorZ { +private: + LDKCResult_PublicKeySecp256k1ErrorZ self; +public: + CResult_PublicKeySecp256k1ErrorZ(const CResult_PublicKeySecp256k1ErrorZ&) = delete; + CResult_PublicKeySecp256k1ErrorZ(CResult_PublicKeySecp256k1ErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PublicKeySecp256k1ErrorZ)); } + CResult_PublicKeySecp256k1ErrorZ(LDKCResult_PublicKeySecp256k1ErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PublicKeySecp256k1ErrorZ)); } + operator LDKCResult_PublicKeySecp256k1ErrorZ() && { LDKCResult_PublicKeySecp256k1ErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PublicKeySecp256k1ErrorZ)); return res; } + ~CResult_PublicKeySecp256k1ErrorZ() { CResult_PublicKeySecp256k1ErrorZ_free(self); } + CResult_PublicKeySecp256k1ErrorZ& operator=(CResult_PublicKeySecp256k1ErrorZ&& o) { CResult_PublicKeySecp256k1ErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PublicKeySecp256k1ErrorZ)); return *this; } + LDKCResult_PublicKeySecp256k1ErrorZ* operator &() { return &self; } + LDKCResult_PublicKeySecp256k1ErrorZ* operator ->() { return &self; } + const LDKCResult_PublicKeySecp256k1ErrorZ* operator &() const { return &self; } + const LDKCResult_PublicKeySecp256k1ErrorZ* operator ->() const { return &self; } +}; +class CResult_CVec_ECDSASignatureZNoneZ { +private: + LDKCResult_CVec_ECDSASignatureZNoneZ self; +public: + CResult_CVec_ECDSASignatureZNoneZ(const CResult_CVec_ECDSASignatureZNoneZ&) = delete; + CResult_CVec_ECDSASignatureZNoneZ(CResult_CVec_ECDSASignatureZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_ECDSASignatureZNoneZ)); } + CResult_CVec_ECDSASignatureZNoneZ(LDKCResult_CVec_ECDSASignatureZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ)); } + operator LDKCResult_CVec_ECDSASignatureZNoneZ() && { LDKCResult_CVec_ECDSASignatureZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ)); return res; } + ~CResult_CVec_ECDSASignatureZNoneZ() { CResult_CVec_ECDSASignatureZNoneZ_free(self); } + CResult_CVec_ECDSASignatureZNoneZ& operator=(CResult_CVec_ECDSASignatureZNoneZ&& o) { CResult_CVec_ECDSASignatureZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_ECDSASignatureZNoneZ)); return *this; } + LDKCResult_CVec_ECDSASignatureZNoneZ* operator &() { return &self; } + LDKCResult_CVec_ECDSASignatureZNoneZ* operator ->() { return &self; } + const LDKCResult_CVec_ECDSASignatureZNoneZ* operator &() const { return &self; } + const LDKCResult_CVec_ECDSASignatureZNoneZ* operator ->() const { return &self; } }; class CVec_BlindedHopZ { private: @@ -7518,21 +7939,6 @@ class CVec_BlindedHopZ { const LDKCVec_BlindedHopZ* operator &() const { return &self; } const LDKCVec_BlindedHopZ* operator ->() const { return &self; } }; -class CResult_PaymentHashPaymentSendFailureZ { -private: - LDKCResult_PaymentHashPaymentSendFailureZ self; -public: - CResult_PaymentHashPaymentSendFailureZ(const CResult_PaymentHashPaymentSendFailureZ&) = delete; - CResult_PaymentHashPaymentSendFailureZ(CResult_PaymentHashPaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentHashPaymentSendFailureZ)); } - CResult_PaymentHashPaymentSendFailureZ(LDKCResult_PaymentHashPaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentHashPaymentSendFailureZ)); } - operator LDKCResult_PaymentHashPaymentSendFailureZ() && { LDKCResult_PaymentHashPaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentHashPaymentSendFailureZ)); return res; } - ~CResult_PaymentHashPaymentSendFailureZ() { CResult_PaymentHashPaymentSendFailureZ_free(self); } - CResult_PaymentHashPaymentSendFailureZ& operator=(CResult_PaymentHashPaymentSendFailureZ&& o) { CResult_PaymentHashPaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentHashPaymentSendFailureZ)); return *this; } - LDKCResult_PaymentHashPaymentSendFailureZ* operator &() { return &self; } - LDKCResult_PaymentHashPaymentSendFailureZ* operator ->() { return &self; } - const LDKCResult_PaymentHashPaymentSendFailureZ* operator &() const { return &self; } - const LDKCResult_PaymentHashPaymentSendFailureZ* operator ->() const { return &self; } -}; class CResult_COption_ClosureReasonZDecodeErrorZ { private: LDKCResult_COption_ClosureReasonZDecodeErrorZ self; @@ -7548,6 +7954,21 @@ class CResult_COption_ClosureReasonZDecodeErrorZ { const LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_InvoiceErrorDecodeErrorZ { +private: + LDKCResult_InvoiceErrorDecodeErrorZ self; +public: + CResult_InvoiceErrorDecodeErrorZ(const CResult_InvoiceErrorDecodeErrorZ&) = delete; + CResult_InvoiceErrorDecodeErrorZ(CResult_InvoiceErrorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceErrorDecodeErrorZ)); } + CResult_InvoiceErrorDecodeErrorZ(LDKCResult_InvoiceErrorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceErrorDecodeErrorZ)); } + operator LDKCResult_InvoiceErrorDecodeErrorZ() && { LDKCResult_InvoiceErrorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceErrorDecodeErrorZ)); return res; } + ~CResult_InvoiceErrorDecodeErrorZ() { CResult_InvoiceErrorDecodeErrorZ_free(self); } + CResult_InvoiceErrorDecodeErrorZ& operator=(CResult_InvoiceErrorDecodeErrorZ&& o) { CResult_InvoiceErrorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceErrorDecodeErrorZ)); return *this; } + LDKCResult_InvoiceErrorDecodeErrorZ* operator &() { return &self; } + LDKCResult_InvoiceErrorDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InvoiceErrorDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InvoiceErrorDecodeErrorZ* operator ->() const { return &self; } +}; class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { private: LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ self; @@ -7623,6 +8044,21 @@ class CVec_UpdateFulfillHTLCZ { const LDKCVec_UpdateFulfillHTLCZ* operator &() const { return &self; } const LDKCVec_UpdateFulfillHTLCZ* operator ->() const { return &self; } }; +class CVec_C2Tuple_u32CVec_u8ZZZ { +private: + LDKCVec_C2Tuple_u32CVec_u8ZZZ self; +public: + CVec_C2Tuple_u32CVec_u8ZZZ(const CVec_C2Tuple_u32CVec_u8ZZZ&) = delete; + CVec_C2Tuple_u32CVec_u8ZZZ(CVec_C2Tuple_u32CVec_u8ZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_u32CVec_u8ZZZ)); } + CVec_C2Tuple_u32CVec_u8ZZZ(LDKCVec_C2Tuple_u32CVec_u8ZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_u32CVec_u8ZZZ)); } + operator LDKCVec_C2Tuple_u32CVec_u8ZZZ() && { LDKCVec_C2Tuple_u32CVec_u8ZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_u32CVec_u8ZZZ)); return res; } + ~CVec_C2Tuple_u32CVec_u8ZZZ() { CVec_C2Tuple_u32CVec_u8ZZZ_free(self); } + CVec_C2Tuple_u32CVec_u8ZZZ& operator=(CVec_C2Tuple_u32CVec_u8ZZZ&& o) { CVec_C2Tuple_u32CVec_u8ZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_u32CVec_u8ZZZ)); return *this; } + LDKCVec_C2Tuple_u32CVec_u8ZZZ* operator &() { return &self; } + LDKCVec_C2Tuple_u32CVec_u8ZZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_u32CVec_u8ZZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_u32CVec_u8ZZZ* operator ->() const { return &self; } +}; class CResult_AnnouncementSignaturesDecodeErrorZ { private: LDKCResult_AnnouncementSignaturesDecodeErrorZ self; @@ -7668,6 +8104,21 @@ class CResult_TxCompleteDecodeErrorZ { const LDKCResult_TxCompleteDecodeErrorZ* operator &() const { return &self; } const LDKCResult_TxCompleteDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_StrSecp256k1ErrorZ { +private: + LDKCResult_StrSecp256k1ErrorZ self; +public: + CResult_StrSecp256k1ErrorZ(const CResult_StrSecp256k1ErrorZ&) = delete; + CResult_StrSecp256k1ErrorZ(CResult_StrSecp256k1ErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StrSecp256k1ErrorZ)); } + CResult_StrSecp256k1ErrorZ(LDKCResult_StrSecp256k1ErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StrSecp256k1ErrorZ)); } + operator LDKCResult_StrSecp256k1ErrorZ() && { LDKCResult_StrSecp256k1ErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StrSecp256k1ErrorZ)); return res; } + ~CResult_StrSecp256k1ErrorZ() { CResult_StrSecp256k1ErrorZ_free(self); } + CResult_StrSecp256k1ErrorZ& operator=(CResult_StrSecp256k1ErrorZ&& o) { CResult_StrSecp256k1ErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StrSecp256k1ErrorZ)); return *this; } + LDKCResult_StrSecp256k1ErrorZ* operator &() { return &self; } + LDKCResult_StrSecp256k1ErrorZ* operator ->() { return &self; } + const LDKCResult_StrSecp256k1ErrorZ* operator &() const { return &self; } + const LDKCResult_StrSecp256k1ErrorZ* operator ->() const { return &self; } +}; class CResult_NodeFeaturesDecodeErrorZ { private: LDKCResult_NodeFeaturesDecodeErrorZ self; @@ -7743,21 +8194,6 @@ class CResult_ReplyShortChannelIdsEndDecodeErrorZ { const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() const { return &self; } }; -class COption_ScalarZ { -private: - LDKCOption_ScalarZ self; -public: - COption_ScalarZ(const COption_ScalarZ&) = delete; - COption_ScalarZ(COption_ScalarZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_ScalarZ)); } - COption_ScalarZ(LDKCOption_ScalarZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_ScalarZ)); } - operator LDKCOption_ScalarZ() && { LDKCOption_ScalarZ res = self; memset(&self, 0, sizeof(LDKCOption_ScalarZ)); return res; } - ~COption_ScalarZ() { COption_ScalarZ_free(self); } - COption_ScalarZ& operator=(COption_ScalarZ&& o) { COption_ScalarZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_ScalarZ)); return *this; } - LDKCOption_ScalarZ* operator &() { return &self; } - LDKCOption_ScalarZ* operator ->() { return &self; } - const LDKCOption_ScalarZ* operator &() const { return &self; } - const LDKCOption_ScalarZ* operator ->() const { return &self; } -}; class COption_PathFailureZ { private: LDKCOption_PathFailureZ self; @@ -7773,6 +8209,21 @@ class COption_PathFailureZ { const LDKCOption_PathFailureZ* operator &() const { return &self; } const LDKCOption_PathFailureZ* operator ->() const { return &self; } }; +class CVec_ECDSASignatureZ { +private: + LDKCVec_ECDSASignatureZ self; +public: + CVec_ECDSASignatureZ(const CVec_ECDSASignatureZ&) = delete; + CVec_ECDSASignatureZ(CVec_ECDSASignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ECDSASignatureZ)); } + CVec_ECDSASignatureZ(LDKCVec_ECDSASignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ECDSASignatureZ)); } + operator LDKCVec_ECDSASignatureZ() && { LDKCVec_ECDSASignatureZ res = self; memset(&self, 0, sizeof(LDKCVec_ECDSASignatureZ)); return res; } + ~CVec_ECDSASignatureZ() { CVec_ECDSASignatureZ_free(self); } + CVec_ECDSASignatureZ& operator=(CVec_ECDSASignatureZ&& o) { CVec_ECDSASignatureZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ECDSASignatureZ)); return *this; } + LDKCVec_ECDSASignatureZ* operator &() { return &self; } + LDKCVec_ECDSASignatureZ* operator ->() { return &self; } + const LDKCVec_ECDSASignatureZ* operator &() const { return &self; } + const LDKCVec_ECDSASignatureZ* operator ->() const { return &self; } +}; class CResult_ChannelUpdateInfoDecodeErrorZ { private: LDKCResult_ChannelUpdateInfoDecodeErrorZ self; @@ -7788,21 +8239,6 @@ class CResult_ChannelUpdateInfoDecodeErrorZ { const LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { -private: - LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ self; -public: - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&) = delete; - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); } - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); } - operator LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return res; } - ~CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); } - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return *this; } - LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() { return &self; } - LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() const { return &self; } -}; class CVec_UpdateFailHTLCZ { private: LDKCVec_UpdateFailHTLCZ self; @@ -7863,6 +8299,21 @@ class CVec_SpendableOutputDescriptorZ { const LDKCVec_SpendableOutputDescriptorZ* operator &() const { return &self; } const LDKCVec_SpendableOutputDescriptorZ* operator ->() const { return &self; } }; +class C2Tuple_OutPointCVec_u8ZZ { +private: + LDKC2Tuple_OutPointCVec_u8ZZ self; +public: + C2Tuple_OutPointCVec_u8ZZ(const C2Tuple_OutPointCVec_u8ZZ&) = delete; + C2Tuple_OutPointCVec_u8ZZ(C2Tuple_OutPointCVec_u8ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OutPointCVec_u8ZZ)); } + C2Tuple_OutPointCVec_u8ZZ(LDKC2Tuple_OutPointCVec_u8ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OutPointCVec_u8ZZ)); } + operator LDKC2Tuple_OutPointCVec_u8ZZ() && { LDKC2Tuple_OutPointCVec_u8ZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OutPointCVec_u8ZZ)); return res; } + ~C2Tuple_OutPointCVec_u8ZZ() { C2Tuple_OutPointCVec_u8ZZ_free(self); } + C2Tuple_OutPointCVec_u8ZZ& operator=(C2Tuple_OutPointCVec_u8ZZ&& o) { C2Tuple_OutPointCVec_u8ZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OutPointCVec_u8ZZ)); return *this; } + LDKC2Tuple_OutPointCVec_u8ZZ* operator &() { return &self; } + LDKC2Tuple_OutPointCVec_u8ZZ* operator ->() { return &self; } + const LDKC2Tuple_OutPointCVec_u8ZZ* operator &() const { return &self; } + const LDKC2Tuple_OutPointCVec_u8ZZ* operator ->() const { return &self; } +}; class COption_C2Tuple_u64u64ZZ { private: LDKCOption_C2Tuple_u64u64ZZ self; @@ -7908,36 +8359,6 @@ class CResult_HTLCUpdateDecodeErrorZ { const LDKCResult_HTLCUpdateDecodeErrorZ* operator &() const { return &self; } const LDKCResult_HTLCUpdateDecodeErrorZ* operator ->() const { return &self; } }; -class C2Tuple_SignatureCVec_SignatureZZ { -private: - LDKC2Tuple_SignatureCVec_SignatureZZ self; -public: - C2Tuple_SignatureCVec_SignatureZZ(const C2Tuple_SignatureCVec_SignatureZZ&) = delete; - C2Tuple_SignatureCVec_SignatureZZ(C2Tuple_SignatureCVec_SignatureZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_SignatureCVec_SignatureZZ)); } - C2Tuple_SignatureCVec_SignatureZZ(LDKC2Tuple_SignatureCVec_SignatureZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ)); } - operator LDKC2Tuple_SignatureCVec_SignatureZZ() && { LDKC2Tuple_SignatureCVec_SignatureZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ)); return res; } - ~C2Tuple_SignatureCVec_SignatureZZ() { C2Tuple_SignatureCVec_SignatureZZ_free(self); } - C2Tuple_SignatureCVec_SignatureZZ& operator=(C2Tuple_SignatureCVec_SignatureZZ&& o) { C2Tuple_SignatureCVec_SignatureZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_SignatureCVec_SignatureZZ)); return *this; } - LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() { return &self; } - LDKC2Tuple_SignatureCVec_SignatureZZ* operator ->() { return &self; } - const LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() const { return &self; } - const LDKC2Tuple_SignatureCVec_SignatureZZ* operator ->() const { return &self; } -}; -class C2Tuple_PartiallySignedTransactionusizeZ { -private: - LDKC2Tuple_PartiallySignedTransactionusizeZ self; -public: - C2Tuple_PartiallySignedTransactionusizeZ(const C2Tuple_PartiallySignedTransactionusizeZ&) = delete; - C2Tuple_PartiallySignedTransactionusizeZ(C2Tuple_PartiallySignedTransactionusizeZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PartiallySignedTransactionusizeZ)); } - C2Tuple_PartiallySignedTransactionusizeZ(LDKC2Tuple_PartiallySignedTransactionusizeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ)); } - operator LDKC2Tuple_PartiallySignedTransactionusizeZ() && { LDKC2Tuple_PartiallySignedTransactionusizeZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ)); return res; } - ~C2Tuple_PartiallySignedTransactionusizeZ() { C2Tuple_PartiallySignedTransactionusizeZ_free(self); } - C2Tuple_PartiallySignedTransactionusizeZ& operator=(C2Tuple_PartiallySignedTransactionusizeZ&& o) { C2Tuple_PartiallySignedTransactionusizeZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PartiallySignedTransactionusizeZ)); return *this; } - LDKC2Tuple_PartiallySignedTransactionusizeZ* operator &() { return &self; } - LDKC2Tuple_PartiallySignedTransactionusizeZ* operator ->() { return &self; } - const LDKC2Tuple_PartiallySignedTransactionusizeZ* operator &() const { return &self; } - const LDKC2Tuple_PartiallySignedTransactionusizeZ* operator ->() const { return &self; } -}; class CResult_TxAddInputDecodeErrorZ { private: LDKCResult_TxAddInputDecodeErrorZ self; @@ -7953,20 +8374,20 @@ class CResult_TxAddInputDecodeErrorZ { const LDKCResult_TxAddInputDecodeErrorZ* operator &() const { return &self; } const LDKCResult_TxAddInputDecodeErrorZ* operator ->() const { return &self; } }; -class COption_WriteableScoreZ { +class CVec_OutPointZ { private: - LDKCOption_WriteableScoreZ self; + LDKCVec_OutPointZ self; public: - COption_WriteableScoreZ(const COption_WriteableScoreZ&) = delete; - COption_WriteableScoreZ(COption_WriteableScoreZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_WriteableScoreZ)); } - COption_WriteableScoreZ(LDKCOption_WriteableScoreZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_WriteableScoreZ)); } - operator LDKCOption_WriteableScoreZ() && { LDKCOption_WriteableScoreZ res = self; memset(&self, 0, sizeof(LDKCOption_WriteableScoreZ)); return res; } - ~COption_WriteableScoreZ() { COption_WriteableScoreZ_free(self); } - COption_WriteableScoreZ& operator=(COption_WriteableScoreZ&& o) { COption_WriteableScoreZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_WriteableScoreZ)); return *this; } - LDKCOption_WriteableScoreZ* operator &() { return &self; } - LDKCOption_WriteableScoreZ* operator ->() { return &self; } - const LDKCOption_WriteableScoreZ* operator &() const { return &self; } - const LDKCOption_WriteableScoreZ* operator ->() const { return &self; } + CVec_OutPointZ(const CVec_OutPointZ&) = delete; + CVec_OutPointZ(CVec_OutPointZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_OutPointZ)); } + CVec_OutPointZ(LDKCVec_OutPointZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_OutPointZ)); } + operator LDKCVec_OutPointZ() && { LDKCVec_OutPointZ res = self; memset(&self, 0, sizeof(LDKCVec_OutPointZ)); return res; } + ~CVec_OutPointZ() { CVec_OutPointZ_free(self); } + CVec_OutPointZ& operator=(CVec_OutPointZ&& o) { CVec_OutPointZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_OutPointZ)); return *this; } + LDKCVec_OutPointZ* operator &() { return &self; } + LDKCVec_OutPointZ* operator ->() { return &self; } + const LDKCVec_OutPointZ* operator &() const { return &self; } + const LDKCVec_OutPointZ* operator ->() const { return &self; } }; class CResult_TxInitRbfDecodeErrorZ { private: @@ -7983,20 +8404,35 @@ class CResult_TxInitRbfDecodeErrorZ { const LDKCResult_TxInitRbfDecodeErrorZ* operator &() const { return &self; } const LDKCResult_TxInitRbfDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_OutPointZ { +class COption_WriteableScoreZ { private: - LDKCVec_OutPointZ self; + LDKCOption_WriteableScoreZ self; public: - CVec_OutPointZ(const CVec_OutPointZ&) = delete; - CVec_OutPointZ(CVec_OutPointZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_OutPointZ)); } - CVec_OutPointZ(LDKCVec_OutPointZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_OutPointZ)); } - operator LDKCVec_OutPointZ() && { LDKCVec_OutPointZ res = self; memset(&self, 0, sizeof(LDKCVec_OutPointZ)); return res; } - ~CVec_OutPointZ() { CVec_OutPointZ_free(self); } - CVec_OutPointZ& operator=(CVec_OutPointZ&& o) { CVec_OutPointZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_OutPointZ)); return *this; } - LDKCVec_OutPointZ* operator &() { return &self; } - LDKCVec_OutPointZ* operator ->() { return &self; } - const LDKCVec_OutPointZ* operator &() const { return &self; } - const LDKCVec_OutPointZ* operator ->() const { return &self; } + COption_WriteableScoreZ(const COption_WriteableScoreZ&) = delete; + COption_WriteableScoreZ(COption_WriteableScoreZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_WriteableScoreZ)); } + COption_WriteableScoreZ(LDKCOption_WriteableScoreZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_WriteableScoreZ)); } + operator LDKCOption_WriteableScoreZ() && { LDKCOption_WriteableScoreZ res = self; memset(&self, 0, sizeof(LDKCOption_WriteableScoreZ)); return res; } + ~COption_WriteableScoreZ() { COption_WriteableScoreZ_free(self); } + COption_WriteableScoreZ& operator=(COption_WriteableScoreZ&& o) { COption_WriteableScoreZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_WriteableScoreZ)); return *this; } + LDKCOption_WriteableScoreZ* operator &() { return &self; } + LDKCOption_WriteableScoreZ* operator ->() { return &self; } + const LDKCOption_WriteableScoreZ* operator &() const { return &self; } + const LDKCOption_WriteableScoreZ* operator ->() const { return &self; } +}; +class CVec_StrZ { +private: + LDKCVec_StrZ self; +public: + CVec_StrZ(const CVec_StrZ&) = delete; + CVec_StrZ(CVec_StrZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_StrZ)); } + CVec_StrZ(LDKCVec_StrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_StrZ)); } + operator LDKCVec_StrZ() && { LDKCVec_StrZ res = self; memset(&self, 0, sizeof(LDKCVec_StrZ)); return res; } + ~CVec_StrZ() { CVec_StrZ_free(self); } + CVec_StrZ& operator=(CVec_StrZ&& o) { CVec_StrZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_StrZ)); return *this; } + LDKCVec_StrZ* operator &() { return &self; } + LDKCVec_StrZ* operator ->() { return &self; } + const LDKCVec_StrZ* operator &() const { return &self; } + const LDKCVec_StrZ* operator ->() const { return &self; } }; class CResult_PositiveTimestampCreationErrorZ { private: @@ -8013,21 +8449,6 @@ class CResult_PositiveTimestampCreationErrorZ { const LDKCResult_PositiveTimestampCreationErrorZ* operator &() const { return &self; } const LDKCResult_PositiveTimestampCreationErrorZ* operator ->() const { return &self; } }; -class C2Tuple__u168_u168Z { -private: - LDKC2Tuple__u168_u168Z self; -public: - C2Tuple__u168_u168Z(const C2Tuple__u168_u168Z&) = delete; - C2Tuple__u168_u168Z(C2Tuple__u168_u168Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple__u168_u168Z)); } - C2Tuple__u168_u168Z(LDKC2Tuple__u168_u168Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple__u168_u168Z)); } - operator LDKC2Tuple__u168_u168Z() && { LDKC2Tuple__u168_u168Z res = self; memset(&self, 0, sizeof(LDKC2Tuple__u168_u168Z)); return res; } - ~C2Tuple__u168_u168Z() { C2Tuple__u168_u168Z_free(self); } - C2Tuple__u168_u168Z& operator=(C2Tuple__u168_u168Z&& o) { C2Tuple__u168_u168Z_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple__u168_u168Z)); return *this; } - LDKC2Tuple__u168_u168Z* operator &() { return &self; } - LDKC2Tuple__u168_u168Z* operator ->() { return &self; } - const LDKC2Tuple__u168_u168Z* operator &() const { return &self; } - const LDKC2Tuple__u168_u168Z* operator ->() const { return &self; } -}; class CResult_ChannelMonitorUpdateDecodeErrorZ { private: LDKCResult_ChannelMonitorUpdateDecodeErrorZ self; @@ -8073,36 +8494,6 @@ class CResult_ReplyChannelRangeDecodeErrorZ { const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() const { return &self; } }; -class COption_PaymentPreimageZ { -private: - LDKCOption_PaymentPreimageZ self; -public: - COption_PaymentPreimageZ(const COption_PaymentPreimageZ&) = delete; - COption_PaymentPreimageZ(COption_PaymentPreimageZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_PaymentPreimageZ)); } - COption_PaymentPreimageZ(LDKCOption_PaymentPreimageZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_PaymentPreimageZ)); } - operator LDKCOption_PaymentPreimageZ() && { LDKCOption_PaymentPreimageZ res = self; memset(&self, 0, sizeof(LDKCOption_PaymentPreimageZ)); return res; } - ~COption_PaymentPreimageZ() { COption_PaymentPreimageZ_free(self); } - COption_PaymentPreimageZ& operator=(COption_PaymentPreimageZ&& o) { COption_PaymentPreimageZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_PaymentPreimageZ)); return *this; } - LDKCOption_PaymentPreimageZ* operator &() { return &self; } - LDKCOption_PaymentPreimageZ* operator ->() { return &self; } - const LDKCOption_PaymentPreimageZ* operator &() const { return &self; } - const LDKCOption_PaymentPreimageZ* operator ->() const { return &self; } -}; -class CResult_NetAddressDecodeErrorZ { -private: - LDKCResult_NetAddressDecodeErrorZ self; -public: - CResult_NetAddressDecodeErrorZ(const CResult_NetAddressDecodeErrorZ&) = delete; - CResult_NetAddressDecodeErrorZ(CResult_NetAddressDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NetAddressDecodeErrorZ)); } - CResult_NetAddressDecodeErrorZ(LDKCResult_NetAddressDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NetAddressDecodeErrorZ)); } - operator LDKCResult_NetAddressDecodeErrorZ() && { LDKCResult_NetAddressDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NetAddressDecodeErrorZ)); return res; } - ~CResult_NetAddressDecodeErrorZ() { CResult_NetAddressDecodeErrorZ_free(self); } - CResult_NetAddressDecodeErrorZ& operator=(CResult_NetAddressDecodeErrorZ&& o) { CResult_NetAddressDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NetAddressDecodeErrorZ)); return *this; } - LDKCResult_NetAddressDecodeErrorZ* operator &() { return &self; } - LDKCResult_NetAddressDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NetAddressDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NetAddressDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_UnsignedNodeAnnouncementDecodeErrorZ { private: LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ self; @@ -8118,6 +8509,36 @@ class CResult_UnsignedNodeAnnouncementDecodeErrorZ { const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator &() const { return &self; } const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_TrustedClosingTransactionNoneZ { +private: + LDKCResult_TrustedClosingTransactionNoneZ self; +public: + CResult_TrustedClosingTransactionNoneZ(const CResult_TrustedClosingTransactionNoneZ&) = delete; + CResult_TrustedClosingTransactionNoneZ(CResult_TrustedClosingTransactionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TrustedClosingTransactionNoneZ)); } + CResult_TrustedClosingTransactionNoneZ(LDKCResult_TrustedClosingTransactionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TrustedClosingTransactionNoneZ)); } + operator LDKCResult_TrustedClosingTransactionNoneZ() && { LDKCResult_TrustedClosingTransactionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_TrustedClosingTransactionNoneZ)); return res; } + ~CResult_TrustedClosingTransactionNoneZ() { CResult_TrustedClosingTransactionNoneZ_free(self); } + CResult_TrustedClosingTransactionNoneZ& operator=(CResult_TrustedClosingTransactionNoneZ&& o) { CResult_TrustedClosingTransactionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TrustedClosingTransactionNoneZ)); return *this; } + LDKCResult_TrustedClosingTransactionNoneZ* operator &() { return &self; } + LDKCResult_TrustedClosingTransactionNoneZ* operator ->() { return &self; } + const LDKCResult_TrustedClosingTransactionNoneZ* operator &() const { return &self; } + const LDKCResult_TrustedClosingTransactionNoneZ* operator ->() const { return &self; } +}; +class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { +private: + LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ self; +public: + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ(const CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ&) = delete; + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ)); } + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ)); } + operator LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ() && { LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ)); return res; } + ~CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ() { CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(self); } + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ& operator=(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ&& o) { CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ)); return *this; } + LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* operator &() { return &self; } + LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* operator ->() const { return &self; } +}; class C2Tuple_PublicKeyTypeZ { private: LDKC2Tuple_PublicKeyTypeZ self; @@ -8163,21 +8584,6 @@ class CResult_ChannelReestablishDecodeErrorZ { const LDKCResult_ChannelReestablishDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelReestablishDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_ScriptNoneZ { -private: - LDKCResult_ScriptNoneZ self; -public: - CResult_ScriptNoneZ(const CResult_ScriptNoneZ&) = delete; - CResult_ScriptNoneZ(CResult_ScriptNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ScriptNoneZ)); } - CResult_ScriptNoneZ(LDKCResult_ScriptNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ScriptNoneZ)); } - operator LDKCResult_ScriptNoneZ() && { LDKCResult_ScriptNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_ScriptNoneZ)); return res; } - ~CResult_ScriptNoneZ() { CResult_ScriptNoneZ_free(self); } - CResult_ScriptNoneZ& operator=(CResult_ScriptNoneZ&& o) { CResult_ScriptNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ScriptNoneZ)); return *this; } - LDKCResult_ScriptNoneZ* operator &() { return &self; } - LDKCResult_ScriptNoneZ* operator ->() { return &self; } - const LDKCResult_ScriptNoneZ* operator &() const { return &self; } - const LDKCResult_ScriptNoneZ* operator ->() const { return &self; } -}; class CResult_OnionMessageDecodeErrorZ { private: LDKCResult_OnionMessageDecodeErrorZ self; @@ -8193,20 +8599,35 @@ class CResult_OnionMessageDecodeErrorZ { const LDKCResult_OnionMessageDecodeErrorZ* operator &() const { return &self; } const LDKCResult_OnionMessageDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_TrustedClosingTransactionNoneZ { +class CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ { private: - LDKCResult_TrustedClosingTransactionNoneZ self; + LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ self; public: - CResult_TrustedClosingTransactionNoneZ(const CResult_TrustedClosingTransactionNoneZ&) = delete; - CResult_TrustedClosingTransactionNoneZ(CResult_TrustedClosingTransactionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TrustedClosingTransactionNoneZ)); } - CResult_TrustedClosingTransactionNoneZ(LDKCResult_TrustedClosingTransactionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TrustedClosingTransactionNoneZ)); } - operator LDKCResult_TrustedClosingTransactionNoneZ() && { LDKCResult_TrustedClosingTransactionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_TrustedClosingTransactionNoneZ)); return res; } - ~CResult_TrustedClosingTransactionNoneZ() { CResult_TrustedClosingTransactionNoneZ_free(self); } - CResult_TrustedClosingTransactionNoneZ& operator=(CResult_TrustedClosingTransactionNoneZ&& o) { CResult_TrustedClosingTransactionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TrustedClosingTransactionNoneZ)); return *this; } - LDKCResult_TrustedClosingTransactionNoneZ* operator &() { return &self; } - LDKCResult_TrustedClosingTransactionNoneZ* operator ->() { return &self; } - const LDKCResult_TrustedClosingTransactionNoneZ* operator &() const { return &self; } - const LDKCResult_TrustedClosingTransactionNoneZ* operator ->() const { return &self; } + CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ(const CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ&) = delete; + CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ(CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ)); } + CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ(LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ)); } + operator LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ() && { LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ)); return res; } + ~CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ() { CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(self); } + CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ& operator=(CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ&& o) { CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ)); return *this; } + LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ* operator &() { return &self; } + LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ* operator ->() const { return &self; } +}; +class CResult_C2Tuple_CVec_u8ZusizeZNoneZ { +private: + LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ self; +public: + CResult_C2Tuple_CVec_u8ZusizeZNoneZ(const CResult_C2Tuple_CVec_u8ZusizeZNoneZ&) = delete; + CResult_C2Tuple_CVec_u8ZusizeZNoneZ(CResult_C2Tuple_CVec_u8ZusizeZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_CVec_u8ZusizeZNoneZ)); } + CResult_C2Tuple_CVec_u8ZusizeZNoneZ(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ)); } + operator LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ() && { LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ)); return res; } + ~CResult_C2Tuple_CVec_u8ZusizeZNoneZ() { CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(self); } + CResult_C2Tuple_CVec_u8ZusizeZNoneZ& operator=(CResult_C2Tuple_CVec_u8ZusizeZNoneZ&& o) { CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_CVec_u8ZusizeZNoneZ)); return *this; } + LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* operator &() { return &self; } + LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* operator ->() const { return &self; } }; class CResult_Bolt11InvoiceParseOrSemanticErrorZ { private: @@ -8283,21 +8704,6 @@ class CResult_BlindedHopFeaturesDecodeErrorZ { const LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator &() const { return &self; } const LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator ->() const { return &self; } }; -class COption_PackedLockTimeZ { -private: - LDKCOption_PackedLockTimeZ self; -public: - COption_PackedLockTimeZ(const COption_PackedLockTimeZ&) = delete; - COption_PackedLockTimeZ(COption_PackedLockTimeZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_PackedLockTimeZ)); } - COption_PackedLockTimeZ(LDKCOption_PackedLockTimeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_PackedLockTimeZ)); } - operator LDKCOption_PackedLockTimeZ() && { LDKCOption_PackedLockTimeZ res = self; memset(&self, 0, sizeof(LDKCOption_PackedLockTimeZ)); return res; } - ~COption_PackedLockTimeZ() { COption_PackedLockTimeZ_free(self); } - COption_PackedLockTimeZ& operator=(COption_PackedLockTimeZ&& o) { COption_PackedLockTimeZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_PackedLockTimeZ)); return *this; } - LDKCOption_PackedLockTimeZ* operator &() { return &self; } - LDKCOption_PackedLockTimeZ* operator ->() { return &self; } - const LDKCOption_PackedLockTimeZ* operator &() const { return &self; } - const LDKCOption_PackedLockTimeZ* operator ->() const { return &self; } -}; class CVec_TransactionOutputsZ { private: LDKCVec_TransactionOutputsZ self; @@ -8328,6 +8734,21 @@ class COption_HTLCClaimZ { const LDKCOption_HTLCClaimZ* operator &() const { return &self; } const LDKCOption_HTLCClaimZ* operator ->() const { return &self; } }; +class COption_boolZ { +private: + LDKCOption_boolZ self; +public: + COption_boolZ(const COption_boolZ&) = delete; + COption_boolZ(COption_boolZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_boolZ)); } + COption_boolZ(LDKCOption_boolZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_boolZ)); } + operator LDKCOption_boolZ() && { LDKCOption_boolZ res = self; memset(&self, 0, sizeof(LDKCOption_boolZ)); return res; } + ~COption_boolZ() { COption_boolZ_free(self); } + COption_boolZ& operator=(COption_boolZ&& o) { COption_boolZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_boolZ)); return *this; } + LDKCOption_boolZ* operator &() { return &self; } + LDKCOption_boolZ* operator ->() { return &self; } + const LDKCOption_boolZ* operator &() const { return &self; } + const LDKCOption_boolZ* operator ->() const { return &self; } +}; class CVec_CVec_u8ZZ { private: LDKCVec_CVec_u8ZZ self; @@ -8343,21 +8764,6 @@ class CVec_CVec_u8ZZ { const LDKCVec_CVec_u8ZZ* operator &() const { return &self; } const LDKCVec_CVec_u8ZZ* operator ->() const { return &self; } }; -class CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { -private: - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ self; -public: - CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(const CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&) = delete; - CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); } - CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); } - operator LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ() && { LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); return res; } - ~CResult_COption_CustomOnionMessageContentsZDecodeErrorZ() { CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(self); } - CResult_COption_CustomOnionMessageContentsZDecodeErrorZ& operator=(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& o) { CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); return *this; } - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_ProbabilisticScorerDecodeErrorZ { private: LDKCResult_ProbabilisticScorerDecodeErrorZ self; @@ -8373,35 +8779,50 @@ class CResult_ProbabilisticScorerDecodeErrorZ { const LDKCResult_ProbabilisticScorerDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ProbabilisticScorerDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_ShutdownScriptDecodeErrorZ { +class CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ { private: - LDKCResult_ShutdownScriptDecodeErrorZ self; + LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ self; public: - CResult_ShutdownScriptDecodeErrorZ(const CResult_ShutdownScriptDecodeErrorZ&) = delete; - CResult_ShutdownScriptDecodeErrorZ(CResult_ShutdownScriptDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ShutdownScriptDecodeErrorZ)); } - CResult_ShutdownScriptDecodeErrorZ(LDKCResult_ShutdownScriptDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ShutdownScriptDecodeErrorZ)); } - operator LDKCResult_ShutdownScriptDecodeErrorZ() && { LDKCResult_ShutdownScriptDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ShutdownScriptDecodeErrorZ)); return res; } - ~CResult_ShutdownScriptDecodeErrorZ() { CResult_ShutdownScriptDecodeErrorZ_free(self); } - CResult_ShutdownScriptDecodeErrorZ& operator=(CResult_ShutdownScriptDecodeErrorZ&& o) { CResult_ShutdownScriptDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ShutdownScriptDecodeErrorZ)); return *this; } - LDKCResult_ShutdownScriptDecodeErrorZ* operator &() { return &self; } - LDKCResult_ShutdownScriptDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ShutdownScriptDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ShutdownScriptDecodeErrorZ* operator ->() const { return &self; } + CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ(const CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ&) = delete; + CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ(CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ)); } + CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ(LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ)); } + operator LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ() && { LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ)); return res; } + ~CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ() { CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(self); } + CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ& operator=(CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ&& o) { CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ)); return *this; } + LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ* operator &() { return &self; } + LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ* operator ->() const { return &self; } }; -class CResult_SiPrefixBolt11ParseErrorZ { +class CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { private: - LDKCResult_SiPrefixBolt11ParseErrorZ self; + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ self; public: - CResult_SiPrefixBolt11ParseErrorZ(const CResult_SiPrefixBolt11ParseErrorZ&) = delete; - CResult_SiPrefixBolt11ParseErrorZ(CResult_SiPrefixBolt11ParseErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SiPrefixBolt11ParseErrorZ)); } - CResult_SiPrefixBolt11ParseErrorZ(LDKCResult_SiPrefixBolt11ParseErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ)); } - operator LDKCResult_SiPrefixBolt11ParseErrorZ() && { LDKCResult_SiPrefixBolt11ParseErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ)); return res; } - ~CResult_SiPrefixBolt11ParseErrorZ() { CResult_SiPrefixBolt11ParseErrorZ_free(self); } - CResult_SiPrefixBolt11ParseErrorZ& operator=(CResult_SiPrefixBolt11ParseErrorZ&& o) { CResult_SiPrefixBolt11ParseErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SiPrefixBolt11ParseErrorZ)); return *this; } - LDKCResult_SiPrefixBolt11ParseErrorZ* operator &() { return &self; } - LDKCResult_SiPrefixBolt11ParseErrorZ* operator ->() { return &self; } - const LDKCResult_SiPrefixBolt11ParseErrorZ* operator &() const { return &self; } - const LDKCResult_SiPrefixBolt11ParseErrorZ* operator ->() const { return &self; } + CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(const CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&) = delete; + CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); } + CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); } + operator LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ() && { LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); return res; } + ~CResult_COption_CustomOnionMessageContentsZDecodeErrorZ() { CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(self); } + CResult_COption_CustomOnionMessageContentsZDecodeErrorZ& operator=(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& o) { CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); return *this; } + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_ShutdownScriptDecodeErrorZ { +private: + LDKCResult_ShutdownScriptDecodeErrorZ self; +public: + CResult_ShutdownScriptDecodeErrorZ(const CResult_ShutdownScriptDecodeErrorZ&) = delete; + CResult_ShutdownScriptDecodeErrorZ(CResult_ShutdownScriptDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ShutdownScriptDecodeErrorZ)); } + CResult_ShutdownScriptDecodeErrorZ(LDKCResult_ShutdownScriptDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ShutdownScriptDecodeErrorZ)); } + operator LDKCResult_ShutdownScriptDecodeErrorZ() && { LDKCResult_ShutdownScriptDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ShutdownScriptDecodeErrorZ)); return res; } + ~CResult_ShutdownScriptDecodeErrorZ() { CResult_ShutdownScriptDecodeErrorZ_free(self); } + CResult_ShutdownScriptDecodeErrorZ& operator=(CResult_ShutdownScriptDecodeErrorZ&& o) { CResult_ShutdownScriptDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ShutdownScriptDecodeErrorZ)); return *this; } + LDKCResult_ShutdownScriptDecodeErrorZ* operator &() { return &self; } + LDKCResult_ShutdownScriptDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ShutdownScriptDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ShutdownScriptDecodeErrorZ* operator ->() const { return &self; } }; class C2Tuple_usizeTransactionZ { private: @@ -8538,6 +8959,36 @@ class CResult_CoinSelectionNoneZ { const LDKCResult_CoinSelectionNoneZ* operator &() const { return &self; } const LDKCResult_CoinSelectionNoneZ* operator ->() const { return &self; } }; +class C2Tuple_ThirtyTwoBytesPublicKeyZ { +private: + LDKC2Tuple_ThirtyTwoBytesPublicKeyZ self; +public: + C2Tuple_ThirtyTwoBytesPublicKeyZ(const C2Tuple_ThirtyTwoBytesPublicKeyZ&) = delete; + C2Tuple_ThirtyTwoBytesPublicKeyZ(C2Tuple_ThirtyTwoBytesPublicKeyZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesPublicKeyZ)); } + C2Tuple_ThirtyTwoBytesPublicKeyZ(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ)); } + operator LDKC2Tuple_ThirtyTwoBytesPublicKeyZ() && { LDKC2Tuple_ThirtyTwoBytesPublicKeyZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ)); return res; } + ~C2Tuple_ThirtyTwoBytesPublicKeyZ() { C2Tuple_ThirtyTwoBytesPublicKeyZ_free(self); } + C2Tuple_ThirtyTwoBytesPublicKeyZ& operator=(C2Tuple_ThirtyTwoBytesPublicKeyZ&& o) { C2Tuple_ThirtyTwoBytesPublicKeyZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesPublicKeyZ)); return *this; } + LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* operator &() { return &self; } + LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* operator ->() { return &self; } + const LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* operator &() const { return &self; } + const LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* operator ->() const { return &self; } +}; +class CResult_SiPrefixBolt11ParseErrorZ { +private: + LDKCResult_SiPrefixBolt11ParseErrorZ self; +public: + CResult_SiPrefixBolt11ParseErrorZ(const CResult_SiPrefixBolt11ParseErrorZ&) = delete; + CResult_SiPrefixBolt11ParseErrorZ(CResult_SiPrefixBolt11ParseErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SiPrefixBolt11ParseErrorZ)); } + CResult_SiPrefixBolt11ParseErrorZ(LDKCResult_SiPrefixBolt11ParseErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ)); } + operator LDKCResult_SiPrefixBolt11ParseErrorZ() && { LDKCResult_SiPrefixBolt11ParseErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ)); return res; } + ~CResult_SiPrefixBolt11ParseErrorZ() { CResult_SiPrefixBolt11ParseErrorZ_free(self); } + CResult_SiPrefixBolt11ParseErrorZ& operator=(CResult_SiPrefixBolt11ParseErrorZ&& o) { CResult_SiPrefixBolt11ParseErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SiPrefixBolt11ParseErrorZ)); return *this; } + LDKCResult_SiPrefixBolt11ParseErrorZ* operator &() { return &self; } + LDKCResult_SiPrefixBolt11ParseErrorZ* operator ->() { return &self; } + const LDKCResult_SiPrefixBolt11ParseErrorZ* operator &() const { return &self; } + const LDKCResult_SiPrefixBolt11ParseErrorZ* operator ->() const { return &self; } +}; class CResult_BlindedPathDecodeErrorZ { private: LDKCResult_BlindedPathDecodeErrorZ self; @@ -8568,6 +9019,21 @@ class CVec_BalanceZ { const LDKCVec_BalanceZ* operator &() const { return &self; } const LDKCVec_BalanceZ* operator ->() const { return &self; } }; +class CResult_NoneIOErrorZ { +private: + LDKCResult_NoneIOErrorZ self; +public: + CResult_NoneIOErrorZ(const CResult_NoneIOErrorZ&) = delete; + CResult_NoneIOErrorZ(CResult_NoneIOErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneIOErrorZ)); } + CResult_NoneIOErrorZ(LDKCResult_NoneIOErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneIOErrorZ)); } + operator LDKCResult_NoneIOErrorZ() && { LDKCResult_NoneIOErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneIOErrorZ)); return res; } + ~CResult_NoneIOErrorZ() { CResult_NoneIOErrorZ_free(self); } + CResult_NoneIOErrorZ& operator=(CResult_NoneIOErrorZ&& o) { CResult_NoneIOErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneIOErrorZ)); return *this; } + LDKCResult_NoneIOErrorZ* operator &() { return &self; } + LDKCResult_NoneIOErrorZ* operator ->() { return &self; } + const LDKCResult_NoneIOErrorZ* operator &() const { return &self; } + const LDKCResult_NoneIOErrorZ* operator ->() const { return &self; } +}; class CResult_MaxDustHTLCExposureDecodeErrorZ { private: LDKCResult_MaxDustHTLCExposureDecodeErrorZ self; @@ -8583,6 +9049,21 @@ class CResult_MaxDustHTLCExposureDecodeErrorZ { const LDKCResult_MaxDustHTLCExposureDecodeErrorZ* operator &() const { return &self; } const LDKCResult_MaxDustHTLCExposureDecodeErrorZ* operator ->() const { return &self; } }; +class CVec_CommitmentTransactionZ { +private: + LDKCVec_CommitmentTransactionZ self; +public: + CVec_CommitmentTransactionZ(const CVec_CommitmentTransactionZ&) = delete; + CVec_CommitmentTransactionZ(CVec_CommitmentTransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_CommitmentTransactionZ)); } + CVec_CommitmentTransactionZ(LDKCVec_CommitmentTransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_CommitmentTransactionZ)); } + operator LDKCVec_CommitmentTransactionZ() && { LDKCVec_CommitmentTransactionZ res = self; memset(&self, 0, sizeof(LDKCVec_CommitmentTransactionZ)); return res; } + ~CVec_CommitmentTransactionZ() { CVec_CommitmentTransactionZ_free(self); } + CVec_CommitmentTransactionZ& operator=(CVec_CommitmentTransactionZ&& o) { CVec_CommitmentTransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_CommitmentTransactionZ)); return *this; } + LDKCVec_CommitmentTransactionZ* operator &() { return &self; } + LDKCVec_CommitmentTransactionZ* operator ->() { return &self; } + const LDKCVec_CommitmentTransactionZ* operator &() const { return &self; } + const LDKCVec_CommitmentTransactionZ* operator ->() const { return &self; } +}; class CResult_FundingSignedDecodeErrorZ { private: LDKCResult_FundingSignedDecodeErrorZ self; @@ -8613,6 +9094,21 @@ class CResult_RecoverableSignatureNoneZ { const LDKCResult_RecoverableSignatureNoneZ* operator &() const { return &self; } const LDKCResult_RecoverableSignatureNoneZ* operator ->() const { return &self; } }; +class CResult_SocketAddressDecodeErrorZ { +private: + LDKCResult_SocketAddressDecodeErrorZ self; +public: + CResult_SocketAddressDecodeErrorZ(const CResult_SocketAddressDecodeErrorZ&) = delete; + CResult_SocketAddressDecodeErrorZ(CResult_SocketAddressDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SocketAddressDecodeErrorZ)); } + CResult_SocketAddressDecodeErrorZ(LDKCResult_SocketAddressDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SocketAddressDecodeErrorZ)); } + operator LDKCResult_SocketAddressDecodeErrorZ() && { LDKCResult_SocketAddressDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SocketAddressDecodeErrorZ)); return res; } + ~CResult_SocketAddressDecodeErrorZ() { CResult_SocketAddressDecodeErrorZ_free(self); } + CResult_SocketAddressDecodeErrorZ& operator=(CResult_SocketAddressDecodeErrorZ&& o) { CResult_SocketAddressDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SocketAddressDecodeErrorZ)); return *this; } + LDKCResult_SocketAddressDecodeErrorZ* operator &() { return &self; } + LDKCResult_SocketAddressDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_SocketAddressDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_SocketAddressDecodeErrorZ* operator ->() const { return &self; } +}; class C2Tuple_Z { private: LDKC2Tuple_Z self; @@ -8628,6 +9124,21 @@ class C2Tuple_Z { const LDKC2Tuple_Z* operator &() const { return &self; } const LDKC2Tuple_Z* operator ->() const { return &self; } }; +class C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { +private: + LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ self; +public: + C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ(const C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ&) = delete; + C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ(C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ)); } + C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ)); } + operator LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ() && { LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ)); return res; } + ~C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ() { C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(self); } + C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ& operator=(C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ&& o) { C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ)); return *this; } + LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* operator &() { return &self; } + LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* operator ->() { return &self; } + const LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* operator &() const { return &self; } + const LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* operator ->() const { return &self; } +}; class CVec_PathZ { private: LDKCVec_PathZ self; @@ -8733,6 +9244,21 @@ class CResult_NonePaymentSendFailureZ { const LDKCResult_NonePaymentSendFailureZ* operator &() const { return &self; } const LDKCResult_NonePaymentSendFailureZ* operator ->() const { return &self; } }; +class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { +private: + LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ self; +public: + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ(const CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ&) = delete; + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ)); } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ)); } + operator LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ() && { LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ)); return res; } + ~CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ() { CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(self); } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ& operator=(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ&& o) { CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ)); return *this; } + LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* operator &() { return &self; } + LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* operator ->() const { return &self; } +}; class CResult_ChannelPublicKeysDecodeErrorZ { private: LDKCResult_ChannelPublicKeysDecodeErrorZ self; @@ -8748,20 +9274,65 @@ class CResult_ChannelPublicKeysDecodeErrorZ { const LDKCResult_ChannelPublicKeysDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelPublicKeysDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_TxidCOption_BlockHashZZZ { -private: - LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ self; -public: - CVec_C2Tuple_TxidCOption_BlockHashZZZ(const CVec_C2Tuple_TxidCOption_BlockHashZZZ&) = delete; - CVec_C2Tuple_TxidCOption_BlockHashZZZ(CVec_C2Tuple_TxidCOption_BlockHashZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_TxidCOption_BlockHashZZZ)); } - CVec_C2Tuple_TxidCOption_BlockHashZZZ(LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ)); } - operator LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ() && { LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ)); return res; } - ~CVec_C2Tuple_TxidCOption_BlockHashZZZ() { CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(self); } - CVec_C2Tuple_TxidCOption_BlockHashZZZ& operator=(CVec_C2Tuple_TxidCOption_BlockHashZZZ&& o) { CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_TxidCOption_BlockHashZZZ)); return *this; } - LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ* operator &() { return &self; } - LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ* operator ->() const { return &self; } +class CVec_ClaimedHTLCZ { +private: + LDKCVec_ClaimedHTLCZ self; +public: + CVec_ClaimedHTLCZ(const CVec_ClaimedHTLCZ&) = delete; + CVec_ClaimedHTLCZ(CVec_ClaimedHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ClaimedHTLCZ)); } + CVec_ClaimedHTLCZ(LDKCVec_ClaimedHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ClaimedHTLCZ)); } + operator LDKCVec_ClaimedHTLCZ() && { LDKCVec_ClaimedHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_ClaimedHTLCZ)); return res; } + ~CVec_ClaimedHTLCZ() { CVec_ClaimedHTLCZ_free(self); } + CVec_ClaimedHTLCZ& operator=(CVec_ClaimedHTLCZ&& o) { CVec_ClaimedHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ClaimedHTLCZ)); return *this; } + LDKCVec_ClaimedHTLCZ* operator &() { return &self; } + LDKCVec_ClaimedHTLCZ* operator ->() { return &self; } + const LDKCVec_ClaimedHTLCZ* operator &() const { return &self; } + const LDKCVec_ClaimedHTLCZ* operator ->() const { return &self; } +}; +class COption_CVec_ThirtyTwoBytesZZ { +private: + LDKCOption_CVec_ThirtyTwoBytesZZ self; +public: + COption_CVec_ThirtyTwoBytesZZ(const COption_CVec_ThirtyTwoBytesZZ&) = delete; + COption_CVec_ThirtyTwoBytesZZ(COption_CVec_ThirtyTwoBytesZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_CVec_ThirtyTwoBytesZZ)); } + COption_CVec_ThirtyTwoBytesZZ(LDKCOption_CVec_ThirtyTwoBytesZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ)); } + operator LDKCOption_CVec_ThirtyTwoBytesZZ() && { LDKCOption_CVec_ThirtyTwoBytesZZ res = self; memset(&self, 0, sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ)); return res; } + ~COption_CVec_ThirtyTwoBytesZZ() { COption_CVec_ThirtyTwoBytesZZ_free(self); } + COption_CVec_ThirtyTwoBytesZZ& operator=(COption_CVec_ThirtyTwoBytesZZ&& o) { COption_CVec_ThirtyTwoBytesZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_CVec_ThirtyTwoBytesZZ)); return *this; } + LDKCOption_CVec_ThirtyTwoBytesZZ* operator &() { return &self; } + LDKCOption_CVec_ThirtyTwoBytesZZ* operator ->() { return &self; } + const LDKCOption_CVec_ThirtyTwoBytesZZ* operator &() const { return &self; } + const LDKCOption_CVec_ThirtyTwoBytesZZ* operator ->() const { return &self; } +}; +class CVec_SocketAddressZ { +private: + LDKCVec_SocketAddressZ self; +public: + CVec_SocketAddressZ(const CVec_SocketAddressZ&) = delete; + CVec_SocketAddressZ(CVec_SocketAddressZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_SocketAddressZ)); } + CVec_SocketAddressZ(LDKCVec_SocketAddressZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_SocketAddressZ)); } + operator LDKCVec_SocketAddressZ() && { LDKCVec_SocketAddressZ res = self; memset(&self, 0, sizeof(LDKCVec_SocketAddressZ)); return res; } + ~CVec_SocketAddressZ() { CVec_SocketAddressZ_free(self); } + CVec_SocketAddressZ& operator=(CVec_SocketAddressZ&& o) { CVec_SocketAddressZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_SocketAddressZ)); return *this; } + LDKCVec_SocketAddressZ* operator &() { return &self; } + LDKCVec_SocketAddressZ* operator ->() { return &self; } + const LDKCVec_SocketAddressZ* operator &() const { return &self; } + const LDKCVec_SocketAddressZ* operator ->() const { return &self; } +}; +class CResult_ThirtyTwoBytesPaymentSendFailureZ { +private: + LDKCResult_ThirtyTwoBytesPaymentSendFailureZ self; +public: + CResult_ThirtyTwoBytesPaymentSendFailureZ(const CResult_ThirtyTwoBytesPaymentSendFailureZ&) = delete; + CResult_ThirtyTwoBytesPaymentSendFailureZ(CResult_ThirtyTwoBytesPaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ThirtyTwoBytesPaymentSendFailureZ)); } + CResult_ThirtyTwoBytesPaymentSendFailureZ(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ)); } + operator LDKCResult_ThirtyTwoBytesPaymentSendFailureZ() && { LDKCResult_ThirtyTwoBytesPaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ)); return res; } + ~CResult_ThirtyTwoBytesPaymentSendFailureZ() { CResult_ThirtyTwoBytesPaymentSendFailureZ_free(self); } + CResult_ThirtyTwoBytesPaymentSendFailureZ& operator=(CResult_ThirtyTwoBytesPaymentSendFailureZ&& o) { CResult_ThirtyTwoBytesPaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ThirtyTwoBytesPaymentSendFailureZ)); return *this; } + LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* operator &() { return &self; } + LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* operator ->() { return &self; } + const LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* operator &() const { return &self; } + const LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* operator ->() const { return &self; } }; class CResult_HolderCommitmentTransactionDecodeErrorZ { private: @@ -8808,36 +9379,6 @@ class CResult_ChannelCounterpartyDecodeErrorZ { const LDKCResult_ChannelCounterpartyDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelCounterpartyDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_SignatureNoneZ { -private: - LDKCResult_SignatureNoneZ self; -public: - CResult_SignatureNoneZ(const CResult_SignatureNoneZ&) = delete; - CResult_SignatureNoneZ(CResult_SignatureNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SignatureNoneZ)); } - CResult_SignatureNoneZ(LDKCResult_SignatureNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SignatureNoneZ)); } - operator LDKCResult_SignatureNoneZ() && { LDKCResult_SignatureNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SignatureNoneZ)); return res; } - ~CResult_SignatureNoneZ() { CResult_SignatureNoneZ_free(self); } - CResult_SignatureNoneZ& operator=(CResult_SignatureNoneZ&& o) { CResult_SignatureNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SignatureNoneZ)); return *this; } - LDKCResult_SignatureNoneZ* operator &() { return &self; } - LDKCResult_SignatureNoneZ* operator ->() { return &self; } - const LDKCResult_SignatureNoneZ* operator &() const { return &self; } - const LDKCResult_SignatureNoneZ* operator ->() const { return &self; } -}; -class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { -private: - LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ self; -public: - C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(const C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&) = delete; - C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); } - C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); } - operator LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ() && { LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); return res; } - ~C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ() { C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(self); } - C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ& operator=(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& o) { C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); return *this; } - LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator &() { return &self; } - LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator ->() { return &self; } - const LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator &() const { return &self; } - const LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator ->() const { return &self; } -}; class CResult_InitDecodeErrorZ { private: LDKCResult_InitDecodeErrorZ self; @@ -8853,20 +9394,35 @@ class CResult_InitDecodeErrorZ { const LDKCResult_InitDecodeErrorZ* operator &() const { return &self; } const LDKCResult_InitDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_MonitorUpdateIdZ { +class CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { private: - LDKCVec_MonitorUpdateIdZ self; + LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ self; public: - CVec_MonitorUpdateIdZ(const CVec_MonitorUpdateIdZ&) = delete; - CVec_MonitorUpdateIdZ(CVec_MonitorUpdateIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_MonitorUpdateIdZ)); } - CVec_MonitorUpdateIdZ(LDKCVec_MonitorUpdateIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_MonitorUpdateIdZ)); } - operator LDKCVec_MonitorUpdateIdZ() && { LDKCVec_MonitorUpdateIdZ res = self; memset(&self, 0, sizeof(LDKCVec_MonitorUpdateIdZ)); return res; } - ~CVec_MonitorUpdateIdZ() { CVec_MonitorUpdateIdZ_free(self); } - CVec_MonitorUpdateIdZ& operator=(CVec_MonitorUpdateIdZ&& o) { CVec_MonitorUpdateIdZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_MonitorUpdateIdZ)); return *this; } - LDKCVec_MonitorUpdateIdZ* operator &() { return &self; } - LDKCVec_MonitorUpdateIdZ* operator ->() { return &self; } - const LDKCVec_MonitorUpdateIdZ* operator &() const { return &self; } - const LDKCVec_MonitorUpdateIdZ* operator ->() const { return &self; } + CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ(const CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ&) = delete; + CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ)); } + CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ)); } + operator LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ() && { LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ)); return res; } + ~CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ() { CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(self); } + CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ& operator=(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ&& o) { CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ)); return *this; } + LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* operator &() { return &self; } + LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_ClaimedHTLCDecodeErrorZ { +private: + LDKCResult_ClaimedHTLCDecodeErrorZ self; +public: + CResult_ClaimedHTLCDecodeErrorZ(const CResult_ClaimedHTLCDecodeErrorZ&) = delete; + CResult_ClaimedHTLCDecodeErrorZ(CResult_ClaimedHTLCDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ClaimedHTLCDecodeErrorZ)); } + CResult_ClaimedHTLCDecodeErrorZ(LDKCResult_ClaimedHTLCDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ)); } + operator LDKCResult_ClaimedHTLCDecodeErrorZ() && { LDKCResult_ClaimedHTLCDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ)); return res; } + ~CResult_ClaimedHTLCDecodeErrorZ() { CResult_ClaimedHTLCDecodeErrorZ_free(self); } + CResult_ClaimedHTLCDecodeErrorZ& operator=(CResult_ClaimedHTLCDecodeErrorZ&& o) { CResult_ClaimedHTLCDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ClaimedHTLCDecodeErrorZ)); return *this; } + LDKCResult_ClaimedHTLCDecodeErrorZ* operator &() { return &self; } + LDKCResult_ClaimedHTLCDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ClaimedHTLCDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ClaimedHTLCDecodeErrorZ* operator ->() const { return &self; } }; class CResult_PaymentPurposeDecodeErrorZ { private: @@ -8883,6 +9439,21 @@ class CResult_PaymentPurposeDecodeErrorZ { const LDKCResult_PaymentPurposeDecodeErrorZ* operator &() const { return &self; } const LDKCResult_PaymentPurposeDecodeErrorZ* operator ->() const { return &self; } }; +class CVec_MonitorUpdateIdZ { +private: + LDKCVec_MonitorUpdateIdZ self; +public: + CVec_MonitorUpdateIdZ(const CVec_MonitorUpdateIdZ&) = delete; + CVec_MonitorUpdateIdZ(CVec_MonitorUpdateIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_MonitorUpdateIdZ)); } + CVec_MonitorUpdateIdZ(LDKCVec_MonitorUpdateIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_MonitorUpdateIdZ)); } + operator LDKCVec_MonitorUpdateIdZ() && { LDKCVec_MonitorUpdateIdZ res = self; memset(&self, 0, sizeof(LDKCVec_MonitorUpdateIdZ)); return res; } + ~CVec_MonitorUpdateIdZ() { CVec_MonitorUpdateIdZ_free(self); } + CVec_MonitorUpdateIdZ& operator=(CVec_MonitorUpdateIdZ&& o) { CVec_MonitorUpdateIdZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_MonitorUpdateIdZ)); return *this; } + LDKCVec_MonitorUpdateIdZ* operator &() { return &self; } + LDKCVec_MonitorUpdateIdZ* operator ->() { return &self; } + const LDKCVec_MonitorUpdateIdZ* operator &() const { return &self; } + const LDKCVec_MonitorUpdateIdZ* operator ->() const { return &self; } +}; class CResult_OutPointDecodeErrorZ { private: LDKCResult_OutPointDecodeErrorZ self; @@ -8943,36 +9514,6 @@ class CVec_MessageSendEventZ { const LDKCVec_MessageSendEventZ* operator &() const { return &self; } const LDKCVec_MessageSendEventZ* operator ->() const { return &self; } }; -class COption_NetAddressZ { -private: - LDKCOption_NetAddressZ self; -public: - COption_NetAddressZ(const COption_NetAddressZ&) = delete; - COption_NetAddressZ(COption_NetAddressZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_NetAddressZ)); } - COption_NetAddressZ(LDKCOption_NetAddressZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_NetAddressZ)); } - operator LDKCOption_NetAddressZ() && { LDKCOption_NetAddressZ res = self; memset(&self, 0, sizeof(LDKCOption_NetAddressZ)); return res; } - ~COption_NetAddressZ() { COption_NetAddressZ_free(self); } - COption_NetAddressZ& operator=(COption_NetAddressZ&& o) { COption_NetAddressZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_NetAddressZ)); return *this; } - LDKCOption_NetAddressZ* operator &() { return &self; } - LDKCOption_NetAddressZ* operator ->() { return &self; } - const LDKCOption_NetAddressZ* operator &() const { return &self; } - const LDKCOption_NetAddressZ* operator ->() const { return &self; } -}; -class C2Tuple_OutPointScriptZ { -private: - LDKC2Tuple_OutPointScriptZ self; -public: - C2Tuple_OutPointScriptZ(const C2Tuple_OutPointScriptZ&) = delete; - C2Tuple_OutPointScriptZ(C2Tuple_OutPointScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OutPointScriptZ)); } - C2Tuple_OutPointScriptZ(LDKC2Tuple_OutPointScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OutPointScriptZ)); } - operator LDKC2Tuple_OutPointScriptZ() && { LDKC2Tuple_OutPointScriptZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OutPointScriptZ)); return res; } - ~C2Tuple_OutPointScriptZ() { C2Tuple_OutPointScriptZ_free(self); } - C2Tuple_OutPointScriptZ& operator=(C2Tuple_OutPointScriptZ&& o) { C2Tuple_OutPointScriptZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OutPointScriptZ)); return *this; } - LDKC2Tuple_OutPointScriptZ* operator &() { return &self; } - LDKC2Tuple_OutPointScriptZ* operator ->() { return &self; } - const LDKC2Tuple_OutPointScriptZ* operator &() const { return &self; } - const LDKC2Tuple_OutPointScriptZ* operator ->() const { return &self; } -}; class CResult_RouteHintHopDecodeErrorZ { private: LDKCResult_RouteHintHopDecodeErrorZ self; @@ -9018,6 +9559,21 @@ class CResult_BlindedPayInfoDecodeErrorZ { const LDKCResult_BlindedPayInfoDecodeErrorZ* operator &() const { return &self; } const LDKCResult_BlindedPayInfoDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_ThirtyTwoBytesAPIErrorZ { +private: + LDKCResult_ThirtyTwoBytesAPIErrorZ self; +public: + CResult_ThirtyTwoBytesAPIErrorZ(const CResult_ThirtyTwoBytesAPIErrorZ&) = delete; + CResult_ThirtyTwoBytesAPIErrorZ(CResult_ThirtyTwoBytesAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ThirtyTwoBytesAPIErrorZ)); } + CResult_ThirtyTwoBytesAPIErrorZ(LDKCResult_ThirtyTwoBytesAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ)); } + operator LDKCResult_ThirtyTwoBytesAPIErrorZ() && { LDKCResult_ThirtyTwoBytesAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ)); return res; } + ~CResult_ThirtyTwoBytesAPIErrorZ() { CResult_ThirtyTwoBytesAPIErrorZ_free(self); } + CResult_ThirtyTwoBytesAPIErrorZ& operator=(CResult_ThirtyTwoBytesAPIErrorZ&& o) { CResult_ThirtyTwoBytesAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ThirtyTwoBytesAPIErrorZ)); return *this; } + LDKCResult_ThirtyTwoBytesAPIErrorZ* operator &() { return &self; } + LDKCResult_ThirtyTwoBytesAPIErrorZ* operator ->() { return &self; } + const LDKCResult_ThirtyTwoBytesAPIErrorZ* operator &() const { return &self; } + const LDKCResult_ThirtyTwoBytesAPIErrorZ* operator ->() const { return &self; } +}; class COption_ChannelShutdownStateZ { private: LDKCOption_ChannelShutdownStateZ self; @@ -9033,51 +9589,6 @@ class COption_ChannelShutdownStateZ { const LDKCOption_ChannelShutdownStateZ* operator &() const { return &self; } const LDKCOption_ChannelShutdownStateZ* operator ->() const { return &self; } }; -class CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { -private: - LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ self; -public: - CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ(const CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ&) = delete; - CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ(CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ)); } - CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ)); } - operator LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ() && { LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ)); return res; } - ~CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ() { CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(self); } - CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ& operator=(CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ&& o) { CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ)); return *this; } - LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* operator &() { return &self; } - LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* operator ->() const { return &self; } -}; -class CResult_SharedSecretNoneZ { -private: - LDKCResult_SharedSecretNoneZ self; -public: - CResult_SharedSecretNoneZ(const CResult_SharedSecretNoneZ&) = delete; - CResult_SharedSecretNoneZ(CResult_SharedSecretNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SharedSecretNoneZ)); } - CResult_SharedSecretNoneZ(LDKCResult_SharedSecretNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SharedSecretNoneZ)); } - operator LDKCResult_SharedSecretNoneZ() && { LDKCResult_SharedSecretNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SharedSecretNoneZ)); return res; } - ~CResult_SharedSecretNoneZ() { CResult_SharedSecretNoneZ_free(self); } - CResult_SharedSecretNoneZ& operator=(CResult_SharedSecretNoneZ&& o) { CResult_SharedSecretNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SharedSecretNoneZ)); return *this; } - LDKCResult_SharedSecretNoneZ* operator &() { return &self; } - LDKCResult_SharedSecretNoneZ* operator ->() { return &self; } - const LDKCResult_SharedSecretNoneZ* operator &() const { return &self; } - const LDKCResult_SharedSecretNoneZ* operator ->() const { return &self; } -}; -class CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { -private: - LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ self; -public: - CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(const CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&) = delete; - CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); } - CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); } - operator LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() && { LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return res; } - ~CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); } - CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ& operator=(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return *this; } - LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() { return &self; } - LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() const { return &self; } -}; class CResult_CVec_CVec_u8ZZNoneZ { private: LDKCResult_CVec_CVec_u8ZZNoneZ self; @@ -9093,21 +9604,6 @@ class CResult_CVec_CVec_u8ZZNoneZ { const LDKCResult_CVec_CVec_u8ZZNoneZ* operator &() const { return &self; } const LDKCResult_CVec_CVec_u8ZZNoneZ* operator ->() const { return &self; } }; -class C2Tuple_PaymentHashPaymentSecretZ { -private: - LDKC2Tuple_PaymentHashPaymentSecretZ self; -public: - C2Tuple_PaymentHashPaymentSecretZ(const C2Tuple_PaymentHashPaymentSecretZ&) = delete; - C2Tuple_PaymentHashPaymentSecretZ(C2Tuple_PaymentHashPaymentSecretZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PaymentHashPaymentSecretZ)); } - C2Tuple_PaymentHashPaymentSecretZ(LDKC2Tuple_PaymentHashPaymentSecretZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ)); } - operator LDKC2Tuple_PaymentHashPaymentSecretZ() && { LDKC2Tuple_PaymentHashPaymentSecretZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ)); return res; } - ~C2Tuple_PaymentHashPaymentSecretZ() { C2Tuple_PaymentHashPaymentSecretZ_free(self); } - C2Tuple_PaymentHashPaymentSecretZ& operator=(C2Tuple_PaymentHashPaymentSecretZ&& o) { C2Tuple_PaymentHashPaymentSecretZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PaymentHashPaymentSecretZ)); return *this; } - LDKC2Tuple_PaymentHashPaymentSecretZ* operator &() { return &self; } - LDKC2Tuple_PaymentHashPaymentSecretZ* operator ->() { return &self; } - const LDKC2Tuple_PaymentHashPaymentSecretZ* operator &() const { return &self; } - const LDKC2Tuple_PaymentHashPaymentSecretZ* operator ->() const { return &self; } -}; class CResult_AcceptChannelDecodeErrorZ { private: LDKCResult_AcceptChannelDecodeErrorZ self; @@ -9138,20 +9634,35 @@ class CResult_HostnameDecodeErrorZ { const LDKCResult_HostnameDecodeErrorZ* operator &() const { return &self; } const LDKCResult_HostnameDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_SignatureZ { +class C2Tuple_u64u16Z { +private: + LDKC2Tuple_u64u16Z self; +public: + C2Tuple_u64u16Z(const C2Tuple_u64u16Z&) = delete; + C2Tuple_u64u16Z(C2Tuple_u64u16Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u64u16Z)); } + C2Tuple_u64u16Z(LDKC2Tuple_u64u16Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u64u16Z)); } + operator LDKC2Tuple_u64u16Z() && { LDKC2Tuple_u64u16Z res = self; memset(&self, 0, sizeof(LDKC2Tuple_u64u16Z)); return res; } + ~C2Tuple_u64u16Z() { C2Tuple_u64u16Z_free(self); } + C2Tuple_u64u16Z& operator=(C2Tuple_u64u16Z&& o) { C2Tuple_u64u16Z_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_u64u16Z)); return *this; } + LDKC2Tuple_u64u16Z* operator &() { return &self; } + LDKC2Tuple_u64u16Z* operator ->() { return &self; } + const LDKC2Tuple_u64u16Z* operator &() const { return &self; } + const LDKC2Tuple_u64u16Z* operator ->() const { return &self; } +}; +class COption_ThirtyTwoBytesZ { private: - LDKCVec_SignatureZ self; + LDKCOption_ThirtyTwoBytesZ self; public: - CVec_SignatureZ(const CVec_SignatureZ&) = delete; - CVec_SignatureZ(CVec_SignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_SignatureZ)); } - CVec_SignatureZ(LDKCVec_SignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_SignatureZ)); } - operator LDKCVec_SignatureZ() && { LDKCVec_SignatureZ res = self; memset(&self, 0, sizeof(LDKCVec_SignatureZ)); return res; } - ~CVec_SignatureZ() { CVec_SignatureZ_free(self); } - CVec_SignatureZ& operator=(CVec_SignatureZ&& o) { CVec_SignatureZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_SignatureZ)); return *this; } - LDKCVec_SignatureZ* operator &() { return &self; } - LDKCVec_SignatureZ* operator ->() { return &self; } - const LDKCVec_SignatureZ* operator &() const { return &self; } - const LDKCVec_SignatureZ* operator ->() const { return &self; } + COption_ThirtyTwoBytesZ(const COption_ThirtyTwoBytesZ&) = delete; + COption_ThirtyTwoBytesZ(COption_ThirtyTwoBytesZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_ThirtyTwoBytesZ)); } + COption_ThirtyTwoBytesZ(LDKCOption_ThirtyTwoBytesZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_ThirtyTwoBytesZ)); } + operator LDKCOption_ThirtyTwoBytesZ() && { LDKCOption_ThirtyTwoBytesZ res = self; memset(&self, 0, sizeof(LDKCOption_ThirtyTwoBytesZ)); return res; } + ~COption_ThirtyTwoBytesZ() { COption_ThirtyTwoBytesZ_free(self); } + COption_ThirtyTwoBytesZ& operator=(COption_ThirtyTwoBytesZ&& o) { COption_ThirtyTwoBytesZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_ThirtyTwoBytesZ)); return *this; } + LDKCOption_ThirtyTwoBytesZ* operator &() { return &self; } + LDKCOption_ThirtyTwoBytesZ* operator ->() { return &self; } + const LDKCOption_ThirtyTwoBytesZ* operator &() const { return &self; } + const LDKCOption_ThirtyTwoBytesZ* operator ->() const { return &self; } }; class CVec_u64Z { private: @@ -9168,50 +9679,35 @@ class CVec_u64Z { const LDKCVec_u64Z* operator &() const { return &self; } const LDKCVec_u64Z* operator ->() const { return &self; } }; -class CResult_StringErrorZ { -private: - LDKCResult_StringErrorZ self; -public: - CResult_StringErrorZ(const CResult_StringErrorZ&) = delete; - CResult_StringErrorZ(CResult_StringErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StringErrorZ)); } - CResult_StringErrorZ(LDKCResult_StringErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StringErrorZ)); } - operator LDKCResult_StringErrorZ() && { LDKCResult_StringErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StringErrorZ)); return res; } - ~CResult_StringErrorZ() { CResult_StringErrorZ_free(self); } - CResult_StringErrorZ& operator=(CResult_StringErrorZ&& o) { CResult_StringErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StringErrorZ)); return *this; } - LDKCResult_StringErrorZ* operator &() { return &self; } - LDKCResult_StringErrorZ* operator ->() { return &self; } - const LDKCResult_StringErrorZ* operator &() const { return &self; } - const LDKCResult_StringErrorZ* operator ->() const { return &self; } -}; -class C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { -private: - LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ self; -public: - C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ(const C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ&) = delete; - C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ(C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ)); } - C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ)); } - operator LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ() && { LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ)); return res; } - ~C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ() { C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(self); } - C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ& operator=(C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ&& o) { C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ)); return *this; } - LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator &() { return &self; } - LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator ->() { return &self; } - const LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator &() const { return &self; } - const LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator ->() const { return &self; } -}; -class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { -private: - LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ self; -public: - CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ(const CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ&) = delete; - CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ(CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ)); } - CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ)); } - operator LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ() && { LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ)); return res; } - ~CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ() { CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(self); } - CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ& operator=(CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ&& o) { CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ)); return *this; } - LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator &() { return &self; } - LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator ->() const { return &self; } +class COption_SecretKeyZ { +private: + LDKCOption_SecretKeyZ self; +public: + COption_SecretKeyZ(const COption_SecretKeyZ&) = delete; + COption_SecretKeyZ(COption_SecretKeyZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_SecretKeyZ)); } + COption_SecretKeyZ(LDKCOption_SecretKeyZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_SecretKeyZ)); } + operator LDKCOption_SecretKeyZ() && { LDKCOption_SecretKeyZ res = self; memset(&self, 0, sizeof(LDKCOption_SecretKeyZ)); return res; } + ~COption_SecretKeyZ() { COption_SecretKeyZ_free(self); } + COption_SecretKeyZ& operator=(COption_SecretKeyZ&& o) { COption_SecretKeyZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_SecretKeyZ)); return *this; } + LDKCOption_SecretKeyZ* operator &() { return &self; } + LDKCOption_SecretKeyZ* operator ->() { return &self; } + const LDKCOption_SecretKeyZ* operator &() const { return &self; } + const LDKCOption_SecretKeyZ* operator ->() const { return &self; } +}; +class CResult_ThirtyTwoBytesPaymentErrorZ { +private: + LDKCResult_ThirtyTwoBytesPaymentErrorZ self; +public: + CResult_ThirtyTwoBytesPaymentErrorZ(const CResult_ThirtyTwoBytesPaymentErrorZ&) = delete; + CResult_ThirtyTwoBytesPaymentErrorZ(CResult_ThirtyTwoBytesPaymentErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ThirtyTwoBytesPaymentErrorZ)); } + CResult_ThirtyTwoBytesPaymentErrorZ(LDKCResult_ThirtyTwoBytesPaymentErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ)); } + operator LDKCResult_ThirtyTwoBytesPaymentErrorZ() && { LDKCResult_ThirtyTwoBytesPaymentErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ)); return res; } + ~CResult_ThirtyTwoBytesPaymentErrorZ() { CResult_ThirtyTwoBytesPaymentErrorZ_free(self); } + CResult_ThirtyTwoBytesPaymentErrorZ& operator=(CResult_ThirtyTwoBytesPaymentErrorZ&& o) { CResult_ThirtyTwoBytesPaymentErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ThirtyTwoBytesPaymentErrorZ)); return *this; } + LDKCResult_ThirtyTwoBytesPaymentErrorZ* operator &() { return &self; } + LDKCResult_ThirtyTwoBytesPaymentErrorZ* operator ->() { return &self; } + const LDKCResult_ThirtyTwoBytesPaymentErrorZ* operator &() const { return &self; } + const LDKCResult_ThirtyTwoBytesPaymentErrorZ* operator ->() const { return &self; } }; class COption_EventZ { private: @@ -9243,20 +9739,20 @@ class CResult_ChannelTypeFeaturesDecodeErrorZ { const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator ->() const { return &self; } }; -class COption_TxidZ { +class COption_CVec_SocketAddressZZ { private: - LDKCOption_TxidZ self; + LDKCOption_CVec_SocketAddressZZ self; public: - COption_TxidZ(const COption_TxidZ&) = delete; - COption_TxidZ(COption_TxidZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_TxidZ)); } - COption_TxidZ(LDKCOption_TxidZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_TxidZ)); } - operator LDKCOption_TxidZ() && { LDKCOption_TxidZ res = self; memset(&self, 0, sizeof(LDKCOption_TxidZ)); return res; } - ~COption_TxidZ() { COption_TxidZ_free(self); } - COption_TxidZ& operator=(COption_TxidZ&& o) { COption_TxidZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_TxidZ)); return *this; } - LDKCOption_TxidZ* operator &() { return &self; } - LDKCOption_TxidZ* operator ->() { return &self; } - const LDKCOption_TxidZ* operator &() const { return &self; } - const LDKCOption_TxidZ* operator ->() const { return &self; } + COption_CVec_SocketAddressZZ(const COption_CVec_SocketAddressZZ&) = delete; + COption_CVec_SocketAddressZZ(COption_CVec_SocketAddressZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_CVec_SocketAddressZZ)); } + COption_CVec_SocketAddressZZ(LDKCOption_CVec_SocketAddressZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_CVec_SocketAddressZZ)); } + operator LDKCOption_CVec_SocketAddressZZ() && { LDKCOption_CVec_SocketAddressZZ res = self; memset(&self, 0, sizeof(LDKCOption_CVec_SocketAddressZZ)); return res; } + ~COption_CVec_SocketAddressZZ() { COption_CVec_SocketAddressZZ_free(self); } + COption_CVec_SocketAddressZZ& operator=(COption_CVec_SocketAddressZZ&& o) { COption_CVec_SocketAddressZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_CVec_SocketAddressZZ)); return *this; } + LDKCOption_CVec_SocketAddressZZ* operator &() { return &self; } + LDKCOption_CVec_SocketAddressZZ* operator ->() { return &self; } + const LDKCOption_CVec_SocketAddressZZ* operator &() const { return &self; } + const LDKCOption_CVec_SocketAddressZZ* operator ->() const { return &self; } }; class CVec_RouteHintZ { private: @@ -9303,20 +9799,20 @@ class COption_PaymentFailureReasonZ { const LDKCOption_PaymentFailureReasonZ* operator &() const { return &self; } const LDKCOption_PaymentFailureReasonZ* operator ->() const { return &self; } }; -class CVec_ChainHashZ { +class CResult_ECDSASignatureNoneZ { private: - LDKCVec_ChainHashZ self; + LDKCResult_ECDSASignatureNoneZ self; public: - CVec_ChainHashZ(const CVec_ChainHashZ&) = delete; - CVec_ChainHashZ(CVec_ChainHashZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChainHashZ)); } - CVec_ChainHashZ(LDKCVec_ChainHashZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChainHashZ)); } - operator LDKCVec_ChainHashZ() && { LDKCVec_ChainHashZ res = self; memset(&self, 0, sizeof(LDKCVec_ChainHashZ)); return res; } - ~CVec_ChainHashZ() { CVec_ChainHashZ_free(self); } - CVec_ChainHashZ& operator=(CVec_ChainHashZ&& o) { CVec_ChainHashZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ChainHashZ)); return *this; } - LDKCVec_ChainHashZ* operator &() { return &self; } - LDKCVec_ChainHashZ* operator ->() { return &self; } - const LDKCVec_ChainHashZ* operator &() const { return &self; } - const LDKCVec_ChainHashZ* operator ->() const { return &self; } + CResult_ECDSASignatureNoneZ(const CResult_ECDSASignatureNoneZ&) = delete; + CResult_ECDSASignatureNoneZ(CResult_ECDSASignatureNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ECDSASignatureNoneZ)); } + CResult_ECDSASignatureNoneZ(LDKCResult_ECDSASignatureNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ECDSASignatureNoneZ)); } + operator LDKCResult_ECDSASignatureNoneZ() && { LDKCResult_ECDSASignatureNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_ECDSASignatureNoneZ)); return res; } + ~CResult_ECDSASignatureNoneZ() { CResult_ECDSASignatureNoneZ_free(self); } + CResult_ECDSASignatureNoneZ& operator=(CResult_ECDSASignatureNoneZ&& o) { CResult_ECDSASignatureNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ECDSASignatureNoneZ)); return *this; } + LDKCResult_ECDSASignatureNoneZ* operator &() { return &self; } + LDKCResult_ECDSASignatureNoneZ* operator ->() { return &self; } + const LDKCResult_ECDSASignatureNoneZ* operator &() const { return &self; } + const LDKCResult_ECDSASignatureNoneZ* operator ->() const { return &self; } }; class CVec_WitnessZ { private: @@ -9348,6 +9844,36 @@ class CResult_BlindedTailDecodeErrorZ { const LDKCResult_BlindedTailDecodeErrorZ* operator &() const { return &self; } const LDKCResult_BlindedTailDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_SocketAddressSocketAddressParseErrorZ { +private: + LDKCResult_SocketAddressSocketAddressParseErrorZ self; +public: + CResult_SocketAddressSocketAddressParseErrorZ(const CResult_SocketAddressSocketAddressParseErrorZ&) = delete; + CResult_SocketAddressSocketAddressParseErrorZ(CResult_SocketAddressSocketAddressParseErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SocketAddressSocketAddressParseErrorZ)); } + CResult_SocketAddressSocketAddressParseErrorZ(LDKCResult_SocketAddressSocketAddressParseErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ)); } + operator LDKCResult_SocketAddressSocketAddressParseErrorZ() && { LDKCResult_SocketAddressSocketAddressParseErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ)); return res; } + ~CResult_SocketAddressSocketAddressParseErrorZ() { CResult_SocketAddressSocketAddressParseErrorZ_free(self); } + CResult_SocketAddressSocketAddressParseErrorZ& operator=(CResult_SocketAddressSocketAddressParseErrorZ&& o) { CResult_SocketAddressSocketAddressParseErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SocketAddressSocketAddressParseErrorZ)); return *this; } + LDKCResult_SocketAddressSocketAddressParseErrorZ* operator &() { return &self; } + LDKCResult_SocketAddressSocketAddressParseErrorZ* operator ->() { return &self; } + const LDKCResult_SocketAddressSocketAddressParseErrorZ* operator &() const { return &self; } + const LDKCResult_SocketAddressSocketAddressParseErrorZ* operator ->() const { return &self; } +}; +class COption_C2Tuple_u64u16ZZ { +private: + LDKCOption_C2Tuple_u64u16ZZ self; +public: + COption_C2Tuple_u64u16ZZ(const COption_C2Tuple_u64u16ZZ&) = delete; + COption_C2Tuple_u64u16ZZ(COption_C2Tuple_u64u16ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_u64u16ZZ)); } + COption_C2Tuple_u64u16ZZ(LDKCOption_C2Tuple_u64u16ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_u64u16ZZ)); } + operator LDKCOption_C2Tuple_u64u16ZZ() && { LDKCOption_C2Tuple_u64u16ZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_u64u16ZZ)); return res; } + ~COption_C2Tuple_u64u16ZZ() { COption_C2Tuple_u64u16ZZ_free(self); } + COption_C2Tuple_u64u16ZZ& operator=(COption_C2Tuple_u64u16ZZ&& o) { COption_C2Tuple_u64u16ZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_u64u16ZZ)); return *this; } + LDKCOption_C2Tuple_u64u16ZZ* operator &() { return &self; } + LDKCOption_C2Tuple_u64u16ZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_u64u16ZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_u64u16ZZ* operator ->() const { return &self; } +}; class CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { private: LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ self; @@ -9363,6 +9889,66 @@ class CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { const LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* operator &() const { return &self; } const LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* operator ->() const { return &self; } }; +class CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { +private: + LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ self; +public: + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ(const CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ&) = delete; + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ(CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ)); } + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ)); } + operator LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ() && { LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ)); return res; } + ~CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ() { CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(self); } + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ& operator=(CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ&& o) { CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ)); return *this; } + LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* operator &() { return &self; } + LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* operator ->() { return &self; } + const LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* operator &() const { return &self; } + const LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* operator ->() const { return &self; } +}; +class CResult_ChannelDerivationParametersDecodeErrorZ { +private: + LDKCResult_ChannelDerivationParametersDecodeErrorZ self; +public: + CResult_ChannelDerivationParametersDecodeErrorZ(const CResult_ChannelDerivationParametersDecodeErrorZ&) = delete; + CResult_ChannelDerivationParametersDecodeErrorZ(CResult_ChannelDerivationParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelDerivationParametersDecodeErrorZ)); } + CResult_ChannelDerivationParametersDecodeErrorZ(LDKCResult_ChannelDerivationParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ)); } + operator LDKCResult_ChannelDerivationParametersDecodeErrorZ() && { LDKCResult_ChannelDerivationParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ)); return res; } + ~CResult_ChannelDerivationParametersDecodeErrorZ() { CResult_ChannelDerivationParametersDecodeErrorZ_free(self); } + CResult_ChannelDerivationParametersDecodeErrorZ& operator=(CResult_ChannelDerivationParametersDecodeErrorZ&& o) { CResult_ChannelDerivationParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelDerivationParametersDecodeErrorZ)); return *this; } + LDKCResult_ChannelDerivationParametersDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelDerivationParametersDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelDerivationParametersDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelDerivationParametersDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_PaymentConstraintsDecodeErrorZ { +private: + LDKCResult_PaymentConstraintsDecodeErrorZ self; +public: + CResult_PaymentConstraintsDecodeErrorZ(const CResult_PaymentConstraintsDecodeErrorZ&) = delete; + CResult_PaymentConstraintsDecodeErrorZ(CResult_PaymentConstraintsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentConstraintsDecodeErrorZ)); } + CResult_PaymentConstraintsDecodeErrorZ(LDKCResult_PaymentConstraintsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ)); } + operator LDKCResult_PaymentConstraintsDecodeErrorZ() && { LDKCResult_PaymentConstraintsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ)); return res; } + ~CResult_PaymentConstraintsDecodeErrorZ() { CResult_PaymentConstraintsDecodeErrorZ_free(self); } + CResult_PaymentConstraintsDecodeErrorZ& operator=(CResult_PaymentConstraintsDecodeErrorZ&& o) { CResult_PaymentConstraintsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentConstraintsDecodeErrorZ)); return *this; } + LDKCResult_PaymentConstraintsDecodeErrorZ* operator &() { return &self; } + LDKCResult_PaymentConstraintsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PaymentConstraintsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PaymentConstraintsDecodeErrorZ* operator ->() const { return &self; } +}; +class C2Tuple_u32CVec_u8ZZ { +private: + LDKC2Tuple_u32CVec_u8ZZ self; +public: + C2Tuple_u32CVec_u8ZZ(const C2Tuple_u32CVec_u8ZZ&) = delete; + C2Tuple_u32CVec_u8ZZ(C2Tuple_u32CVec_u8ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u32CVec_u8ZZ)); } + C2Tuple_u32CVec_u8ZZ(LDKC2Tuple_u32CVec_u8ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u32CVec_u8ZZ)); } + operator LDKC2Tuple_u32CVec_u8ZZ() && { LDKC2Tuple_u32CVec_u8ZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_u32CVec_u8ZZ)); return res; } + ~C2Tuple_u32CVec_u8ZZ() { C2Tuple_u32CVec_u8ZZ_free(self); } + C2Tuple_u32CVec_u8ZZ& operator=(C2Tuple_u32CVec_u8ZZ&& o) { C2Tuple_u32CVec_u8ZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_u32CVec_u8ZZ)); return *this; } + LDKC2Tuple_u32CVec_u8ZZ* operator &() { return &self; } + LDKC2Tuple_u32CVec_u8ZZ* operator ->() { return &self; } + const LDKC2Tuple_u32CVec_u8ZZ* operator &() const { return &self; } + const LDKC2Tuple_u32CVec_u8ZZ* operator ->() const { return &self; } +}; class CVec_C2Tuple_PublicKeyTypeZZ { private: LDKCVec_C2Tuple_PublicKeyTypeZZ self; @@ -9423,6 +10009,21 @@ class C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { const LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* operator &() const { return &self; } const LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* operator ->() const { return &self; } }; +class CVec_C2Tuple_u64CVec_u8ZZZ { +private: + LDKCVec_C2Tuple_u64CVec_u8ZZZ self; +public: + CVec_C2Tuple_u64CVec_u8ZZZ(const CVec_C2Tuple_u64CVec_u8ZZZ&) = delete; + CVec_C2Tuple_u64CVec_u8ZZZ(CVec_C2Tuple_u64CVec_u8ZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_u64CVec_u8ZZZ)); } + CVec_C2Tuple_u64CVec_u8ZZZ(LDKCVec_C2Tuple_u64CVec_u8ZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_u64CVec_u8ZZZ)); } + operator LDKCVec_C2Tuple_u64CVec_u8ZZZ() && { LDKCVec_C2Tuple_u64CVec_u8ZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_u64CVec_u8ZZZ)); return res; } + ~CVec_C2Tuple_u64CVec_u8ZZZ() { CVec_C2Tuple_u64CVec_u8ZZZ_free(self); } + CVec_C2Tuple_u64CVec_u8ZZZ& operator=(CVec_C2Tuple_u64CVec_u8ZZZ&& o) { CVec_C2Tuple_u64CVec_u8ZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_u64CVec_u8ZZZ)); return *this; } + LDKCVec_C2Tuple_u64CVec_u8ZZZ* operator &() { return &self; } + LDKCVec_C2Tuple_u64CVec_u8ZZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_u64CVec_u8ZZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_u64CVec_u8ZZZ* operator ->() const { return &self; } +}; class CResult_u32GraphSyncErrorZ { private: LDKCResult_u32GraphSyncErrorZ self; @@ -9453,21 +10054,6 @@ class CVec_PhantomRouteHintsZ { const LDKCVec_PhantomRouteHintsZ* operator &() const { return &self; } const LDKCVec_PhantomRouteHintsZ* operator ->() const { return &self; } }; -class CResult_OffersMessageDecodeErrorZ { -private: - LDKCResult_OffersMessageDecodeErrorZ self; -public: - CResult_OffersMessageDecodeErrorZ(const CResult_OffersMessageDecodeErrorZ&) = delete; - CResult_OffersMessageDecodeErrorZ(CResult_OffersMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OffersMessageDecodeErrorZ)); } - CResult_OffersMessageDecodeErrorZ(LDKCResult_OffersMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OffersMessageDecodeErrorZ)); } - operator LDKCResult_OffersMessageDecodeErrorZ() && { LDKCResult_OffersMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OffersMessageDecodeErrorZ)); return res; } - ~CResult_OffersMessageDecodeErrorZ() { CResult_OffersMessageDecodeErrorZ_free(self); } - CResult_OffersMessageDecodeErrorZ& operator=(CResult_OffersMessageDecodeErrorZ&& o) { CResult_OffersMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OffersMessageDecodeErrorZ)); return *this; } - LDKCResult_OffersMessageDecodeErrorZ* operator &() { return &self; } - LDKCResult_OffersMessageDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_OffersMessageDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_OffersMessageDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_NoneAPIErrorZ { private: LDKCResult_NoneAPIErrorZ self; @@ -9498,20 +10084,20 @@ class CResult_Bolt12InvoiceFeaturesDecodeErrorZ { const LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator &() const { return &self; } const LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_NetAddressZ { +class COption_f64Z { private: - LDKCVec_NetAddressZ self; + LDKCOption_f64Z self; public: - CVec_NetAddressZ(const CVec_NetAddressZ&) = delete; - CVec_NetAddressZ(CVec_NetAddressZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_NetAddressZ)); } - CVec_NetAddressZ(LDKCVec_NetAddressZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_NetAddressZ)); } - operator LDKCVec_NetAddressZ() && { LDKCVec_NetAddressZ res = self; memset(&self, 0, sizeof(LDKCVec_NetAddressZ)); return res; } - ~CVec_NetAddressZ() { CVec_NetAddressZ_free(self); } - CVec_NetAddressZ& operator=(CVec_NetAddressZ&& o) { CVec_NetAddressZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_NetAddressZ)); return *this; } - LDKCVec_NetAddressZ* operator &() { return &self; } - LDKCVec_NetAddressZ* operator ->() { return &self; } - const LDKCVec_NetAddressZ* operator &() const { return &self; } - const LDKCVec_NetAddressZ* operator ->() const { return &self; } + COption_f64Z(const COption_f64Z&) = delete; + COption_f64Z(COption_f64Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_f64Z)); } + COption_f64Z(LDKCOption_f64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_f64Z)); } + operator LDKCOption_f64Z() && { LDKCOption_f64Z res = self; memset(&self, 0, sizeof(LDKCOption_f64Z)); return res; } + ~COption_f64Z() { COption_f64Z_free(self); } + COption_f64Z& operator=(COption_f64Z&& o) { COption_f64Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_f64Z)); return *this; } + LDKCOption_f64Z* operator &() { return &self; } + LDKCOption_f64Z* operator ->() { return &self; } + const LDKCOption_f64Z* operator &() const { return &self; } + const LDKCOption_f64Z* operator ->() const { return &self; } }; class CResult_ChannelDetailsDecodeErrorZ { private: @@ -9573,35 +10159,35 @@ class CResult_TxRemoveInputDecodeErrorZ { const LDKCResult_TxRemoveInputDecodeErrorZ* operator &() const { return &self; } const LDKCResult_TxRemoveInputDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { +class CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { private: - LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ self; + LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ self; public: - CResult_CounterpartyChannelTransactionParametersDecodeErrorZ(const CResult_CounterpartyChannelTransactionParametersDecodeErrorZ&) = delete; - CResult_CounterpartyChannelTransactionParametersDecodeErrorZ(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); } - CResult_CounterpartyChannelTransactionParametersDecodeErrorZ(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); } - operator LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ() && { LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); return res; } - ~CResult_CounterpartyChannelTransactionParametersDecodeErrorZ() { CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(self); } - CResult_CounterpartyChannelTransactionParametersDecodeErrorZ& operator=(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ&& o) { CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); return *this; } - LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator &() { return &self; } - LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator ->() const { return &self; } + CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ(const CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ&) = delete; + CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ(CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ)); } + CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ(LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ)); } + operator LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ() && { LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ)); return res; } + ~CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ() { CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(self); } + CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ& operator=(CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ&& o) { CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ)); return *this; } + LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ* operator &() { return &self; } + LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ* operator ->() const { return &self; } }; -class COption_PaymentIdZ { +class CResult_OffersMessageDecodeErrorZ { private: - LDKCOption_PaymentIdZ self; + LDKCResult_OffersMessageDecodeErrorZ self; public: - COption_PaymentIdZ(const COption_PaymentIdZ&) = delete; - COption_PaymentIdZ(COption_PaymentIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_PaymentIdZ)); } - COption_PaymentIdZ(LDKCOption_PaymentIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_PaymentIdZ)); } - operator LDKCOption_PaymentIdZ() && { LDKCOption_PaymentIdZ res = self; memset(&self, 0, sizeof(LDKCOption_PaymentIdZ)); return res; } - ~COption_PaymentIdZ() { COption_PaymentIdZ_free(self); } - COption_PaymentIdZ& operator=(COption_PaymentIdZ&& o) { COption_PaymentIdZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_PaymentIdZ)); return *this; } - LDKCOption_PaymentIdZ* operator &() { return &self; } - LDKCOption_PaymentIdZ* operator ->() { return &self; } - const LDKCOption_PaymentIdZ* operator &() const { return &self; } - const LDKCOption_PaymentIdZ* operator ->() const { return &self; } + CResult_OffersMessageDecodeErrorZ(const CResult_OffersMessageDecodeErrorZ&) = delete; + CResult_OffersMessageDecodeErrorZ(CResult_OffersMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OffersMessageDecodeErrorZ)); } + CResult_OffersMessageDecodeErrorZ(LDKCResult_OffersMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OffersMessageDecodeErrorZ)); } + operator LDKCResult_OffersMessageDecodeErrorZ() && { LDKCResult_OffersMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OffersMessageDecodeErrorZ)); return res; } + ~CResult_OffersMessageDecodeErrorZ() { CResult_OffersMessageDecodeErrorZ_free(self); } + CResult_OffersMessageDecodeErrorZ& operator=(CResult_OffersMessageDecodeErrorZ&& o) { CResult_OffersMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OffersMessageDecodeErrorZ)); return *this; } + LDKCResult_OffersMessageDecodeErrorZ* operator &() { return &self; } + LDKCResult_OffersMessageDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OffersMessageDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OffersMessageDecodeErrorZ* operator ->() const { return &self; } }; class C2Tuple_u64u64Z { private: @@ -9618,6 +10204,21 @@ class C2Tuple_u64u64Z { const LDKC2Tuple_u64u64Z* operator &() const { return &self; } const LDKC2Tuple_u64u64Z* operator ->() const { return &self; } }; +class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { +private: + LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ self; +public: + CResult_CounterpartyChannelTransactionParametersDecodeErrorZ(const CResult_CounterpartyChannelTransactionParametersDecodeErrorZ&) = delete; + CResult_CounterpartyChannelTransactionParametersDecodeErrorZ(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); } + CResult_CounterpartyChannelTransactionParametersDecodeErrorZ(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); } + operator LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ() && { LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); return res; } + ~CResult_CounterpartyChannelTransactionParametersDecodeErrorZ() { CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(self); } + CResult_CounterpartyChannelTransactionParametersDecodeErrorZ& operator=(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ&& o) { CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); return *this; } + LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator &() { return &self; } + LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator ->() const { return &self; } +}; class CResult_RecipientOnionFieldsDecodeErrorZ { private: LDKCResult_RecipientOnionFieldsDecodeErrorZ self; @@ -9663,21 +10264,6 @@ class CVec_UtxoZ { const LDKCVec_UtxoZ* operator &() const { return &self; } const LDKCVec_UtxoZ* operator ->() const { return &self; } }; -class CResult_PaymentSecretNoneZ { -private: - LDKCResult_PaymentSecretNoneZ self; -public: - CResult_PaymentSecretNoneZ(const CResult_PaymentSecretNoneZ&) = delete; - CResult_PaymentSecretNoneZ(CResult_PaymentSecretNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentSecretNoneZ)); } - CResult_PaymentSecretNoneZ(LDKCResult_PaymentSecretNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentSecretNoneZ)); } - operator LDKCResult_PaymentSecretNoneZ() && { LDKCResult_PaymentSecretNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentSecretNoneZ)); return res; } - ~CResult_PaymentSecretNoneZ() { CResult_PaymentSecretNoneZ_free(self); } - CResult_PaymentSecretNoneZ& operator=(CResult_PaymentSecretNoneZ&& o) { CResult_PaymentSecretNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentSecretNoneZ)); return *this; } - LDKCResult_PaymentSecretNoneZ* operator &() { return &self; } - LDKCResult_PaymentSecretNoneZ* operator ->() { return &self; } - const LDKCResult_PaymentSecretNoneZ* operator &() const { return &self; } - const LDKCResult_PaymentSecretNoneZ* operator ->() const { return &self; } -}; class CResult_ChannelConfigDecodeErrorZ { private: LDKCResult_ChannelConfigDecodeErrorZ self; @@ -9723,20 +10309,20 @@ class COption_i64Z { const LDKCOption_i64Z* operator &() const { return &self; } const LDKCOption_i64Z* operator ->() const { return &self; } }; -class CResult_BlindedPathNoneZ { +class C2Tuple_ThirtyTwoBytesChannelManagerZ { private: - LDKCResult_BlindedPathNoneZ self; + LDKC2Tuple_ThirtyTwoBytesChannelManagerZ self; public: - CResult_BlindedPathNoneZ(const CResult_BlindedPathNoneZ&) = delete; - CResult_BlindedPathNoneZ(CResult_BlindedPathNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedPathNoneZ)); } - CResult_BlindedPathNoneZ(LDKCResult_BlindedPathNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedPathNoneZ)); } - operator LDKCResult_BlindedPathNoneZ() && { LDKCResult_BlindedPathNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedPathNoneZ)); return res; } - ~CResult_BlindedPathNoneZ() { CResult_BlindedPathNoneZ_free(self); } - CResult_BlindedPathNoneZ& operator=(CResult_BlindedPathNoneZ&& o) { CResult_BlindedPathNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedPathNoneZ)); return *this; } - LDKCResult_BlindedPathNoneZ* operator &() { return &self; } - LDKCResult_BlindedPathNoneZ* operator ->() { return &self; } - const LDKCResult_BlindedPathNoneZ* operator &() const { return &self; } - const LDKCResult_BlindedPathNoneZ* operator ->() const { return &self; } + C2Tuple_ThirtyTwoBytesChannelManagerZ(const C2Tuple_ThirtyTwoBytesChannelManagerZ&) = delete; + C2Tuple_ThirtyTwoBytesChannelManagerZ(C2Tuple_ThirtyTwoBytesChannelManagerZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesChannelManagerZ)); } + C2Tuple_ThirtyTwoBytesChannelManagerZ(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ)); } + operator LDKC2Tuple_ThirtyTwoBytesChannelManagerZ() && { LDKC2Tuple_ThirtyTwoBytesChannelManagerZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ)); return res; } + ~C2Tuple_ThirtyTwoBytesChannelManagerZ() { C2Tuple_ThirtyTwoBytesChannelManagerZ_free(self); } + C2Tuple_ThirtyTwoBytesChannelManagerZ& operator=(C2Tuple_ThirtyTwoBytesChannelManagerZ&& o) { C2Tuple_ThirtyTwoBytesChannelManagerZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_ThirtyTwoBytesChannelManagerZ)); return *this; } + LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* operator &() { return &self; } + LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* operator ->() { return &self; } + const LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* operator &() const { return &self; } + const LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* operator ->() const { return &self; } }; class CResult_ShutdownDecodeErrorZ { private: @@ -9753,6 +10339,21 @@ class CResult_ShutdownDecodeErrorZ { const LDKCResult_ShutdownDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ShutdownDecodeErrorZ* operator ->() const { return &self; } }; +class C2Tuple_u64CVec_u8ZZ { +private: + LDKC2Tuple_u64CVec_u8ZZ self; +public: + C2Tuple_u64CVec_u8ZZ(const C2Tuple_u64CVec_u8ZZ&) = delete; + C2Tuple_u64CVec_u8ZZ(C2Tuple_u64CVec_u8ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u64CVec_u8ZZ)); } + C2Tuple_u64CVec_u8ZZ(LDKC2Tuple_u64CVec_u8ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u64CVec_u8ZZ)); } + operator LDKC2Tuple_u64CVec_u8ZZ() && { LDKC2Tuple_u64CVec_u8ZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_u64CVec_u8ZZ)); return res; } + ~C2Tuple_u64CVec_u8ZZ() { C2Tuple_u64CVec_u8ZZ_free(self); } + C2Tuple_u64CVec_u8ZZ& operator=(C2Tuple_u64CVec_u8ZZ&& o) { C2Tuple_u64CVec_u8ZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_u64CVec_u8ZZ)); return *this; } + LDKC2Tuple_u64CVec_u8ZZ* operator &() { return &self; } + LDKC2Tuple_u64CVec_u8ZZ* operator ->() { return &self; } + const LDKC2Tuple_u64CVec_u8ZZ* operator &() const { return &self; } + const LDKC2Tuple_u64CVec_u8ZZ* operator ->() const { return &self; } +}; class CResult_OfferBolt12ParseErrorZ { private: LDKCResult_OfferBolt12ParseErrorZ self; @@ -9768,20 +10369,20 @@ class CResult_OfferBolt12ParseErrorZ { const LDKCResult_OfferBolt12ParseErrorZ* operator &() const { return &self; } const LDKCResult_OfferBolt12ParseErrorZ* operator ->() const { return &self; } }; -class CResult_TxOutUtxoLookupErrorZ { +class CResult_ThirtyTwoBytesRetryableSendFailureZ { private: - LDKCResult_TxOutUtxoLookupErrorZ self; + LDKCResult_ThirtyTwoBytesRetryableSendFailureZ self; public: - CResult_TxOutUtxoLookupErrorZ(const CResult_TxOutUtxoLookupErrorZ&) = delete; - CResult_TxOutUtxoLookupErrorZ(CResult_TxOutUtxoLookupErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxOutUtxoLookupErrorZ)); } - CResult_TxOutUtxoLookupErrorZ(LDKCResult_TxOutUtxoLookupErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxOutUtxoLookupErrorZ)); } - operator LDKCResult_TxOutUtxoLookupErrorZ() && { LDKCResult_TxOutUtxoLookupErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxOutUtxoLookupErrorZ)); return res; } - ~CResult_TxOutUtxoLookupErrorZ() { CResult_TxOutUtxoLookupErrorZ_free(self); } - CResult_TxOutUtxoLookupErrorZ& operator=(CResult_TxOutUtxoLookupErrorZ&& o) { CResult_TxOutUtxoLookupErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxOutUtxoLookupErrorZ)); return *this; } - LDKCResult_TxOutUtxoLookupErrorZ* operator &() { return &self; } - LDKCResult_TxOutUtxoLookupErrorZ* operator ->() { return &self; } - const LDKCResult_TxOutUtxoLookupErrorZ* operator &() const { return &self; } - const LDKCResult_TxOutUtxoLookupErrorZ* operator ->() const { return &self; } + CResult_ThirtyTwoBytesRetryableSendFailureZ(const CResult_ThirtyTwoBytesRetryableSendFailureZ&) = delete; + CResult_ThirtyTwoBytesRetryableSendFailureZ(CResult_ThirtyTwoBytesRetryableSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ThirtyTwoBytesRetryableSendFailureZ)); } + CResult_ThirtyTwoBytesRetryableSendFailureZ(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ)); } + operator LDKCResult_ThirtyTwoBytesRetryableSendFailureZ() && { LDKCResult_ThirtyTwoBytesRetryableSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ)); return res; } + ~CResult_ThirtyTwoBytesRetryableSendFailureZ() { CResult_ThirtyTwoBytesRetryableSendFailureZ_free(self); } + CResult_ThirtyTwoBytesRetryableSendFailureZ& operator=(CResult_ThirtyTwoBytesRetryableSendFailureZ&& o) { CResult_ThirtyTwoBytesRetryableSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ThirtyTwoBytesRetryableSendFailureZ)); return *this; } + LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* operator &() { return &self; } + LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* operator ->() { return &self; } + const LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* operator &() const { return &self; } + const LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* operator ->() const { return &self; } }; class CVec_MonitorEventZ { private: @@ -9798,21 +10399,6 @@ class CVec_MonitorEventZ { const LDKCVec_MonitorEventZ* operator &() const { return &self; } const LDKCVec_MonitorEventZ* operator ->() const { return &self; } }; -class CVec_PaymentPreimageZ { -private: - LDKCVec_PaymentPreimageZ self; -public: - CVec_PaymentPreimageZ(const CVec_PaymentPreimageZ&) = delete; - CVec_PaymentPreimageZ(CVec_PaymentPreimageZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PaymentPreimageZ)); } - CVec_PaymentPreimageZ(LDKCVec_PaymentPreimageZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PaymentPreimageZ)); } - operator LDKCVec_PaymentPreimageZ() && { LDKCVec_PaymentPreimageZ res = self; memset(&self, 0, sizeof(LDKCVec_PaymentPreimageZ)); return res; } - ~CVec_PaymentPreimageZ() { CVec_PaymentPreimageZ_free(self); } - CVec_PaymentPreimageZ& operator=(CVec_PaymentPreimageZ&& o) { CVec_PaymentPreimageZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PaymentPreimageZ)); return *this; } - LDKCVec_PaymentPreimageZ* operator &() { return &self; } - LDKCVec_PaymentPreimageZ* operator ->() { return &self; } - const LDKCVec_PaymentPreimageZ* operator &() const { return &self; } - const LDKCVec_PaymentPreimageZ* operator ->() const { return &self; } -}; class CResult_BigSizeDecodeErrorZ { private: LDKCResult_BigSizeDecodeErrorZ self; @@ -9828,20 +10414,50 @@ class CResult_BigSizeDecodeErrorZ { const LDKCResult_BigSizeDecodeErrorZ* operator &() const { return &self; } const LDKCResult_BigSizeDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_PublicKeyErrorZ { +class CResult_TxOutUtxoLookupErrorZ { +private: + LDKCResult_TxOutUtxoLookupErrorZ self; +public: + CResult_TxOutUtxoLookupErrorZ(const CResult_TxOutUtxoLookupErrorZ&) = delete; + CResult_TxOutUtxoLookupErrorZ(CResult_TxOutUtxoLookupErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxOutUtxoLookupErrorZ)); } + CResult_TxOutUtxoLookupErrorZ(LDKCResult_TxOutUtxoLookupErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxOutUtxoLookupErrorZ)); } + operator LDKCResult_TxOutUtxoLookupErrorZ() && { LDKCResult_TxOutUtxoLookupErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxOutUtxoLookupErrorZ)); return res; } + ~CResult_TxOutUtxoLookupErrorZ() { CResult_TxOutUtxoLookupErrorZ_free(self); } + CResult_TxOutUtxoLookupErrorZ& operator=(CResult_TxOutUtxoLookupErrorZ&& o) { CResult_TxOutUtxoLookupErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxOutUtxoLookupErrorZ)); return *this; } + LDKCResult_TxOutUtxoLookupErrorZ* operator &() { return &self; } + LDKCResult_TxOutUtxoLookupErrorZ* operator ->() { return &self; } + const LDKCResult_TxOutUtxoLookupErrorZ* operator &() const { return &self; } + const LDKCResult_TxOutUtxoLookupErrorZ* operator ->() const { return &self; } +}; +class CResult_BlindedPathNoneZ { +private: + LDKCResult_BlindedPathNoneZ self; +public: + CResult_BlindedPathNoneZ(const CResult_BlindedPathNoneZ&) = delete; + CResult_BlindedPathNoneZ(CResult_BlindedPathNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedPathNoneZ)); } + CResult_BlindedPathNoneZ(LDKCResult_BlindedPathNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedPathNoneZ)); } + operator LDKCResult_BlindedPathNoneZ() && { LDKCResult_BlindedPathNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedPathNoneZ)); return res; } + ~CResult_BlindedPathNoneZ() { CResult_BlindedPathNoneZ_free(self); } + CResult_BlindedPathNoneZ& operator=(CResult_BlindedPathNoneZ&& o) { CResult_BlindedPathNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedPathNoneZ)); return *this; } + LDKCResult_BlindedPathNoneZ* operator &() { return &self; } + LDKCResult_BlindedPathNoneZ* operator ->() { return &self; } + const LDKCResult_BlindedPathNoneZ* operator &() const { return &self; } + const LDKCResult_BlindedPathNoneZ* operator ->() const { return &self; } +}; +class COption_usizeZ { private: - LDKCResult_PublicKeyErrorZ self; + LDKCOption_usizeZ self; public: - CResult_PublicKeyErrorZ(const CResult_PublicKeyErrorZ&) = delete; - CResult_PublicKeyErrorZ(CResult_PublicKeyErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PublicKeyErrorZ)); } - CResult_PublicKeyErrorZ(LDKCResult_PublicKeyErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PublicKeyErrorZ)); } - operator LDKCResult_PublicKeyErrorZ() && { LDKCResult_PublicKeyErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PublicKeyErrorZ)); return res; } - ~CResult_PublicKeyErrorZ() { CResult_PublicKeyErrorZ_free(self); } - CResult_PublicKeyErrorZ& operator=(CResult_PublicKeyErrorZ&& o) { CResult_PublicKeyErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PublicKeyErrorZ)); return *this; } - LDKCResult_PublicKeyErrorZ* operator &() { return &self; } - LDKCResult_PublicKeyErrorZ* operator ->() { return &self; } - const LDKCResult_PublicKeyErrorZ* operator &() const { return &self; } - const LDKCResult_PublicKeyErrorZ* operator ->() const { return &self; } + COption_usizeZ(const COption_usizeZ&) = delete; + COption_usizeZ(COption_usizeZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_usizeZ)); } + COption_usizeZ(LDKCOption_usizeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_usizeZ)); } + operator LDKCOption_usizeZ() && { LDKCOption_usizeZ res = self; memset(&self, 0, sizeof(LDKCOption_usizeZ)); return res; } + ~COption_usizeZ() { COption_usizeZ_free(self); } + COption_usizeZ& operator=(COption_usizeZ&& o) { COption_usizeZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_usizeZ)); return *this; } + LDKCOption_usizeZ* operator &() { return &self; } + LDKCOption_usizeZ* operator ->() { return &self; } + const LDKCOption_usizeZ* operator &() const { return &self; } + const LDKCOption_usizeZ* operator ->() const { return &self; } }; class CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ { private: @@ -9948,35 +10564,20 @@ class COption_ClosureReasonZ { const LDKCOption_ClosureReasonZ* operator &() const { return &self; } const LDKCOption_ClosureReasonZ* operator ->() const { return &self; } }; -class COption_u128Z { -private: - LDKCOption_u128Z self; -public: - COption_u128Z(const COption_u128Z&) = delete; - COption_u128Z(COption_u128Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_u128Z)); } - COption_u128Z(LDKCOption_u128Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_u128Z)); } - operator LDKCOption_u128Z() && { LDKCOption_u128Z res = self; memset(&self, 0, sizeof(LDKCOption_u128Z)); return res; } - ~COption_u128Z() { COption_u128Z_free(self); } - COption_u128Z& operator=(COption_u128Z&& o) { COption_u128Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_u128Z)); return *this; } - LDKCOption_u128Z* operator &() { return &self; } - LDKCOption_u128Z* operator ->() { return &self; } - const LDKCOption_u128Z* operator &() const { return &self; } - const LDKCOption_u128Z* operator ->() const { return &self; } -}; -class CVec_AddressZ { +class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { private: - LDKCVec_AddressZ self; + LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ self; public: - CVec_AddressZ(const CVec_AddressZ&) = delete; - CVec_AddressZ(CVec_AddressZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_AddressZ)); } - CVec_AddressZ(LDKCVec_AddressZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_AddressZ)); } - operator LDKCVec_AddressZ() && { LDKCVec_AddressZ res = self; memset(&self, 0, sizeof(LDKCVec_AddressZ)); return res; } - ~CVec_AddressZ() { CVec_AddressZ_free(self); } - CVec_AddressZ& operator=(CVec_AddressZ&& o) { CVec_AddressZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_AddressZ)); return *this; } - LDKCVec_AddressZ* operator &() { return &self; } - LDKCVec_AddressZ* operator ->() { return &self; } - const LDKCVec_AddressZ* operator &() const { return &self; } - const LDKCVec_AddressZ* operator ->() const { return &self; } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ(const CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ&) = delete; + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ)); } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ)); } + operator LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ() && { LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ)); return res; } + ~CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ() { CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(self); } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ& operator=(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ&& o) { CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ)); return *this; } + LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* operator &() { return &self; } + LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* operator ->() const { return &self; } }; class CResult_TransactionU16LenLimitedDecodeErrorZ { private: @@ -9993,6 +10594,21 @@ class CResult_TransactionU16LenLimitedDecodeErrorZ { const LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator &() const { return &self; } const LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { +private: + LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ self; +public: + CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ(const CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ&) = delete; + CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ(CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ)); } + CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ)); } + operator LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ() && { LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ)); return res; } + ~CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ() { CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(self); } + CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ& operator=(CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ&& o) { CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ)); return *this; } + LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* operator &() { return &self; } + LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* operator ->() const { return &self; } +}; class CResult_CounterpartyForwardingInfoDecodeErrorZ { private: LDKCResult_CounterpartyForwardingInfoDecodeErrorZ self; @@ -10023,35 +10639,35 @@ class CResult_OpenChannelV2DecodeErrorZ { const LDKCResult_OpenChannelV2DecodeErrorZ* operator &() const { return &self; } const LDKCResult_OpenChannelV2DecodeErrorZ* operator ->() const { return &self; } }; -class C2Tuple_u32ScriptZ { +class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { private: - LDKC2Tuple_u32ScriptZ self; + LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ self; public: - C2Tuple_u32ScriptZ(const C2Tuple_u32ScriptZ&) = delete; - C2Tuple_u32ScriptZ(C2Tuple_u32ScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u32ScriptZ)); } - C2Tuple_u32ScriptZ(LDKC2Tuple_u32ScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u32ScriptZ)); } - operator LDKC2Tuple_u32ScriptZ() && { LDKC2Tuple_u32ScriptZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_u32ScriptZ)); return res; } - ~C2Tuple_u32ScriptZ() { C2Tuple_u32ScriptZ_free(self); } - C2Tuple_u32ScriptZ& operator=(C2Tuple_u32ScriptZ&& o) { C2Tuple_u32ScriptZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_u32ScriptZ)); return *this; } - LDKC2Tuple_u32ScriptZ* operator &() { return &self; } - LDKC2Tuple_u32ScriptZ* operator ->() { return &self; } - const LDKC2Tuple_u32ScriptZ* operator &() const { return &self; } - const LDKC2Tuple_u32ScriptZ* operator ->() const { return &self; } + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ(const CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ&) = delete; + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ)); } + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ)); } + operator LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ() && { LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ)); return res; } + ~CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ() { CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(self); } + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ& operator=(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ&& o) { CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ)); return *this; } + LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* operator &() { return &self; } + LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* operator ->() const { return &self; } }; -class COption_C2Tuple_EightU16sEightU16sZZ { +class C2Tuple_PublicKeyOnionMessageZ { private: - LDKCOption_C2Tuple_EightU16sEightU16sZZ self; + LDKC2Tuple_PublicKeyOnionMessageZ self; public: - COption_C2Tuple_EightU16sEightU16sZZ(const COption_C2Tuple_EightU16sEightU16sZZ&) = delete; - COption_C2Tuple_EightU16sEightU16sZZ(COption_C2Tuple_EightU16sEightU16sZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_EightU16sEightU16sZZ)); } - COption_C2Tuple_EightU16sEightU16sZZ(LDKCOption_C2Tuple_EightU16sEightU16sZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ)); } - operator LDKCOption_C2Tuple_EightU16sEightU16sZZ() && { LDKCOption_C2Tuple_EightU16sEightU16sZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ)); return res; } - ~COption_C2Tuple_EightU16sEightU16sZZ() { COption_C2Tuple_EightU16sEightU16sZZ_free(self); } - COption_C2Tuple_EightU16sEightU16sZZ& operator=(COption_C2Tuple_EightU16sEightU16sZZ&& o) { COption_C2Tuple_EightU16sEightU16sZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_EightU16sEightU16sZZ)); return *this; } - LDKCOption_C2Tuple_EightU16sEightU16sZZ* operator &() { return &self; } - LDKCOption_C2Tuple_EightU16sEightU16sZZ* operator ->() { return &self; } - const LDKCOption_C2Tuple_EightU16sEightU16sZZ* operator &() const { return &self; } - const LDKCOption_C2Tuple_EightU16sEightU16sZZ* operator ->() const { return &self; } + C2Tuple_PublicKeyOnionMessageZ(const C2Tuple_PublicKeyOnionMessageZ&) = delete; + C2Tuple_PublicKeyOnionMessageZ(C2Tuple_PublicKeyOnionMessageZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PublicKeyOnionMessageZ)); } + C2Tuple_PublicKeyOnionMessageZ(LDKC2Tuple_PublicKeyOnionMessageZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PublicKeyOnionMessageZ)); } + operator LDKC2Tuple_PublicKeyOnionMessageZ() && { LDKC2Tuple_PublicKeyOnionMessageZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PublicKeyOnionMessageZ)); return res; } + ~C2Tuple_PublicKeyOnionMessageZ() { C2Tuple_PublicKeyOnionMessageZ_free(self); } + C2Tuple_PublicKeyOnionMessageZ& operator=(C2Tuple_PublicKeyOnionMessageZ&& o) { C2Tuple_PublicKeyOnionMessageZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PublicKeyOnionMessageZ)); return *this; } + LDKC2Tuple_PublicKeyOnionMessageZ* operator &() { return &self; } + LDKC2Tuple_PublicKeyOnionMessageZ* operator ->() { return &self; } + const LDKC2Tuple_PublicKeyOnionMessageZ* operator &() const { return &self; } + const LDKC2Tuple_PublicKeyOnionMessageZ* operator ->() const { return &self; } }; class CResult_RouteDecodeErrorZ { private: @@ -10068,6 +10684,21 @@ class CResult_RouteDecodeErrorZ { const LDKCResult_RouteDecodeErrorZ* operator &() const { return &self; } const LDKCResult_RouteDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { +private: + LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ self; +public: + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ(const CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ&) = delete; + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ)); } + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ)); } + operator LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ() && { LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ)); return res; } + ~CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ() { CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(self); } + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ& operator=(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ&& o) { CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ)); return *this; } + LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* operator &() { return &self; } + LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* operator ->() { return &self; } + const LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* operator &() const { return &self; } + const LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* operator ->() const { return &self; } +}; class COption_NoneZ { private: LDKCOption_NoneZ self; @@ -10122,7 +10753,7 @@ inline LDKThirtyTwoBytes ChannelSigner::release_commitment_secret(uint64_t idx) LDKThirtyTwoBytes ret = (self.release_commitment_secret)(self.this_arg, idx); return ret; } -inline LDK::CResult_NoneNoneZ ChannelSigner::validate_holder_commitment(const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages) { +inline LDK::CResult_NoneNoneZ ChannelSigner::validate_holder_commitment(const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_ThirtyTwoBytesZ preimages) { LDK::CResult_NoneNoneZ ret = (self.validate_holder_commitment)(self.this_arg, holder_tx, preimages); return ret; } @@ -10133,44 +10764,44 @@ inline LDKThirtyTwoBytes ChannelSigner::channel_keys_id() { inline void ChannelSigner::provide_channel_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters) { (self.provide_channel_parameters)(self.this_arg, channel_parameters); } -inline LDK::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ EcdsaChannelSigner::sign_counterparty_commitment(const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages) { - LDK::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = (self.sign_counterparty_commitment)(self.this_arg, commitment_tx, preimages); +inline LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ EcdsaChannelSigner::sign_counterparty_commitment(const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ preimages) { + LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret = (self.sign_counterparty_commitment)(self.this_arg, commitment_tx, preimages); return ret; } inline LDK::CResult_NoneNoneZ EcdsaChannelSigner::validate_counterparty_revocation(uint64_t idx, const uint8_t (*secret)[32]) { LDK::CResult_NoneNoneZ ret = (self.validate_counterparty_revocation)(self.this_arg, idx, secret); return ret; } -inline LDK::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ EcdsaChannelSigner::sign_holder_commitment_and_htlcs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx) { - LDK::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = (self.sign_holder_commitment_and_htlcs)(self.this_arg, commitment_tx); +inline LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ EcdsaChannelSigner::sign_holder_commitment_and_htlcs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx) { + LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret = (self.sign_holder_commitment_and_htlcs)(self.this_arg, commitment_tx); return ret; } -inline LDK::CResult_SignatureNoneZ EcdsaChannelSigner::sign_justice_revoked_output(struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]) { - LDK::CResult_SignatureNoneZ ret = (self.sign_justice_revoked_output)(self.this_arg, justice_tx, input, amount, per_commitment_key); +inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_justice_revoked_output(struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]) { + LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_justice_revoked_output)(self.this_arg, justice_tx, input, amount, per_commitment_key); return ret; } -inline LDK::CResult_SignatureNoneZ EcdsaChannelSigner::sign_justice_revoked_htlc(struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc) { - LDK::CResult_SignatureNoneZ ret = (self.sign_justice_revoked_htlc)(self.this_arg, justice_tx, input, amount, per_commitment_key, htlc); +inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_justice_revoked_htlc(struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc) { + LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_justice_revoked_htlc)(self.this_arg, justice_tx, input, amount, per_commitment_key, htlc); return ret; } -inline LDK::CResult_SignatureNoneZ EcdsaChannelSigner::sign_holder_htlc_transaction(struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor) { - LDK::CResult_SignatureNoneZ ret = (self.sign_holder_htlc_transaction)(self.this_arg, htlc_tx, input, htlc_descriptor); +inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_holder_htlc_transaction(struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor) { + LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_holder_htlc_transaction)(self.this_arg, htlc_tx, input, htlc_descriptor); return ret; } -inline LDK::CResult_SignatureNoneZ EcdsaChannelSigner::sign_counterparty_htlc_transaction(struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc) { - LDK::CResult_SignatureNoneZ ret = (self.sign_counterparty_htlc_transaction)(self.this_arg, htlc_tx, input, amount, per_commitment_point, htlc); +inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_counterparty_htlc_transaction(struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc) { + LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_counterparty_htlc_transaction)(self.this_arg, htlc_tx, input, amount, per_commitment_point, htlc); return ret; } -inline LDK::CResult_SignatureNoneZ EcdsaChannelSigner::sign_closing_transaction(const struct LDKClosingTransaction *NONNULL_PTR closing_tx) { - LDK::CResult_SignatureNoneZ ret = (self.sign_closing_transaction)(self.this_arg, closing_tx); +inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_closing_transaction(const struct LDKClosingTransaction *NONNULL_PTR closing_tx) { + LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_closing_transaction)(self.this_arg, closing_tx); return ret; } -inline LDK::CResult_SignatureNoneZ EcdsaChannelSigner::sign_holder_anchor_input(struct LDKTransaction anchor_tx, uintptr_t input) { - LDK::CResult_SignatureNoneZ ret = (self.sign_holder_anchor_input)(self.this_arg, anchor_tx, input); +inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_holder_anchor_input(struct LDKTransaction anchor_tx, uintptr_t input) { + LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_holder_anchor_input)(self.this_arg, anchor_tx, input); return ret; } -inline LDK::CResult_SignatureNoneZ EcdsaChannelSigner::sign_channel_announcement_with_funding_key(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg) { - LDK::CResult_SignatureNoneZ ret = (self.sign_channel_announcement_with_funding_key)(self.this_arg, msg); +inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_channel_announcement_with_funding_key(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg) { + LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_channel_announcement_with_funding_key)(self.this_arg, msg); return ret; } inline LDKThirtyTwoBytes EntropySource::get_secure_random_bytes() { @@ -10185,16 +10816,24 @@ inline LDK::CResult_PublicKeyNoneZ NodeSigner::get_node_id(enum LDKRecipient rec LDK::CResult_PublicKeyNoneZ ret = (self.get_node_id)(self.this_arg, recipient); return ret; } -inline LDK::CResult_SharedSecretNoneZ NodeSigner::ecdh(enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak) { - LDK::CResult_SharedSecretNoneZ ret = (self.ecdh)(self.this_arg, recipient, other_key, tweak); +inline LDK::CResult_ThirtyTwoBytesNoneZ NodeSigner::ecdh(enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_BigEndianScalarZ tweak) { + LDK::CResult_ThirtyTwoBytesNoneZ ret = (self.ecdh)(self.this_arg, recipient, other_key, tweak); return ret; } inline LDK::CResult_RecoverableSignatureNoneZ NodeSigner::sign_invoice(struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient recipient) { LDK::CResult_RecoverableSignatureNoneZ ret = (self.sign_invoice)(self.this_arg, hrp_bytes, invoice_data, recipient); return ret; } -inline LDK::CResult_SignatureNoneZ NodeSigner::sign_gossip_message(struct LDKUnsignedGossipMessage msg) { - LDK::CResult_SignatureNoneZ ret = (self.sign_gossip_message)(self.this_arg, msg); +inline LDK::CResult_SchnorrSignatureNoneZ NodeSigner::sign_bolt12_invoice_request(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR invoice_request) { + LDK::CResult_SchnorrSignatureNoneZ ret = (self.sign_bolt12_invoice_request)(self.this_arg, invoice_request); + return ret; +} +inline LDK::CResult_SchnorrSignatureNoneZ NodeSigner::sign_bolt12_invoice(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR invoice) { + LDK::CResult_SchnorrSignatureNoneZ ret = (self.sign_bolt12_invoice)(self.this_arg, invoice); + return ret; +} +inline LDK::CResult_ECDSASignatureNoneZ NodeSigner::sign_gossip_message(struct LDKUnsignedGossipMessage msg) { + LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_gossip_message)(self.this_arg, msg); return ret; } inline LDKThirtyTwoBytes SignerProvider::generate_channel_keys_id(bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id) { @@ -10209,8 +10848,8 @@ inline LDK::CResult_WriteableEcdsaChannelSignerDecodeErrorZ SignerProvider::read LDK::CResult_WriteableEcdsaChannelSignerDecodeErrorZ ret = (self.read_chan_signer)(self.this_arg, reader); return ret; } -inline LDK::CResult_ScriptNoneZ SignerProvider::get_destination_script() { - LDK::CResult_ScriptNoneZ ret = (self.get_destination_script)(self.this_arg); +inline LDK::CResult_CVec_u8ZNoneZ SignerProvider::get_destination_script() { + LDK::CResult_CVec_u8ZNoneZ ret = (self.get_destination_script)(self.this_arg); return ret; } inline LDK::CResult_ShutdownScriptNoneZ SignerProvider::get_shutdown_scriptpubkey() { @@ -10225,24 +10864,28 @@ inline LDK::CResult_RouteLightningErrorZ Router::find_route_with_id(struct LDKPu LDK::CResult_RouteLightningErrorZ ret = (self.find_route_with_id)(self.this_arg, payer, route_params, first_hops, inflight_htlcs, _payment_hash, _payment_id); return ret; } -inline uint64_t Score::channel_penalty_msat(uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, struct LDKChannelUsage usage, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params) { +inline uint64_t ScoreLookUp::channel_penalty_msat(uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, struct LDKChannelUsage usage, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params) { uint64_t ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, source, target, usage, score_params); return ret; } -inline void Score::payment_path_failed(const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id) { +inline void ScoreUpdate::payment_path_failed(const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id) { (self.payment_path_failed)(self.this_arg, path, short_channel_id); } -inline void Score::payment_path_successful(const struct LDKPath *NONNULL_PTR path) { +inline void ScoreUpdate::payment_path_successful(const struct LDKPath *NONNULL_PTR path) { (self.payment_path_successful)(self.this_arg, path); } -inline void Score::probe_failed(const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id) { +inline void ScoreUpdate::probe_failed(const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id) { (self.probe_failed)(self.this_arg, path, short_channel_id); } -inline void Score::probe_successful(const struct LDKPath *NONNULL_PTR path) { +inline void ScoreUpdate::probe_successful(const struct LDKPath *NONNULL_PTR path) { (self.probe_successful)(self.this_arg, path); } -inline LDK::Score LockableScore::lock() { - LDK::Score ret = (self.lock)(self.this_arg); +inline LDK::ScoreLookUp LockableScore::read_lock() { + LDK::ScoreLookUp ret = (self.read_lock)(self.this_arg); + return ret; +} +inline LDK::ScoreUpdate LockableScore::write_lock() { + LDK::ScoreUpdate ret = (self.write_lock)(self.this_arg); return ret; } inline void Listen::filtered_block_connected(const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) { @@ -10263,12 +10906,12 @@ inline void Confirm::transaction_unconfirmed(const uint8_t (*txid)[32]) { inline void Confirm::best_block_updated(const uint8_t (*header)[80], uint32_t height) { (self.best_block_updated)(self.this_arg, header, height); } -inline LDK::CVec_C2Tuple_TxidCOption_BlockHashZZZ Confirm::get_relevant_txids() { - LDK::CVec_C2Tuple_TxidCOption_BlockHashZZZ ret = (self.get_relevant_txids)(self.this_arg); +inline LDK::CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Confirm::get_relevant_txids() { + LDK::CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret = (self.get_relevant_txids)(self.this_arg); return ret; } -inline LDK::ChannelMonitorUpdateStatus Watch::watch_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor) { - LDK::ChannelMonitorUpdateStatus ret = (self.watch_channel)(self.this_arg, funding_txo, monitor); +inline LDK::CResult_ChannelMonitorUpdateStatusNoneZ Watch::watch_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor) { + LDK::CResult_ChannelMonitorUpdateStatusNoneZ ret = (self.watch_channel)(self.this_arg, funding_txo, monitor); return ret; } inline LDK::ChannelMonitorUpdateStatus Watch::update_channel(struct LDKOutPoint funding_txo, const struct LDKChannelMonitorUpdate *NONNULL_PTR update) { @@ -10297,8 +10940,8 @@ inline LDK::CResult_CVec_UtxoZNoneZ WalletSource::list_confirmed_utxos() { LDK::CResult_CVec_UtxoZNoneZ ret = (self.list_confirmed_utxos)(self.this_arg); return ret; } -inline LDK::CResult_ScriptNoneZ WalletSource::get_change_script() { - LDK::CResult_ScriptNoneZ ret = (self.get_change_script)(self.this_arg); +inline LDK::CResult_CVec_u8ZNoneZ WalletSource::get_change_script() { + LDK::CResult_CVec_u8ZNoneZ ret = (self.get_change_script)(self.this_arg); return ret; } inline LDK::CResult_TransactionNoneZ WalletSource::sign_tx(struct LDKTransaction tx) { @@ -10336,16 +10979,32 @@ inline uint64_t SocketDescriptor::hash() { uint64_t ret = (self.hash)(self.this_arg); return ret; } -inline LDK::CResult_NoneErrorZ Persister::persist_manager(const struct LDKChannelManager *NONNULL_PTR channel_manager) { - LDK::CResult_NoneErrorZ ret = (self.persist_manager)(self.this_arg, channel_manager); +inline LDK::CResult_CVec_u8ZIOErrorZ KVStore::read(struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key) { + LDK::CResult_CVec_u8ZIOErrorZ ret = (self.read)(self.this_arg, primary_namespace, secondary_namespace, key); + return ret; +} +inline LDK::CResult_NoneIOErrorZ KVStore::write(struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key, struct LDKu8slice buf) { + LDK::CResult_NoneIOErrorZ ret = (self.write)(self.this_arg, primary_namespace, secondary_namespace, key, buf); + return ret; +} +inline LDK::CResult_NoneIOErrorZ KVStore::remove(struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key, bool lazy) { + LDK::CResult_NoneIOErrorZ ret = (self.remove)(self.this_arg, primary_namespace, secondary_namespace, key, lazy); + return ret; +} +inline LDK::CResult_CVec_StrZIOErrorZ KVStore::list(struct LDKStr primary_namespace, struct LDKStr secondary_namespace) { + LDK::CResult_CVec_StrZIOErrorZ ret = (self.list)(self.this_arg, primary_namespace, secondary_namespace); + return ret; +} +inline LDK::CResult_NoneIOErrorZ Persister::persist_manager(const struct LDKChannelManager *NONNULL_PTR channel_manager) { + LDK::CResult_NoneIOErrorZ ret = (self.persist_manager)(self.this_arg, channel_manager); return ret; } -inline LDK::CResult_NoneErrorZ Persister::persist_graph(const struct LDKNetworkGraph *NONNULL_PTR network_graph) { - LDK::CResult_NoneErrorZ ret = (self.persist_graph)(self.this_arg, network_graph); +inline LDK::CResult_NoneIOErrorZ Persister::persist_graph(const struct LDKNetworkGraph *NONNULL_PTR network_graph) { + LDK::CResult_NoneIOErrorZ ret = (self.persist_graph)(self.this_arg, network_graph); return ret; } -inline LDK::CResult_NoneErrorZ Persister::persist_scorer(const struct LDKWriteableScore *NONNULL_PTR scorer) { - LDK::CResult_NoneErrorZ ret = (self.persist_scorer)(self.this_arg, scorer); +inline LDK::CResult_NoneIOErrorZ Persister::persist_scorer(const struct LDKWriteableScore *NONNULL_PTR scorer) { + LDK::CResult_NoneIOErrorZ ret = (self.persist_scorer)(self.this_arg, scorer); return ret; } inline void ChannelMessageHandler::handle_open_channel(struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg) { @@ -10450,8 +11109,8 @@ inline LDK::InitFeatures ChannelMessageHandler::provided_init_features(struct LD LDK::InitFeatures ret = (self.provided_init_features)(self.this_arg, their_node_id); return ret; } -inline LDK::COption_CVec_ChainHashZZ ChannelMessageHandler::get_genesis_hashes() { - LDK::COption_CVec_ChainHashZZ ret = (self.get_genesis_hashes)(self.this_arg); +inline LDK::COption_CVec_ThirtyTwoBytesZZ ChannelMessageHandler::get_genesis_hashes() { + LDK::COption_CVec_ThirtyTwoBytesZZ ret = (self.get_genesis_hashes)(self.this_arg); return ret; } inline LDK::CResult_boolLightningErrorZ RoutingMessageHandler::handle_node_announcement(const struct LDKNodeAnnouncement *NONNULL_PTR msg) { diff --git a/lightning-c-bindings/src/c_types/derived.rs b/lightning-c-bindings/src/c_types/derived.rs index b98e1c3a..460823ff 100644 --- a/lightning-c-bindings/src/c_types/derived.rs +++ b/lightning-c-bindings/src/c_types/derived.rs @@ -1,5 +1,6 @@ use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -10,13 +11,13 @@ use alloc::{vec::Vec, boxed::Box}; #[repr(C)] #[derive(Clone)] /// An enum which can either contain a u64 or not -pub enum COption_DurationZ { - /// When we're in this state, this COption_DurationZ contains a u64 +pub enum COption_u64Z { + /// When we're in this state, this COption_u64Z contains a u64 Some(u64), - /// When we're in this state, this COption_DurationZ contains nothing + /// When we're in this state, this COption_u64Z contains nothing None } -impl COption_DurationZ { +impl COption_u64Z { #[allow(unused)] pub(crate) fn is_some(&self) -> bool { if let Self::None = self { false } else { true } } @@ -28,22 +29,22 @@ impl COption_DurationZ { } } #[no_mangle] -/// Constructs a new COption_DurationZ containing a u64 -pub extern "C" fn COption_DurationZ_some(o: u64) -> COption_DurationZ { - COption_DurationZ::Some(o) +/// Constructs a new COption_u64Z containing a u64 +pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z { + COption_u64Z::Some(o) } #[no_mangle] -/// Constructs a new COption_DurationZ containing nothing -pub extern "C" fn COption_DurationZ_none() -> COption_DurationZ { - COption_DurationZ::None +/// Constructs a new COption_u64Z containing nothing +pub extern "C" fn COption_u64Z_none() -> COption_u64Z { + COption_u64Z::None } #[no_mangle] /// Frees any resources associated with the u64, if we are in the Some state -pub extern "C" fn COption_DurationZ_free(_res: COption_DurationZ) { } +pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { } #[no_mangle] -/// Creates a new COption_DurationZ which has the same data as `orig` +/// Creates a new COption_u64Z which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_DurationZ_clone(orig: &COption_DurationZ) -> COption_DurationZ { Clone::clone(&orig) } +pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) } #[repr(C)] /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size. /// This corresponds to std::vector in C++ @@ -91,43 +92,6 @@ impl Clone for CVec_BlindedPathZ { } } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a u64 or not -pub enum COption_u64Z { - /// When we're in this state, this COption_u64Z contains a u64 - Some(u64), - /// When we're in this state, this COption_u64Z contains nothing - None -} -impl COption_u64Z { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } - } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() - } - #[allow(unused)] pub(crate) fn take(mut self) -> u64 { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_u64Z containing a u64 -pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z { - COption_u64Z::Some(o) -} -#[no_mangle] -/// Constructs a new COption_u64Z containing nothing -pub extern "C" fn COption_u64Z_none() -> COption_u64Z { - COption_u64Z::None -} -#[no_mangle] -/// Frees any resources associated with the u64, if we are in the Some state -pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { } -#[no_mangle] -/// Creates a new COption_u64Z which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) } -#[repr(C)] /// The contents of CResult_RefundBolt12ParseErrorZ pub union CResult_RefundBolt12ParseErrorZPtr { /// A pointer to the contents in the success state. @@ -224,6 +188,102 @@ impl Clone for CResult_RefundBolt12ParseErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_RefundBolt12ParseErrorZ_clone(orig: &CResult_RefundBolt12ParseErrorZ) -> CResult_RefundBolt12ParseErrorZ { Clone::clone(&orig) } #[repr(C)] +/// The contents of CResult_RetryDecodeErrorZ +pub union CResult_RetryDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::ln::outbound_payment::Retry, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// A CResult_RetryDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::outbound_payment::Retry on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_RetryDecodeErrorZ { + /// The contents of this CResult_RetryDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_RetryDecodeErrorZPtr, + /// Whether this CResult_RetryDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_RetryDecodeErrorZ in the success state. +pub extern "C" fn CResult_RetryDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::Retry) -> CResult_RetryDecodeErrorZ { + CResult_RetryDecodeErrorZ { + contents: CResult_RetryDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_RetryDecodeErrorZ in the error state. +pub extern "C" fn CResult_RetryDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RetryDecodeErrorZ { + CResult_RetryDecodeErrorZ { + contents: CResult_RetryDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_RetryDecodeErrorZ_is_ok(o: &CResult_RetryDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_RetryDecodeErrorZ. +pub extern "C" fn CResult_RetryDecodeErrorZ_free(_res: CResult_RetryDecodeErrorZ) { } +impl Drop for CResult_RetryDecodeErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_RetryDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_RetryDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_RetryDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_RetryDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_RetryDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_RetryDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_RetryDecodeErrorZ_clone(orig: &CResult_RetryDecodeErrorZ) -> CResult_RetryDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] /// The contents of CResult_NoneAPIErrorZ pub union CResult_NoneAPIErrorZPtr { /// Note that this value is always NULL, as there are no contents in the OK variant @@ -410,13 +470,13 @@ impl Clone for CVec_APIErrorZ { #[repr(C)] #[derive(Clone)] /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not -pub enum COption_PaymentSecretZ { - /// When we're in this state, this COption_PaymentSecretZ contains a crate::c_types::ThirtyTwoBytes +pub enum COption_ThirtyTwoBytesZ { + /// When we're in this state, this COption_ThirtyTwoBytesZ contains a crate::c_types::ThirtyTwoBytes Some(crate::c_types::ThirtyTwoBytes), - /// When we're in this state, this COption_PaymentSecretZ contains nothing + /// When we're in this state, this COption_ThirtyTwoBytesZ contains nothing None } -impl COption_PaymentSecretZ { +impl COption_ThirtyTwoBytesZ { #[allow(unused)] pub(crate) fn is_some(&self) -> bool { if let Self::None = self { false } else { true } } @@ -428,22 +488,22 @@ impl COption_PaymentSecretZ { } } #[no_mangle] -/// Constructs a new COption_PaymentSecretZ containing a crate::c_types::ThirtyTwoBytes -pub extern "C" fn COption_PaymentSecretZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_PaymentSecretZ { - COption_PaymentSecretZ::Some(o) +/// Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes +pub extern "C" fn COption_ThirtyTwoBytesZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_ThirtyTwoBytesZ { + COption_ThirtyTwoBytesZ::Some(o) } #[no_mangle] -/// Constructs a new COption_PaymentSecretZ containing nothing -pub extern "C" fn COption_PaymentSecretZ_none() -> COption_PaymentSecretZ { - COption_PaymentSecretZ::None +/// Constructs a new COption_ThirtyTwoBytesZ containing nothing +pub extern "C" fn COption_ThirtyTwoBytesZ_none() -> COption_ThirtyTwoBytesZ { + COption_ThirtyTwoBytesZ::None } #[no_mangle] /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state -pub extern "C" fn COption_PaymentSecretZ_free(_res: COption_PaymentSecretZ) { } +pub extern "C" fn COption_ThirtyTwoBytesZ_free(_res: COption_ThirtyTwoBytesZ) { } #[no_mangle] -/// Creates a new COption_PaymentSecretZ which has the same data as `orig` +/// Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_PaymentSecretZ_clone(orig: &COption_PaymentSecretZ) -> COption_PaymentSecretZ { Clone::clone(&orig) } +pub extern "C" fn COption_ThirtyTwoBytesZ_clone(orig: &COption_ThirtyTwoBytesZ) -> COption_ThirtyTwoBytesZ { Clone::clone(&orig) } #[repr(C)] /// A dynamically-allocated array of u8s of arbitrary size. /// This corresponds to std::vector in C++ @@ -624,77 +684,161 @@ impl Clone for CResult_RecipientOnionFieldsDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig: &CResult_RecipientOnionFieldsDecodeErrorZ) -> CResult_RecipientOnionFieldsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BlindedPayInfoDecodeErrorZ -pub union CResult_BlindedPayInfoDecodeErrorZPtr { +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_u64CVec_u8ZZ { + /// The element at position 0 + pub a: u64, + /// The element at position 1 + pub b: crate::c_types::derived::CVec_u8Z, +} +impl From<(u64, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u64CVec_u8ZZ { + fn from (tup: (u64, crate::c_types::derived::CVec_u8Z)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_u64CVec_u8ZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, crate::c_types::derived::CVec_u8Z) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_u64CVec_u8ZZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } + } +} +#[no_mangle] +/// Creates a new tuple which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn C2Tuple_u64CVec_u8ZZ_clone(orig: &C2Tuple_u64CVec_u8ZZ) -> C2Tuple_u64CVec_u8ZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_u64CVec_u8ZZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_u64CVec_u8ZZ_new(a: u64, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u64CVec_u8ZZ { + C2Tuple_u64CVec_u8ZZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_u64CVec_u8ZZ. +pub extern "C" fn C2Tuple_u64CVec_u8ZZ_free(_res: C2Tuple_u64CVec_u8ZZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u64CVec_u8ZZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_u64CVec_u8ZZZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::derived::C2Tuple_u64CVec_u8ZZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_u64CVec_u8ZZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u64CVec_u8ZZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_u64CVec_u8ZZZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_u64CVec_u8ZZZ_free(_res: CVec_C2Tuple_u64CVec_u8ZZZ) { } +impl Drop for CVec_C2Tuple_u64CVec_u8ZZZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_u64CVec_u8ZZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// The contents of CResult_RecipientOnionFieldsNoneZ +pub union CResult_RecipientOnionFieldsNoneZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::offers::invoice::BlindedPayInfo, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, + pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields, + /// Note that this value is always NULL, as there are no contents in the Err variant + pub err: *mut core::ffi::c_void, } #[repr(C)] -/// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_RecipientOnionFieldsNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_BlindedPayInfoDecodeErrorZ { - /// The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either +pub struct CResult_RecipientOnionFieldsNoneZ { + /// The contents of this CResult_RecipientOnionFieldsNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BlindedPayInfoDecodeErrorZPtr, - /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state. + pub contents: CResult_RecipientOnionFieldsNoneZPtr, + /// Whether this CResult_RecipientOnionFieldsNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::offers::invoice::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ { - CResult_BlindedPayInfoDecodeErrorZ { - contents: CResult_BlindedPayInfoDecodeErrorZPtr { +/// Creates a new CResult_RecipientOnionFieldsNoneZ in the success state. +pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsNoneZ { + CResult_RecipientOnionFieldsNoneZ { + contents: CResult_RecipientOnionFieldsNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPayInfoDecodeErrorZ { - CResult_BlindedPayInfoDecodeErrorZ { - contents: CResult_BlindedPayInfoDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_RecipientOnionFieldsNoneZ in the error state. +pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_err() -> CResult_RecipientOnionFieldsNoneZ { + CResult_RecipientOnionFieldsNoneZ { + contents: CResult_RecipientOnionFieldsNoneZPtr { + err: core::ptr::null_mut(), }, result_ok: false, } } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool { +pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_is_ok(o: &CResult_RecipientOnionFieldsNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ. -pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_free(_res: CResult_BlindedPayInfoDecodeErrorZ) { } -impl Drop for CResult_BlindedPayInfoDecodeErrorZ { +/// Frees any resources used by the CResult_RecipientOnionFieldsNoneZ. +pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_free(_res: CResult_RecipientOnionFieldsNoneZ) { } +impl Drop for CResult_RecipientOnionFieldsNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { let _ = unsafe { Box::from_raw(self.contents.result) }; } } else { - if unsafe { !(self.contents.err as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.err) }; - } } } } -impl From> for CResult_BlindedPayInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_RecipientOnionFieldsNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_BlindedPayInfoDecodeErrorZPtr { result } + CResult_RecipientOnionFieldsNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BlindedPayInfoDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_RecipientOnionFieldsNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -702,43 +846,314 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BlindedPayInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_RecipientOnionFieldsNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_RecipientOnionFieldsNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_RecipientOnionFieldsNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ -pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::sign::DelayedPaymentOutputDescriptor, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, -} +pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_clone(orig: &CResult_RecipientOnionFieldsNoneZ) -> CResult_RecipientOnionFieldsNoneZ { Clone::clone(&orig) } #[repr(C)] -/// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { - /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr, - /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state. - pub result_ok: bool, +/// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_ThirtyTwoBytesZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::ThirtyTwoBytes, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_ThirtyTwoBytesZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_ThirtyTwoBytesZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { } +impl Drop for CVec_ThirtyTwoBytesZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_ThirtyTwoBytesZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not +pub enum COption_CVec_ThirtyTwoBytesZZ { + /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ + Some(crate::c_types::derived::CVec_ThirtyTwoBytesZ), + /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing + None +} +impl COption_CVec_ThirtyTwoBytesZZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ +pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_some(o: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> COption_CVec_ThirtyTwoBytesZZ { + COption_CVec_ThirtyTwoBytesZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing +pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_none() -> COption_CVec_ThirtyTwoBytesZZ { + COption_CVec_ThirtyTwoBytesZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state +pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_free(_res: COption_CVec_ThirtyTwoBytesZZ) { } +#[no_mangle] +/// Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_clone(orig: &COption_CVec_ThirtyTwoBytesZZ) -> COption_CVec_ThirtyTwoBytesZZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_ThirtyTwoBytesNoneZ +pub union CResult_ThirtyTwoBytesNoneZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::c_types::ThirtyTwoBytes, + /// Note that this value is always NULL, as there are no contents in the Err variant + pub err: *mut core::ffi::c_void, +} +#[repr(C)] +/// A CResult_ThirtyTwoBytesNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_ThirtyTwoBytesNoneZ { + /// The contents of this CResult_ThirtyTwoBytesNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_ThirtyTwoBytesNoneZPtr, + /// Whether this CResult_ThirtyTwoBytesNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_ThirtyTwoBytesNoneZ in the success state. +pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesNoneZ { + CResult_ThirtyTwoBytesNoneZ { + contents: CResult_ThirtyTwoBytesNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_ThirtyTwoBytesNoneZ in the error state. +pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_err() -> CResult_ThirtyTwoBytesNoneZ { + CResult_ThirtyTwoBytesNoneZ { + contents: CResult_ThirtyTwoBytesNoneZPtr { + err: core::ptr::null_mut(), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_is_ok(o: &CResult_ThirtyTwoBytesNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_ThirtyTwoBytesNoneZ. +pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_free(_res: CResult_ThirtyTwoBytesNoneZ) { } +impl Drop for CResult_ThirtyTwoBytesNoneZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + } + } +} +impl From> for CResult_ThirtyTwoBytesNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_ThirtyTwoBytesNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_ThirtyTwoBytesNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_ThirtyTwoBytesNoneZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ThirtyTwoBytesNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ThirtyTwoBytesNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_clone(orig: &CResult_ThirtyTwoBytesNoneZ) -> CResult_ThirtyTwoBytesNoneZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_BlindedPayInfoDecodeErrorZ +pub union CResult_BlindedPayInfoDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::offers::invoice::BlindedPayInfo, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_BlindedPayInfoDecodeErrorZ { + /// The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_BlindedPayInfoDecodeErrorZPtr, + /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::offers::invoice::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ { + CResult_BlindedPayInfoDecodeErrorZ { + contents: CResult_BlindedPayInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPayInfoDecodeErrorZ { + CResult_BlindedPayInfoDecodeErrorZ { + contents: CResult_BlindedPayInfoDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ. +pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_free(_res: CResult_BlindedPayInfoDecodeErrorZ) { } +impl Drop for CResult_BlindedPayInfoDecodeErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_BlindedPayInfoDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_BlindedPayInfoDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_BlindedPayInfoDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_BlindedPayInfoDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_BlindedPayInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ +pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::sign::DelayedPaymentOutputDescriptor, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { + /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr, + /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state. + pub result_ok: bool, } #[no_mangle] /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state. @@ -1102,13 +1517,13 @@ impl Clone for CVec_TxOutZ { #[repr(C)] #[derive(Clone)] /// An enum which can either contain a u32 or not -pub enum COption_PackedLockTimeZ { - /// When we're in this state, this COption_PackedLockTimeZ contains a u32 +pub enum COption_u32Z { + /// When we're in this state, this COption_u32Z contains a u32 Some(u32), - /// When we're in this state, this COption_PackedLockTimeZ contains nothing + /// When we're in this state, this COption_u32Z contains nothing None } -impl COption_PackedLockTimeZ { +impl COption_u32Z { #[allow(unused)] pub(crate) fn is_some(&self) -> bool { if let Self::None = self { false } else { true } } @@ -1120,31 +1535,31 @@ impl COption_PackedLockTimeZ { } } #[no_mangle] -/// Constructs a new COption_PackedLockTimeZ containing a u32 -pub extern "C" fn COption_PackedLockTimeZ_some(o: u32) -> COption_PackedLockTimeZ { - COption_PackedLockTimeZ::Some(o) +/// Constructs a new COption_u32Z containing a u32 +pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z { + COption_u32Z::Some(o) } #[no_mangle] -/// Constructs a new COption_PackedLockTimeZ containing nothing -pub extern "C" fn COption_PackedLockTimeZ_none() -> COption_PackedLockTimeZ { - COption_PackedLockTimeZ::None +/// Constructs a new COption_u32Z containing nothing +pub extern "C" fn COption_u32Z_none() -> COption_u32Z { + COption_u32Z::None } #[no_mangle] /// Frees any resources associated with the u32, if we are in the Some state -pub extern "C" fn COption_PackedLockTimeZ_free(_res: COption_PackedLockTimeZ) { } +pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { } #[no_mangle] -/// Creates a new COption_PackedLockTimeZ which has the same data as `orig` +/// Creates a new COption_u32Z which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_PackedLockTimeZ_clone(orig: &COption_PackedLockTimeZ) -> COption_PackedLockTimeZ { Clone::clone(&orig) } +pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_PartiallySignedTransactionusizeZ { +pub struct C2Tuple_CVec_u8ZusizeZ { /// The element at position 0 pub a: crate::c_types::derived::CVec_u8Z, /// The element at position 1 pub b: usize, } -impl From<(crate::c_types::derived::CVec_u8Z, usize)> for C2Tuple_PartiallySignedTransactionusizeZ { +impl From<(crate::c_types::derived::CVec_u8Z, usize)> for C2Tuple_CVec_u8ZusizeZ { fn from (tup: (crate::c_types::derived::CVec_u8Z, usize)) -> Self { Self { a: tup.0, @@ -1152,12 +1567,12 @@ impl From<(crate::c_types::derived::CVec_u8Z, usize)> for C2Tuple_PartiallySigne } } } -impl C2Tuple_PartiallySignedTransactionusizeZ { +impl C2Tuple_CVec_u8ZusizeZ { #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, usize) { (self.a, self.b) } } -impl Clone for C2Tuple_PartiallySignedTransactionusizeZ { +impl Clone for C2Tuple_CVec_u8ZusizeZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -1168,51 +1583,51 @@ impl Clone for C2Tuple_PartiallySignedTransactionusizeZ { #[no_mangle] /// Creates a new tuple which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_PartiallySignedTransactionusizeZ_clone(orig: &C2Tuple_PartiallySignedTransactionusizeZ) -> C2Tuple_PartiallySignedTransactionusizeZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_PartiallySignedTransactionusizeZ from the contained elements. +pub extern "C" fn C2Tuple_CVec_u8ZusizeZ_clone(orig: &C2Tuple_CVec_u8ZusizeZ) -> C2Tuple_CVec_u8ZusizeZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_CVec_u8ZusizeZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_PartiallySignedTransactionusizeZ_new(a: crate::c_types::derived::CVec_u8Z, b: usize) -> C2Tuple_PartiallySignedTransactionusizeZ { - C2Tuple_PartiallySignedTransactionusizeZ { a, b, } +pub extern "C" fn C2Tuple_CVec_u8ZusizeZ_new(a: crate::c_types::derived::CVec_u8Z, b: usize) -> C2Tuple_CVec_u8ZusizeZ { + C2Tuple_CVec_u8ZusizeZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_PartiallySignedTransactionusizeZ. -pub extern "C" fn C2Tuple_PartiallySignedTransactionusizeZ_free(_res: C2Tuple_PartiallySignedTransactionusizeZ) { } +/// Frees any resources used by the C2Tuple_CVec_u8ZusizeZ. +pub extern "C" fn C2Tuple_CVec_u8ZusizeZ_free(_res: C2Tuple_CVec_u8ZusizeZ) { } #[repr(C)] -/// The contents of CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ -pub union CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr { +/// The contents of CResult_C2Tuple_CVec_u8ZusizeZNoneZ +pub union CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ, + pub result: *mut crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ, /// Note that this value is always NULL, as there are no contents in the Err variant pub err: *mut core::ffi::c_void, } #[repr(C)] -/// A CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ on success and a () on failure. +/// A CResult_C2Tuple_CVec_u8ZusizeZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { - /// The contents of this CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ, accessible via either +pub struct CResult_C2Tuple_CVec_u8ZusizeZNoneZ { + /// The contents of this CResult_C2Tuple_CVec_u8ZusizeZNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr, - /// Whether this CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ represents a success state. + pub contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr, + /// Whether this CResult_C2Tuple_CVec_u8ZusizeZNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ in the success state. -pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ) -> CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { - CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { - contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr { +/// Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ in the success state. +pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(o: crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ) -> CResult_C2Tuple_CVec_u8ZusizeZNoneZ { + CResult_C2Tuple_CVec_u8ZusizeZNoneZ { + contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ in the error state. -pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err() -> CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { - CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { - contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr { +/// Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ in the error state. +pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err() -> CResult_C2Tuple_CVec_u8ZusizeZNoneZ { + CResult_C2Tuple_CVec_u8ZusizeZNoneZ { + contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -1220,13 +1635,13 @@ pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err() -> } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok(o: &CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ) -> bool { +pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(o: &CResult_C2Tuple_CVec_u8ZusizeZNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ. -pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(_res: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ) { } -impl Drop for CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { +/// Frees any resources used by the CResult_C2Tuple_CVec_u8ZusizeZNoneZ. +pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(_res: CResult_C2Tuple_CVec_u8ZusizeZNoneZ) { } +impl Drop for CResult_C2Tuple_CVec_u8ZusizeZNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1236,16 +1651,16 @@ impl Drop for CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { } } } -impl From> for CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C2Tuple_CVec_u8ZusizeZNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr { result } + CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr { err: core::ptr::null_mut() } + CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -1253,69 +1668,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr { + Self { result_ok: false, contents: CResult_C2Tuple_CVec_u8ZusizeZNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ which has the same data as `orig` +/// Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(orig: &CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ) -> CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_PaymentPreimageZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::ThirtyTwoBytes, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_PaymentPreimageZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_PaymentPreimageZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } - } -} -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { } -impl Drop for CVec_PaymentPreimageZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} -impl Clone for CVec_PaymentPreimageZ { - fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) - } -} +pub extern "C" fn CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(orig: &CResult_C2Tuple_CVec_u8ZusizeZNoneZ) -> CResult_C2Tuple_CVec_u8ZusizeZNoneZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_NoneNoneZ pub union CResult_NoneNoneZPtr { @@ -1405,29 +1774,29 @@ impl Clone for CResult_NoneNoneZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size. +/// A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_SignatureZ { +pub struct CVec_ECDSASignatureZ { /// The elements in the array. /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::Signature, + pub data: *mut crate::c_types::ECDSASignature, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_SignatureZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_ECDSASignatureZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { if self.datalen == 0 { return Vec::new(); } let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ECDSASignature] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_SignatureZ { - fn from(v: Vec) -> Self { +impl From> for CVec_ECDSASignatureZ { + fn from(v: Vec) -> Self { let datalen = v.len(); let data = Box::into_raw(v.into_boxed_slice()); Self { datalen, data: unsafe { (*data).as_mut_ptr() } } @@ -1435,14 +1804,14 @@ impl From> for CVec_SignatureZ { } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { } -impl Drop for CVec_SignatureZ { +pub extern "C" fn CVec_ECDSASignatureZ_free(_res: CVec_ECDSASignatureZ) { } +impl Drop for CVec_ECDSASignatureZ { fn drop(&mut self) { if self.datalen == 0 { return; } let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_SignatureZ { +impl Clone for CVec_ECDSASignatureZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -1452,26 +1821,26 @@ impl Clone for CVec_SignatureZ { } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_SignatureCVec_SignatureZZ { +pub struct C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { /// The element at position 0 - pub a: crate::c_types::Signature, + pub a: crate::c_types::ECDSASignature, /// The element at position 1 - pub b: crate::c_types::derived::CVec_SignatureZ, + pub b: crate::c_types::derived::CVec_ECDSASignatureZ, } -impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ { - fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self { +impl From<(crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)> for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { + fn from (tup: (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple_SignatureCVec_SignatureZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) { +impl C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ) { (self.a, self.b) } } -impl Clone for C2Tuple_SignatureCVec_SignatureZZ { +impl Clone for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -1482,51 +1851,51 @@ impl Clone for C2Tuple_SignatureCVec_SignatureZZ { #[no_mangle] /// Creates a new tuple which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements. +pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig: &C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ { - C2Tuple_SignatureCVec_SignatureZZ { a, b, } +pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a: crate::c_types::ECDSASignature, b: crate::c_types::derived::CVec_ECDSASignatureZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { + C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ. -pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { } +/// Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ. +pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res: C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) { } #[repr(C)] -/// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ -pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { +/// The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ +pub union CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, + pub result: *mut crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, /// Note that this value is always NULL, as there are no contents in the Err variant pub err: *mut core::ffi::c_void, } #[repr(C)] -/// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure. +/// A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { - /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either +pub struct CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + /// The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr, - /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state. + pub contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr, + /// Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state. -pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { - CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { - contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { +/// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state. +pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state. -pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { - CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { - contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { +/// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state. +pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -1534,13 +1903,13 @@ pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResul } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool { +pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ. -pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { } -impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { +/// Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ. +pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) { } +impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1550,16 +1919,16 @@ impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { } } } -impl From> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result } + CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() } + CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -1567,58 +1936,58 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { + Self { result_ok: false, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig` +/// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SignatureNoneZ -pub union CResult_SignatureNoneZPtr { +/// The contents of CResult_ECDSASignatureNoneZ +pub union CResult_ECDSASignatureNoneZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::Signature, + pub result: *mut crate::c_types::ECDSASignature, /// Note that this value is always NULL, as there are no contents in the Err variant pub err: *mut core::ffi::c_void, } #[repr(C)] -/// A CResult_SignatureNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::Signature on success and a () on failure. +/// A CResult_ECDSASignatureNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::ECDSASignature on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_SignatureNoneZ { - /// The contents of this CResult_SignatureNoneZ, accessible via either +pub struct CResult_ECDSASignatureNoneZ { + /// The contents of this CResult_ECDSASignatureNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SignatureNoneZPtr, - /// Whether this CResult_SignatureNoneZ represents a success state. + pub contents: CResult_ECDSASignatureNoneZPtr, + /// Whether this CResult_ECDSASignatureNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SignatureNoneZ in the success state. -pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ { - CResult_SignatureNoneZ { - contents: CResult_SignatureNoneZPtr { +/// Creates a new CResult_ECDSASignatureNoneZ in the success state. +pub extern "C" fn CResult_ECDSASignatureNoneZ_ok(o: crate::c_types::ECDSASignature) -> CResult_ECDSASignatureNoneZ { + CResult_ECDSASignatureNoneZ { + contents: CResult_ECDSASignatureNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SignatureNoneZ in the error state. -pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ { - CResult_SignatureNoneZ { - contents: CResult_SignatureNoneZPtr { +/// Creates a new CResult_ECDSASignatureNoneZ in the error state. +pub extern "C" fn CResult_ECDSASignatureNoneZ_err() -> CResult_ECDSASignatureNoneZ { + CResult_ECDSASignatureNoneZ { + contents: CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -1626,13 +1995,13 @@ pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ { } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool { +pub extern "C" fn CResult_ECDSASignatureNoneZ_is_ok(o: &CResult_ECDSASignatureNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SignatureNoneZ. -pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { } -impl Drop for CResult_SignatureNoneZ { +/// Frees any resources used by the CResult_ECDSASignatureNoneZ. +pub extern "C" fn CResult_ECDSASignatureNoneZ_free(_res: CResult_ECDSASignatureNoneZ) { } +impl Drop for CResult_ECDSASignatureNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1642,16 +2011,16 @@ impl Drop for CResult_SignatureNoneZ { } } } -impl From> for CResult_SignatureNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ECDSASignatureNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_SignatureNoneZPtr { result } + CResult_ECDSASignatureNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_SignatureNoneZPtr { err: core::ptr::null_mut() } + CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -1659,23 +2028,23 @@ impl From> for CResu } } } -impl Clone for CResult_SignatureNoneZ { +impl Clone for CResult_ECDSASignatureNoneZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SignatureNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ECDSASignatureNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SignatureNoneZPtr { + Self { result_ok: false, contents: CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_SignatureNoneZ which has the same data as `orig` +/// Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_PublicKeyNoneZ pub union CResult_PublicKeyNoneZPtr { @@ -1771,13 +2140,13 @@ pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> #[repr(C)] #[derive(Clone)] /// An enum which can either contain a crate::c_types::BigEndianScalar or not -pub enum COption_ScalarZ { - /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar +pub enum COption_BigEndianScalarZ { + /// When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar Some(crate::c_types::BigEndianScalar), - /// When we're in this state, this COption_ScalarZ contains nothing + /// When we're in this state, this COption_BigEndianScalarZ contains nothing None } -impl COption_ScalarZ { +impl COption_BigEndianScalarZ { #[allow(unused)] pub(crate) fn is_some(&self) -> bool { if let Self::None = self { false } else { true } } @@ -1789,114 +2158,22 @@ impl COption_ScalarZ { } } #[no_mangle] -/// Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar -pub extern "C" fn COption_ScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_ScalarZ { - COption_ScalarZ::Some(o) +/// Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar +pub extern "C" fn COption_BigEndianScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_BigEndianScalarZ { + COption_BigEndianScalarZ::Some(o) } #[no_mangle] -/// Constructs a new COption_ScalarZ containing nothing -pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ { - COption_ScalarZ::None +/// Constructs a new COption_BigEndianScalarZ containing nothing +pub extern "C" fn COption_BigEndianScalarZ_none() -> COption_BigEndianScalarZ { + COption_BigEndianScalarZ::None } #[no_mangle] /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state -pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { } -#[no_mangle] -/// Creates a new COption_ScalarZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_ScalarZ_clone(orig: &COption_ScalarZ) -> COption_ScalarZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_SharedSecretNoneZ -pub union CResult_SharedSecretNoneZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::ThirtyTwoBytes, - /// Note that this value is always NULL, as there are no contents in the Err variant - pub err: *mut core::ffi::c_void, -} -#[repr(C)] -/// A CResult_SharedSecretNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_SharedSecretNoneZ { - /// The contents of this CResult_SharedSecretNoneZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SharedSecretNoneZPtr, - /// Whether this CResult_SharedSecretNoneZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_SharedSecretNoneZ in the success state. -pub extern "C" fn CResult_SharedSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_SharedSecretNoneZ { - CResult_SharedSecretNoneZ { - contents: CResult_SharedSecretNoneZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_SharedSecretNoneZ in the error state. -pub extern "C" fn CResult_SharedSecretNoneZ_err() -> CResult_SharedSecretNoneZ { - CResult_SharedSecretNoneZ { - contents: CResult_SharedSecretNoneZPtr { - err: core::ptr::null_mut(), - }, - result_ok: false, - } -} -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_SharedSecretNoneZ_is_ok(o: &CResult_SharedSecretNoneZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_SharedSecretNoneZ. -pub extern "C" fn CResult_SharedSecretNoneZ_free(_res: CResult_SharedSecretNoneZ) { } -impl Drop for CResult_SharedSecretNoneZ { - fn drop(&mut self) { - if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } - } else { - } - } -} -impl From> for CResult_SharedSecretNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_SharedSecretNoneZPtr { result } - } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_SharedSecretNoneZPtr { err: core::ptr::null_mut() } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -impl Clone for CResult_SharedSecretNoneZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_SharedSecretNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_SharedSecretNoneZPtr { - err: core::ptr::null_mut() - } } - } - } -} +pub extern "C" fn COption_BigEndianScalarZ_free(_res: COption_BigEndianScalarZ) { } #[no_mangle] -/// Creates a new CResult_SharedSecretNoneZ which has the same data as `orig` +/// Creates a new COption_BigEndianScalarZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SharedSecretNoneZ_clone(orig: &CResult_SharedSecretNoneZ) -> CResult_SharedSecretNoneZ { Clone::clone(&orig) } +pub extern "C" fn COption_BigEndianScalarZ_clone(orig: &COption_BigEndianScalarZ) -> COption_BigEndianScalarZ { Clone::clone(&orig) } #[repr(C)] /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size. /// This corresponds to std::vector in C++ @@ -2036,6 +2313,98 @@ impl Clone for CResult_RecoverableSignatureNoneZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) } #[repr(C)] +/// The contents of CResult_SchnorrSignatureNoneZ +pub union CResult_SchnorrSignatureNoneZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::c_types::SchnorrSignature, + /// Note that this value is always NULL, as there are no contents in the Err variant + pub err: *mut core::ffi::c_void, +} +#[repr(C)] +/// A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::SchnorrSignature on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_SchnorrSignatureNoneZ { + /// The contents of this CResult_SchnorrSignatureNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_SchnorrSignatureNoneZPtr, + /// Whether this CResult_SchnorrSignatureNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_SchnorrSignatureNoneZ in the success state. +pub extern "C" fn CResult_SchnorrSignatureNoneZ_ok(o: crate::c_types::SchnorrSignature) -> CResult_SchnorrSignatureNoneZ { + CResult_SchnorrSignatureNoneZ { + contents: CResult_SchnorrSignatureNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_SchnorrSignatureNoneZ in the error state. +pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatureNoneZ { + CResult_SchnorrSignatureNoneZ { + contents: CResult_SchnorrSignatureNoneZPtr { + err: core::ptr::null_mut(), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_SchnorrSignatureNoneZ_is_ok(o: &CResult_SchnorrSignatureNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_SchnorrSignatureNoneZ. +pub extern "C" fn CResult_SchnorrSignatureNoneZ_free(_res: CResult_SchnorrSignatureNoneZ) { } +impl Drop for CResult_SchnorrSignatureNoneZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + } + } +} +impl From> for CResult_SchnorrSignatureNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_SchnorrSignatureNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_SchnorrSignatureNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_SchnorrSignatureNoneZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_SchnorrSignatureNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_SchnorrSignatureNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_SchnorrSignatureNoneZ_clone(orig: &CResult_SchnorrSignatureNoneZ) -> CResult_SchnorrSignatureNoneZ { Clone::clone(&orig) } +#[repr(C)] /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { /// A pointer to the contents in the success state. @@ -2114,9 +2483,26 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ScriptNoneZ -pub union CResult_ScriptNoneZPtr { +/// The contents of CResult_CVec_u8ZNoneZ +pub union CResult_CVec_u8ZNoneZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. pub result: *mut crate::c_types::derived::CVec_u8Z, @@ -2124,31 +2510,31 @@ pub union CResult_ScriptNoneZPtr { pub err: *mut core::ffi::c_void, } #[repr(C)] -/// A CResult_ScriptNoneZ represents the result of a fallible operation, +/// A CResult_CVec_u8ZNoneZ represents the result of a fallible operation, /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ScriptNoneZ { - /// The contents of this CResult_ScriptNoneZ, accessible via either +pub struct CResult_CVec_u8ZNoneZ { + /// The contents of this CResult_CVec_u8ZNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ScriptNoneZPtr, - /// Whether this CResult_ScriptNoneZ represents a success state. + pub contents: CResult_CVec_u8ZNoneZPtr, + /// Whether this CResult_CVec_u8ZNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ScriptNoneZ in the success state. -pub extern "C" fn CResult_ScriptNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_ScriptNoneZ { - CResult_ScriptNoneZ { - contents: CResult_ScriptNoneZPtr { +/// Creates a new CResult_CVec_u8ZNoneZ in the success state. +pub extern "C" fn CResult_CVec_u8ZNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZNoneZ { + CResult_CVec_u8ZNoneZ { + contents: CResult_CVec_u8ZNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ScriptNoneZ in the error state. -pub extern "C" fn CResult_ScriptNoneZ_err() -> CResult_ScriptNoneZ { - CResult_ScriptNoneZ { - contents: CResult_ScriptNoneZPtr { +/// Creates a new CResult_CVec_u8ZNoneZ in the error state. +pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ { + CResult_CVec_u8ZNoneZ { + contents: CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -2156,13 +2542,13 @@ pub extern "C" fn CResult_ScriptNoneZ_err() -> CResult_ScriptNoneZ { } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ScriptNoneZ_is_ok(o: &CResult_ScriptNoneZ) -> bool { +pub extern "C" fn CResult_CVec_u8ZNoneZ_is_ok(o: &CResult_CVec_u8ZNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ScriptNoneZ. -pub extern "C" fn CResult_ScriptNoneZ_free(_res: CResult_ScriptNoneZ) { } -impl Drop for CResult_ScriptNoneZ { +/// Frees any resources used by the CResult_CVec_u8ZNoneZ. +pub extern "C" fn CResult_CVec_u8ZNoneZ_free(_res: CResult_CVec_u8ZNoneZ) { } +impl Drop for CResult_CVec_u8ZNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -2172,16 +2558,16 @@ impl Drop for CResult_ScriptNoneZ { } } } -impl From> for CResult_ScriptNoneZ { +impl From> for CResult_CVec_u8ZNoneZ { fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_ScriptNoneZPtr { result } + CResult_CVec_u8ZNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_ScriptNoneZPtr { err: core::ptr::null_mut() } + CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -2189,23 +2575,23 @@ impl From> f } } } -impl Clone for CResult_ScriptNoneZ { +impl Clone for CResult_CVec_u8ZNoneZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ScriptNoneZPtr { + Self { result_ok: true, contents: CResult_CVec_u8ZNoneZPtr { result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ScriptNoneZPtr { + Self { result_ok: false, contents: CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_ScriptNoneZ which has the same data as `orig` +/// Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ScriptNoneZ_clone(orig: &CResult_ScriptNoneZ) -> CResult_ScriptNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CVec_u8ZNoneZ_clone(orig: &CResult_CVec_u8ZNoneZ) -> CResult_CVec_u8ZNoneZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_ShutdownScriptNoneZ pub union CResult_ShutdownScriptNoneZPtr { @@ -2299,6 +2685,80 @@ impl Clone for CResult_ShutdownScriptNoneZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) } #[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a u16 or not +pub enum COption_u16Z { + /// When we're in this state, this COption_u16Z contains a u16 + Some(u16), + /// When we're in this state, this COption_u16Z contains nothing + None +} +impl COption_u16Z { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> u16 { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_u16Z containing a u16 +pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z { + COption_u16Z::Some(o) +} +#[no_mangle] +/// Constructs a new COption_u16Z containing nothing +pub extern "C" fn COption_u16Z_none() -> COption_u16Z { + COption_u16Z::None +} +#[no_mangle] +/// Frees any resources associated with the u16, if we are in the Some state +pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { } +#[no_mangle] +/// Creates a new COption_u16Z which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a bool or not +pub enum COption_boolZ { + /// When we're in this state, this COption_boolZ contains a bool + Some(bool), + /// When we're in this state, this COption_boolZ contains nothing + None +} +impl COption_boolZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> bool { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_boolZ containing a bool +pub extern "C" fn COption_boolZ_some(o: bool) -> COption_boolZ { + COption_boolZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_boolZ containing nothing +pub extern "C" fn COption_boolZ_none() -> COption_boolZ { + COption_boolZ::None +} +#[no_mangle] +/// Frees any resources associated with the bool, if we are in the Some state +pub extern "C" fn COption_boolZ_free(_res: COption_boolZ) { } +#[no_mangle] +/// Creates a new COption_boolZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_boolZ_clone(orig: &COption_boolZ) -> COption_boolZ { Clone::clone(&orig) } +#[repr(C)] /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size. /// This corresponds to std::vector in C++ pub struct CVec_CVec_u8ZZ { @@ -2533,40 +2993,40 @@ impl Clone for CResult_InMemorySignerDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PartiallySignedTransactionNoneZ -pub union CResult_PartiallySignedTransactionNoneZPtr { +/// The contents of CResult_TransactionNoneZ +pub union CResult_TransactionNoneZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::CVec_u8Z, + pub result: *mut crate::c_types::Transaction, /// Note that this value is always NULL, as there are no contents in the Err variant pub err: *mut core::ffi::c_void, } #[repr(C)] -/// A CResult_PartiallySignedTransactionNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure. +/// A CResult_TransactionNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::Transaction on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PartiallySignedTransactionNoneZ { - /// The contents of this CResult_PartiallySignedTransactionNoneZ, accessible via either +pub struct CResult_TransactionNoneZ { + /// The contents of this CResult_TransactionNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PartiallySignedTransactionNoneZPtr, - /// Whether this CResult_PartiallySignedTransactionNoneZ represents a success state. + pub contents: CResult_TransactionNoneZPtr, + /// Whether this CResult_TransactionNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PartiallySignedTransactionNoneZ in the success state. -pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_PartiallySignedTransactionNoneZ { - CResult_PartiallySignedTransactionNoneZ { - contents: CResult_PartiallySignedTransactionNoneZPtr { +/// Creates a new CResult_TransactionNoneZ in the success state. +pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ { + CResult_TransactionNoneZ { + contents: CResult_TransactionNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PartiallySignedTransactionNoneZ in the error state. -pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_err() -> CResult_PartiallySignedTransactionNoneZ { - CResult_PartiallySignedTransactionNoneZ { - contents: CResult_PartiallySignedTransactionNoneZPtr { +/// Creates a new CResult_TransactionNoneZ in the error state. +pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ { + CResult_TransactionNoneZ { + contents: CResult_TransactionNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -2574,13 +3034,13 @@ pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_err() -> CResult_Parti } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_is_ok(o: &CResult_PartiallySignedTransactionNoneZ) -> bool { +pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PartiallySignedTransactionNoneZ. -pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_free(_res: CResult_PartiallySignedTransactionNoneZ) { } -impl Drop for CResult_PartiallySignedTransactionNoneZ { +/// Frees any resources used by the CResult_TransactionNoneZ. +pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { } +impl Drop for CResult_TransactionNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -2590,104 +3050,12 @@ impl Drop for CResult_PartiallySignedTransactionNoneZ { } } } -impl From> for CResult_PartiallySignedTransactionNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TransactionNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_PartiallySignedTransactionNoneZPtr { result } - } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_PartiallySignedTransactionNoneZPtr { err: core::ptr::null_mut() } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -impl Clone for CResult_PartiallySignedTransactionNoneZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_PartiallySignedTransactionNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_PartiallySignedTransactionNoneZPtr { - err: core::ptr::null_mut() - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_PartiallySignedTransactionNoneZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PartiallySignedTransactionNoneZ_clone(orig: &CResult_PartiallySignedTransactionNoneZ) -> CResult_PartiallySignedTransactionNoneZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_TransactionNoneZ -pub union CResult_TransactionNoneZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::Transaction, - /// Note that this value is always NULL, as there are no contents in the Err variant - pub err: *mut core::ffi::c_void, -} -#[repr(C)] -/// A CResult_TransactionNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::Transaction on success and a () on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TransactionNoneZ { - /// The contents of this CResult_TransactionNoneZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TransactionNoneZPtr, - /// Whether this CResult_TransactionNoneZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_TransactionNoneZ in the success state. -pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ { - CResult_TransactionNoneZ { - contents: CResult_TransactionNoneZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_TransactionNoneZ in the error state. -pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ { - CResult_TransactionNoneZ { - contents: CResult_TransactionNoneZPtr { - err: core::ptr::null_mut(), - }, - result_ok: false, - } -} -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_TransactionNoneZ. -pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { } -impl Drop for CResult_TransactionNoneZ { - fn drop(&mut self) { - if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } - } else { - } - } -} -impl From> for CResult_TransactionNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_TransactionNoneZPtr { result } + CResult_TransactionNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); @@ -2749,8 +3117,8 @@ pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ { /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { } #[repr(C)] -/// The contents of CResult_NoneErrorZ -pub union CResult_NoneErrorZPtr { +/// The contents of CResult_NoneIOErrorZ +pub union CResult_NoneIOErrorZPtr { /// Note that this value is always NULL, as there are no contents in the OK variant pub result: *mut core::ffi::c_void, /// A pointer to the contents in the error state. @@ -2758,31 +3126,31 @@ pub union CResult_NoneErrorZPtr { pub err: *mut crate::c_types::IOError, } #[repr(C)] -/// A CResult_NoneErrorZ represents the result of a fallible operation, +/// A CResult_NoneIOErrorZ represents the result of a fallible operation, /// containing a () on success and a crate::c_types::IOError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NoneErrorZ { - /// The contents of this CResult_NoneErrorZ, accessible via either +pub struct CResult_NoneIOErrorZ { + /// The contents of this CResult_NoneIOErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneErrorZPtr, - /// Whether this CResult_NoneErrorZ represents a success state. + pub contents: CResult_NoneIOErrorZPtr, + /// Whether this CResult_NoneIOErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NoneErrorZ in the success state. -pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ { - CResult_NoneErrorZ { - contents: CResult_NoneErrorZPtr { +/// Creates a new CResult_NoneIOErrorZ in the success state. +pub extern "C" fn CResult_NoneIOErrorZ_ok() -> CResult_NoneIOErrorZ { + CResult_NoneIOErrorZ { + contents: CResult_NoneIOErrorZPtr { result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NoneErrorZ in the error state. -pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ { - CResult_NoneErrorZ { - contents: CResult_NoneErrorZPtr { +/// Creates a new CResult_NoneIOErrorZ in the error state. +pub extern "C" fn CResult_NoneIOErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneIOErrorZ { + CResult_NoneIOErrorZ { + contents: CResult_NoneIOErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -2790,13 +3158,13 @@ pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_ } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool { +pub extern "C" fn CResult_NoneIOErrorZ_is_ok(o: &CResult_NoneIOErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NoneErrorZ. -pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { } -impl Drop for CResult_NoneErrorZ { +/// Frees any resources used by the CResult_NoneIOErrorZ. +pub extern "C" fn CResult_NoneIOErrorZ_free(_res: CResult_NoneIOErrorZ) { } +impl Drop for CResult_NoneIOErrorZ { fn drop(&mut self) { if self.result_ok { } else { @@ -2806,16 +3174,16 @@ impl Drop for CResult_NoneErrorZ { } } } -impl From> for CResult_NoneErrorZ { +impl From> for CResult_NoneIOErrorZ { fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self { let contents = if o.result_ok { let _ = unsafe { Box::from_raw(o.contents.result) }; o.contents.result = core::ptr::null_mut(); - CResult_NoneErrorZPtr { result: core::ptr::null_mut() } + CResult_NoneIOErrorZPtr { result: core::ptr::null_mut() } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneErrorZPtr { err } + CResult_NoneIOErrorZPtr { err } }; Self { contents, @@ -2823,23 +3191,23 @@ impl From> for CResult } } } -impl Clone for CResult_NoneErrorZ { +impl Clone for CResult_NoneIOErrorZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NoneErrorZPtr { + Self { result_ok: true, contents: CResult_NoneIOErrorZPtr { result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_NoneErrorZPtr { + Self { result_ok: false, contents: CResult_NoneIOErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NoneErrorZ which has the same data as `orig` +/// Creates a new CResult_NoneIOErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) } #[repr(C)] /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size. /// This corresponds to std::vector in C++ @@ -3363,43 +3731,6 @@ impl Clone for CVec_RouteHopZ { } } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a u32 or not -pub enum COption_u32Z { - /// When we're in this state, this COption_u32Z contains a u32 - Some(u32), - /// When we're in this state, this COption_u32Z contains nothing - None -} -impl COption_u32Z { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } - } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() - } - #[allow(unused)] pub(crate) fn take(mut self) -> u32 { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_u32Z containing a u32 -pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z { - COption_u32Z::Some(o) -} -#[no_mangle] -/// Constructs a new COption_u32Z containing nothing -pub extern "C" fn COption_u32Z_none() -> COption_u32Z { - COption_u32Z::None -} -#[no_mangle] -/// Frees any resources associated with the u32, if we are in the Some state -pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { } -#[no_mangle] -/// Creates a new COption_u32Z which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) } -#[repr(C)] /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size. /// This corresponds to std::vector in C++ pub struct CVec_PathZ { @@ -4422,12 +4753,12 @@ pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ /// A tuple of 2 elements. See the individual fields for the types contained. pub struct C2Tuple_Z { /// The element at position 0 - pub a: crate::c_types::EightU16s, + pub a: crate::c_types::ThirtyTwoU16s, /// The element at position 1 - pub b: crate::c_types::EightU16s, + pub b: crate::c_types::ThirtyTwoU16s, } -impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple_Z { - fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self { +impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple_Z { + fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self { Self { a: tup.0, b: tup.1, @@ -4435,25 +4766,13 @@ impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple_Z } } impl C2Tuple_Z { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) { (self.a, self.b) } } -impl Clone for C2Tuple_Z { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - } - } -} -#[no_mangle] -/// Creates a new tuple which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_Z_clone(orig: &C2Tuple_Z) -> C2Tuple_Z { Clone::clone(&orig) } /// Creates a new C2Tuple_Z from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple_Z { +pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple_Z { C2Tuple_Z { a, b, } } @@ -4462,83 +4781,103 @@ pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::EightU16s, b: crate::c_types: pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple__u168_u168Z { +pub struct C2Tuple__u1632_u1632Z { /// The element at position 0 - pub a: crate::c_types::EightU16s, + pub a: crate::c_types::ThirtyTwoU16s, /// The element at position 1 - pub b: crate::c_types::EightU16s, + pub b: crate::c_types::ThirtyTwoU16s, } -impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple__u168_u168Z { - fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self { +impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple__u1632_u1632Z { + fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple__u168_u168Z { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) { +impl C2Tuple__u1632_u1632Z { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) { (self.a, self.b) } } -impl Clone for C2Tuple__u168_u168Z { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - } +/// Creates a new C2Tuple__u1632_u1632Z from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple__u1632_u1632Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple__u1632_u1632Z { + C2Tuple__u1632_u1632Z { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple__u1632_u1632Z. +pub extern "C" fn C2Tuple__u1632_u1632Z_free(_res: C2Tuple__u1632_u1632Z) { } +#[repr(C)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not +pub enum COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { + /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z + Some(crate::c_types::derived::C2Tuple__u1632_u1632Z), + /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing + None +} +impl COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u1632_u1632Z { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new tuple which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple__u168_u168Z_clone(orig: &C2Tuple__u168_u168Z) -> C2Tuple__u168_u168Z { Clone::clone(&orig) } -/// Creates a new C2Tuple__u168_u168Z from the contained elements. +/// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z +pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o: crate::c_types::derived::C2Tuple__u1632_u1632Z) -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { + COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some(o) +} #[no_mangle] -pub extern "C" fn C2Tuple__u168_u168Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple__u168_u168Z { - C2Tuple__u168_u168Z { a, b, } +/// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing +pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { + COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None } - #[no_mangle] -/// Frees any resources used by the C2Tuple__u168_u168Z. -pub extern "C" fn C2Tuple__u168_u168Z_free(_res: C2Tuple__u168_u168Z) { } +/// Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state +pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res: COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ) { } #[repr(C)] #[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not -pub enum COption_C2Tuple_EightU16sEightU16sZZ { - /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z - Some(crate::c_types::derived::C2Tuple__u168_u168Z), - /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing +/// An enum which can either contain a f64 or not +pub enum COption_f64Z { + /// When we're in this state, this COption_f64Z contains a f64 + Some(f64), + /// When we're in this state, this COption_f64Z contains nothing None } -impl COption_C2Tuple_EightU16sEightU16sZZ { +impl COption_f64Z { #[allow(unused)] pub(crate) fn is_some(&self) -> bool { if let Self::None = self { false } else { true } } #[allow(unused)] pub(crate) fn is_none(&self) -> bool { !self.is_some() } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u168_u168Z { + #[allow(unused)] pub(crate) fn take(mut self) -> f64 { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z -pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_some(o: crate::c_types::derived::C2Tuple__u168_u168Z) -> COption_C2Tuple_EightU16sEightU16sZZ { - COption_C2Tuple_EightU16sEightU16sZZ::Some(o) +/// Constructs a new COption_f64Z containing a f64 +pub extern "C" fn COption_f64Z_some(o: f64) -> COption_f64Z { + COption_f64Z::Some(o) } #[no_mangle] -/// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing -pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_none() -> COption_C2Tuple_EightU16sEightU16sZZ { - COption_C2Tuple_EightU16sEightU16sZZ::None +/// Constructs a new COption_f64Z containing nothing +pub extern "C" fn COption_f64Z_none() -> COption_f64Z { + COption_f64Z::None } #[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state -pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_free(_res: COption_C2Tuple_EightU16sEightU16sZZ) { } +/// Frees any resources associated with the f64, if we are in the Some state +pub extern "C" fn COption_f64Z_free(_res: COption_f64Z) { } #[no_mangle] -/// Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig` +/// Creates a new COption_f64Z which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_clone(orig: &COption_C2Tuple_EightU16sEightU16sZZ) -> COption_C2Tuple_EightU16sEightU16sZZ { Clone::clone(&orig) } +pub extern "C" fn COption_f64Z_clone(orig: &COption_f64Z) -> COption_f64Z { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_ProbabilisticScorerDecodeErrorZ pub union CResult_ProbabilisticScorerDecodeErrorZPtr { @@ -4707,64 +5046,27 @@ impl Clone for CVec_C2Tuple_usizeTransactionZZ { } } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not -pub enum COption_BlockHashZ { - /// When we're in this state, this COption_BlockHashZ contains a crate::c_types::ThirtyTwoBytes - Some(crate::c_types::ThirtyTwoBytes), - /// When we're in this state, this COption_BlockHashZ contains nothing - None -} -impl COption_BlockHashZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } - } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() - } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_BlockHashZ containing a crate::c_types::ThirtyTwoBytes -pub extern "C" fn COption_BlockHashZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_BlockHashZ { - COption_BlockHashZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_BlockHashZ containing nothing -pub extern "C" fn COption_BlockHashZ_none() -> COption_BlockHashZ { - COption_BlockHashZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state -pub extern "C" fn COption_BlockHashZ_free(_res: COption_BlockHashZ) { } -#[no_mangle] -/// Creates a new COption_BlockHashZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_BlockHashZ_clone(orig: &COption_BlockHashZ) -> COption_BlockHashZ { Clone::clone(&orig) } -#[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_TxidCOption_BlockHashZZ { +pub struct C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { /// The element at position 0 pub a: crate::c_types::ThirtyTwoBytes, /// The element at position 1 - pub b: crate::c_types::derived::COption_BlockHashZ, + pub b: crate::c_types::derived::COption_ThirtyTwoBytesZ, } -impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_BlockHashZ)> for C2Tuple_TxidCOption_BlockHashZZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_BlockHashZ)) -> Self { +impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ)> for C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple_TxidCOption_BlockHashZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_BlockHashZ) { +impl C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::COption_ThirtyTwoBytesZ) { (self.a, self.b) } } -impl Clone for C2Tuple_TxidCOption_BlockHashZZ { +impl Clone for C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -4775,40 +5077,40 @@ impl Clone for C2Tuple_TxidCOption_BlockHashZZ { #[no_mangle] /// Creates a new tuple which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_TxidCOption_BlockHashZZ_clone(orig: &C2Tuple_TxidCOption_BlockHashZZ) -> C2Tuple_TxidCOption_BlockHashZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_TxidCOption_BlockHashZZ from the contained elements. +pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) -> C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_TxidCOption_BlockHashZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::COption_BlockHashZ) -> C2Tuple_TxidCOption_BlockHashZZ { - C2Tuple_TxidCOption_BlockHashZZ { a, b, } +pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { + C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_TxidCOption_BlockHashZZ. -pub extern "C" fn C2Tuple_TxidCOption_BlockHashZZ_free(_res: C2Tuple_TxidCOption_BlockHashZZ) { } +/// Frees any resources used by the C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(_res: C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_TxidCOption_BlockHashZZZ { +pub struct CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ { /// The elements in the array. /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZ, + pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_TxidCOption_BlockHashZZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { if self.datalen == 0 { return Vec::new(); } let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZ] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_TxidCOption_BlockHashZZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ { + fn from(v: Vec) -> Self { let datalen = v.len(); let data = Box::into_raw(v.into_boxed_slice()); Self { datalen, data: unsafe { (*data).as_mut_ptr() } } @@ -4816,14 +5118,14 @@ impl From> for CVe } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(_res: CVec_C2Tuple_TxidCOption_BlockHashZZZ) { } -impl Drop for CVec_C2Tuple_TxidCOption_BlockHashZZZ { +pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ) { } +impl Drop for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ { fn drop(&mut self) { if self.datalen == 0 { return; } let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_C2Tuple_TxidCOption_BlockHashZZZ { +impl Clone for CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -4832,6 +5134,98 @@ impl Clone for CVec_C2Tuple_TxidCOption_BlockHashZZZ { } } #[repr(C)] +/// The contents of CResult_ChannelMonitorUpdateStatusNoneZ +pub union CResult_ChannelMonitorUpdateStatusNoneZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::chain::ChannelMonitorUpdateStatus, + /// Note that this value is always NULL, as there are no contents in the Err variant + pub err: *mut core::ffi::c_void, +} +#[repr(C)] +/// A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_ChannelMonitorUpdateStatusNoneZ { + /// The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_ChannelMonitorUpdateStatusNoneZPtr, + /// Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state. +pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_ok(o: crate::lightning::chain::ChannelMonitorUpdateStatus) -> CResult_ChannelMonitorUpdateStatusNoneZ { + CResult_ChannelMonitorUpdateStatusNoneZ { + contents: CResult_ChannelMonitorUpdateStatusNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state. +pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_err() -> CResult_ChannelMonitorUpdateStatusNoneZ { + CResult_ChannelMonitorUpdateStatusNoneZ { + contents: CResult_ChannelMonitorUpdateStatusNoneZPtr { + err: core::ptr::null_mut(), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o: &CResult_ChannelMonitorUpdateStatusNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ. +pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_free(_res: CResult_ChannelMonitorUpdateStatusNoneZ) { } +impl Drop for CResult_ChannelMonitorUpdateStatusNoneZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + } + } +} +impl From> for CResult_ChannelMonitorUpdateStatusNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_ChannelMonitorUpdateStatusNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_ChannelMonitorUpdateStatusNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_ChannelMonitorUpdateStatusNoneZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig: &CResult_ChannelMonitorUpdateStatusNoneZ) -> CResult_ChannelMonitorUpdateStatusNoneZ { Clone::clone(&orig) } +#[repr(C)] /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size. /// This corresponds to std::vector in C++ pub struct CVec_MonitorEventZ { @@ -5642,60 +6036,14 @@ impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_ChainHashZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::ThirtyTwoBytes, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_ChainHashZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_ChainHashZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } - } -} -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_ChainHashZ_free(_res: CVec_ChainHashZ) { } -impl Drop for CVec_ChainHashZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} -impl Clone for CVec_ChainHashZ { - fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) - } -} -#[repr(C)] -/// The contents of CResult_OfferBolt12ParseErrorZ -pub union CResult_OfferBolt12ParseErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::offers::offer::Offer, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::offers::parse::Bolt12ParseError, +/// The contents of CResult_OfferBolt12ParseErrorZ +pub union CResult_OfferBolt12ParseErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::offers::offer::Offer, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::offers::parse::Bolt12ParseError, } #[repr(C)] /// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation, @@ -5784,8 +6132,8 @@ impl Clone for CResult_OfferBolt12ParseErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PublicKeyErrorZ -pub union CResult_PublicKeyErrorZPtr { +/// The contents of CResult_PublicKeySecp256k1ErrorZ +pub union CResult_PublicKeySecp256k1ErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. pub result: *mut crate::c_types::PublicKey, @@ -5794,31 +6142,31 @@ pub union CResult_PublicKeyErrorZPtr { pub err: *mut crate::c_types::Secp256k1Error, } #[repr(C)] -/// A CResult_PublicKeyErrorZ represents the result of a fallible operation, +/// A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation, /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PublicKeyErrorZ { - /// The contents of this CResult_PublicKeyErrorZ, accessible via either +pub struct CResult_PublicKeySecp256k1ErrorZ { + /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PublicKeyErrorZPtr, - /// Whether this CResult_PublicKeyErrorZ represents a success state. + pub contents: CResult_PublicKeySecp256k1ErrorZPtr, + /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PublicKeyErrorZ in the success state. -pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ { - CResult_PublicKeyErrorZ { - contents: CResult_PublicKeyErrorZPtr { +/// Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state. +pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecp256k1ErrorZ { + CResult_PublicKeySecp256k1ErrorZ { + contents: CResult_PublicKeySecp256k1ErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PublicKeyErrorZ in the error state. -pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ { - CResult_PublicKeyErrorZ { - contents: CResult_PublicKeyErrorZPtr { +/// Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state. +pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecp256k1ErrorZ { + CResult_PublicKeySecp256k1ErrorZ { + contents: CResult_PublicKeySecp256k1ErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -5826,13 +6174,13 @@ pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool { +pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PublicKeyErrorZ. -pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { } -impl Drop for CResult_PublicKeyErrorZ { +/// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ. +pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { } +impl Drop for CResult_PublicKeySecp256k1ErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -5845,16 +6193,16 @@ impl Drop for CResult_PublicKeyErrorZ { } } } -impl From> for CResult_PublicKeyErrorZ { +impl From> for CResult_PublicKeySecp256k1ErrorZ { fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_PublicKeyErrorZPtr { result } + CResult_PublicKeySecp256k1ErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PublicKeyErrorZPtr { err } + CResult_PublicKeySecp256k1ErrorZPtr { err } }; Self { contents, @@ -5862,23 +6210,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr { + Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr { result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr { + Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig` +/// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_NodeIdDecodeErrorZ pub union CResult_NodeIdDecodeErrorZPtr { @@ -6746,29 +7094,29 @@ impl Clone for CResult_RoutingFeesDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size. +/// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_NetAddressZ { +pub struct CVec_SocketAddressZ { /// The elements in the array. /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::lightning::ln::msgs::NetAddress, + pub data: *mut crate::lightning::ln::msgs::SocketAddress, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_NetAddressZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_SocketAddressZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { if self.datalen == 0 { return Vec::new(); } let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_NetAddressZ { - fn from(v: Vec) -> Self { +impl From> for CVec_SocketAddressZ { + fn from(v: Vec) -> Self { let datalen = v.len(); let data = Box::into_raw(v.into_boxed_slice()); Self { datalen, data: unsafe { (*data).as_mut_ptr() } } @@ -6776,14 +7124,14 @@ impl From> for CVec_NetAddressZ { } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { } -impl Drop for CVec_NetAddressZ { +pub extern "C" fn CVec_SocketAddressZ_free(_res: CVec_SocketAddressZ) { } +impl Drop for CVec_SocketAddressZ { fn drop(&mut self) { if self.datalen == 0 { return; } let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_NetAddressZ { +impl Clone for CVec_SocketAddressZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -7160,78 +7508,233 @@ impl From bool { if let Self::None = self { false } else { true } } #[allow(unused)] pub(crate) fn is_none(&self) -> bool { !self.is_some() } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_SocketAddressZ { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ -pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ { - COption_CVec_NetAddressZZ::Some(o) +/// Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ +pub extern "C" fn COption_CVec_SocketAddressZZ_some(o: crate::c_types::derived::CVec_SocketAddressZ) -> COption_CVec_SocketAddressZZ { + COption_CVec_SocketAddressZZ::Some(o) } #[no_mangle] -/// Constructs a new COption_CVec_NetAddressZZ containing nothing -pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ { - COption_CVec_NetAddressZZ::None +/// Constructs a new COption_CVec_SocketAddressZZ containing nothing +pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ { + COption_CVec_SocketAddressZZ::None } #[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state -pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { } +/// Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state +pub extern "C" fn COption_CVec_SocketAddressZZ_free(_res: COption_CVec_SocketAddressZZ) { } #[no_mangle] -/// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig` +/// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) } +pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not -pub enum COption_PaymentPreimageZ { - /// When we're in this state, this COption_PaymentPreimageZ contains a crate::c_types::ThirtyTwoBytes - Some(crate::c_types::ThirtyTwoBytes), - /// When we're in this state, this COption_PaymentPreimageZ contains nothing - None +/// The contents of CResult_ChannelDerivationParametersDecodeErrorZ +pub union CResult_ChannelDerivationParametersDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::events::bump_transaction::ChannelDerivationParameters, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, } -impl COption_PaymentPreimageZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } +#[repr(C)] +/// A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::events::bump_transaction::ChannelDerivationParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_ChannelDerivationParametersDecodeErrorZ { + /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr, + /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::events::bump_transaction::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ { + CResult_ChannelDerivationParametersDecodeErrorZ { + contents: CResult_ChannelDerivationParametersDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() +} +#[no_mangle] +/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ { + CResult_ChannelDerivationParametersDecodeErrorZ { + contents: CResult_ChannelDerivationParametersDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes { - if let Self::Some(v) = self { v } else { unreachable!() } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ. +pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { } +impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_ChannelDerivationParametersDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_ChannelDerivationParametersDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ChannelDerivationParametersDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_ChannelDerivationParametersDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } #[no_mangle] -/// Constructs a new COption_PaymentPreimageZ containing a crate::c_types::ThirtyTwoBytes -pub extern "C" fn COption_PaymentPreimageZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_PaymentPreimageZ { - COption_PaymentPreimageZ::Some(o) +/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_HTLCDescriptorDecodeErrorZ +pub union CResult_HTLCDescriptorDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::events::bump_transaction::HTLCDescriptor, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::events::bump_transaction::HTLCDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_HTLCDescriptorDecodeErrorZ { + /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_HTLCDescriptorDecodeErrorZPtr, + /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state. + pub result_ok: bool, } #[no_mangle] -/// Constructs a new COption_PaymentPreimageZ containing nothing -pub extern "C" fn COption_PaymentPreimageZ_none() -> COption_PaymentPreimageZ { - COption_PaymentPreimageZ::None +/// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state. +pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::events::bump_transaction::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ { + CResult_HTLCDescriptorDecodeErrorZ { + contents: CResult_HTLCDescriptorDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } } #[no_mangle] -/// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state -pub extern "C" fn COption_PaymentPreimageZ_free(_res: COption_PaymentPreimageZ) { } +/// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state. +pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ { + CResult_HTLCDescriptorDecodeErrorZ { + contents: CResult_HTLCDescriptorDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ. +pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { } +impl Drop for CResult_HTLCDescriptorDecodeErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_HTLCDescriptorDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_HTLCDescriptorDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_HTLCDescriptorDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_HTLCDescriptorDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} #[no_mangle] -/// Creates a new COption_PaymentPreimageZ which has the same data as `orig` +/// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_PaymentPreimageZ_clone(orig: &COption_PaymentPreimageZ) -> COption_PaymentPreimageZ { Clone::clone(&orig) } +pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] /// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size. /// This corresponds to std::vector in C++ @@ -7638,42 +8141,84 @@ impl Clone for CResult_CVec_UtxoZNoneZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) } #[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_u64u16Z { + /// The element at position 0 + pub a: u64, + /// The element at position 1 + pub b: u16, +} +impl From<(u64, u16)> for C2Tuple_u64u16Z { + fn from (tup: (u64, u16)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_u64u16Z { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u16) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_u64u16Z { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } + } +} +#[no_mangle] +/// Creates a new tuple which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn C2Tuple_u64u16Z_clone(orig: &C2Tuple_u64u16Z) -> C2Tuple_u64u16Z { Clone::clone(&orig) } +/// Creates a new C2Tuple_u64u16Z from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_u64u16Z_new(a: u64, b: u16) -> C2Tuple_u64u16Z { + C2Tuple_u64u16Z { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_u64u16Z. +pub extern "C" fn C2Tuple_u64u16Z_free(_res: C2Tuple_u64u16Z) { } +#[repr(C)] #[derive(Clone)] -/// An enum which can either contain a u16 or not -pub enum COption_u16Z { - /// When we're in this state, this COption_u16Z contains a u16 - Some(u16), - /// When we're in this state, this COption_u16Z contains nothing +/// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not +pub enum COption_C2Tuple_u64u16ZZ { + /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z + Some(crate::c_types::derived::C2Tuple_u64u16Z), + /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing None } -impl COption_u16Z { +impl COption_C2Tuple_u64u16ZZ { #[allow(unused)] pub(crate) fn is_some(&self) -> bool { if let Self::None = self { false } else { true } } #[allow(unused)] pub(crate) fn is_none(&self) -> bool { !self.is_some() } - #[allow(unused)] pub(crate) fn take(mut self) -> u16 { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u16Z { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_u16Z containing a u16 -pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z { - COption_u16Z::Some(o) +/// Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z +pub extern "C" fn COption_C2Tuple_u64u16ZZ_some(o: crate::c_types::derived::C2Tuple_u64u16Z) -> COption_C2Tuple_u64u16ZZ { + COption_C2Tuple_u64u16ZZ::Some(o) } #[no_mangle] -/// Constructs a new COption_u16Z containing nothing -pub extern "C" fn COption_u16Z_none() -> COption_u16Z { - COption_u16Z::None +/// Constructs a new COption_C2Tuple_u64u16ZZ containing nothing +pub extern "C" fn COption_C2Tuple_u64u16ZZ_none() -> COption_C2Tuple_u64u16ZZ { + COption_C2Tuple_u64u16ZZ::None } #[no_mangle] -/// Frees any resources associated with the u16, if we are in the Some state -pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { } +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state +pub extern "C" fn COption_C2Tuple_u64u16ZZ_free(_res: COption_C2Tuple_u64u16ZZ) { } #[no_mangle] -/// Creates a new COption_u16Z which has the same data as `orig` +/// Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) } +pub extern "C" fn COption_C2Tuple_u64u16ZZ_clone(orig: &COption_C2Tuple_u64u16ZZ) -> COption_C2Tuple_u64u16ZZ { Clone::clone(&orig) } #[repr(C)] #[derive(Clone)] /// An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not @@ -7712,45 +8257,8 @@ pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdo /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not -pub enum COption_PaymentHashZ { - /// When we're in this state, this COption_PaymentHashZ contains a crate::c_types::ThirtyTwoBytes - Some(crate::c_types::ThirtyTwoBytes), - /// When we're in this state, this COption_PaymentHashZ contains nothing - None -} -impl COption_PaymentHashZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } - } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() - } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_PaymentHashZ containing a crate::c_types::ThirtyTwoBytes -pub extern "C" fn COption_PaymentHashZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_PaymentHashZ { - COption_PaymentHashZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_PaymentHashZ containing nothing -pub extern "C" fn COption_PaymentHashZ_none() -> COption_PaymentHashZ { - COption_PaymentHashZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state -pub extern "C" fn COption_PaymentHashZ_free(_res: COption_PaymentHashZ) { } -#[no_mangle] -/// Creates a new COption_PaymentHashZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_PaymentHashZ_clone(orig: &COption_PaymentHashZ) -> COption_PaymentHashZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult__u832APIErrorZ -pub union CResult__u832APIErrorZPtr { +/// The contents of CResult_ThirtyTwoBytesAPIErrorZ +pub union CResult_ThirtyTwoBytesAPIErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. pub result: *mut crate::c_types::ThirtyTwoBytes, @@ -7759,31 +8267,31 @@ pub union CResult__u832APIErrorZPtr { pub err: *mut crate::lightning::util::errors::APIError, } #[repr(C)] -/// A CResult__u832APIErrorZ represents the result of a fallible operation, +/// A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation, /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult__u832APIErrorZ { - /// The contents of this CResult__u832APIErrorZ, accessible via either +pub struct CResult_ThirtyTwoBytesAPIErrorZ { + /// The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult__u832APIErrorZPtr, - /// Whether this CResult__u832APIErrorZ represents a success state. + pub contents: CResult_ThirtyTwoBytesAPIErrorZPtr, + /// Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult__u832APIErrorZ in the success state. -pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ { - CResult__u832APIErrorZ { - contents: CResult__u832APIErrorZPtr { +/// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state. +pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesAPIErrorZ { + CResult_ThirtyTwoBytesAPIErrorZ { + contents: CResult_ThirtyTwoBytesAPIErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult__u832APIErrorZ in the error state. -pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ { - CResult__u832APIErrorZ { - contents: CResult__u832APIErrorZPtr { +/// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state. +pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ThirtyTwoBytesAPIErrorZ { + CResult_ThirtyTwoBytesAPIErrorZ { + contents: CResult_ThirtyTwoBytesAPIErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -7791,13 +8299,13 @@ pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool { +pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o: &CResult_ThirtyTwoBytesAPIErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult__u832APIErrorZ. -pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { } -impl Drop for CResult__u832APIErrorZ { +/// Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ. +pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_free(_res: CResult_ThirtyTwoBytesAPIErrorZ) { } +impl Drop for CResult_ThirtyTwoBytesAPIErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -7810,16 +8318,16 @@ impl Drop for CResult__u832APIErrorZ { } } } -impl From> for CResult__u832APIErrorZ { +impl From> for CResult_ThirtyTwoBytesAPIErrorZ { fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult__u832APIErrorZPtr { result } + CResult_ThirtyTwoBytesAPIErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult__u832APIErrorZPtr { err } + CResult_ThirtyTwoBytesAPIErrorZPtr { err } }; Self { contents, @@ -7827,23 +8335,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult__u832APIErrorZPtr { + Self { result_ok: true, contents: CResult_ThirtyTwoBytesAPIErrorZPtr { result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult__u832APIErrorZPtr { + Self { result_ok: false, contents: CResult_ThirtyTwoBytesAPIErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult__u832APIErrorZ which has the same data as `orig` +/// Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) } #[repr(C)] /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size. /// This corresponds to std::vector in C++ @@ -8067,8 +8575,8 @@ impl Clone for CResult_NoneRetryableSendFailureZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PaymentHashPaymentSendFailureZ -pub union CResult_PaymentHashPaymentSendFailureZPtr { +/// The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ +pub union CResult_ThirtyTwoBytesPaymentSendFailureZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. pub result: *mut crate::c_types::ThirtyTwoBytes, @@ -8077,31 +8585,31 @@ pub union CResult_PaymentHashPaymentSendFailureZPtr { pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure, } #[repr(C)] -/// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation, +/// A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation, /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PaymentHashPaymentSendFailureZ { - /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either +pub struct CResult_ThirtyTwoBytesPaymentSendFailureZ { + /// The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PaymentHashPaymentSendFailureZPtr, - /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state. + pub contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr, + /// Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state. -pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ { - CResult_PaymentHashPaymentSendFailureZ { - contents: CResult_PaymentHashPaymentSendFailureZPtr { +/// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state. +pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { + CResult_ThirtyTwoBytesPaymentSendFailureZ { + contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state. -pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ { - CResult_PaymentHashPaymentSendFailureZ { - contents: CResult_PaymentHashPaymentSendFailureZPtr { +/// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state. +pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { + CResult_ThirtyTwoBytesPaymentSendFailureZ { + contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8109,13 +8617,13 @@ pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_is_ok(o: &CResult_PaymentHashPaymentSendFailureZ) -> bool { +pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ. -pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { } -impl Drop for CResult_PaymentHashPaymentSendFailureZ { +/// Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ. +pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res: CResult_ThirtyTwoBytesPaymentSendFailureZ) { } +impl Drop for CResult_ThirtyTwoBytesPaymentSendFailureZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -8128,16 +8636,16 @@ impl Drop for CResult_PaymentHashPaymentSendFailureZ { } } } -impl From> for CResult_PaymentHashPaymentSendFailureZ { +impl From> for CResult_ThirtyTwoBytesPaymentSendFailureZ { fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_PaymentHashPaymentSendFailureZPtr { result } + CResult_ThirtyTwoBytesPaymentSendFailureZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PaymentHashPaymentSendFailureZPtr { err } + CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err } }; Self { contents, @@ -8145,26 +8653,26 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr { + Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr { result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr { + Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig` +/// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PaymentHashRetryableSendFailureZ -pub union CResult_PaymentHashRetryableSendFailureZPtr { +/// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ +pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. pub result: *mut crate::c_types::ThirtyTwoBytes, @@ -8173,31 +8681,31 @@ pub union CResult_PaymentHashRetryableSendFailureZPtr { pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure, } #[repr(C)] -/// A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation, +/// A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation, /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PaymentHashRetryableSendFailureZ { - /// The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either +pub struct CResult_ThirtyTwoBytesRetryableSendFailureZ { + /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PaymentHashRetryableSendFailureZPtr, - /// Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state. + pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr, + /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state. -pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashRetryableSendFailureZ { - CResult_PaymentHashRetryableSendFailureZ { - contents: CResult_PaymentHashRetryableSendFailureZPtr { +/// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state. +pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { + CResult_ThirtyTwoBytesRetryableSendFailureZ { + contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state. -pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_PaymentHashRetryableSendFailureZ { - CResult_PaymentHashRetryableSendFailureZ { - contents: CResult_PaymentHashRetryableSendFailureZPtr { +/// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state. +pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { + CResult_ThirtyTwoBytesRetryableSendFailureZ { + contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8205,13 +8713,13 @@ pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_is_ok(o: &CResult_PaymentHashRetryableSendFailureZ) -> bool { +pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ. -pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_free(_res: CResult_PaymentHashRetryableSendFailureZ) { } -impl Drop for CResult_PaymentHashRetryableSendFailureZ { +/// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ. +pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { } +impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -8224,16 +8732,16 @@ impl Drop for CResult_PaymentHashRetryableSendFailureZ { } } } -impl From> for CResult_PaymentHashRetryableSendFailureZ { +impl From> for CResult_ThirtyTwoBytesRetryableSendFailureZ { fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_PaymentHashRetryableSendFailureZPtr { result } + CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PaymentHashRetryableSendFailureZPtr { err } + CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err } }; Self { contents, @@ -8241,32 +8749,32 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PaymentHashRetryableSendFailureZPtr { + Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PaymentHashRetryableSendFailureZPtr { + Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig` +/// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_clone(orig: &CResult_PaymentHashRetryableSendFailureZ) -> CResult_PaymentHashRetryableSendFailureZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_PaymentHashPaymentIdZ { +pub struct C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { /// The element at position 0 pub a: crate::c_types::ThirtyTwoBytes, /// The element at position 1 pub b: crate::c_types::ThirtyTwoBytes, } -impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ { +impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self { Self { a: tup.0, @@ -8274,12 +8782,12 @@ impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for } } } -impl C2Tuple_PaymentHashPaymentIdZ { +impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) { (self.a, self.b) } } -impl Clone for C2Tuple_PaymentHashPaymentIdZ { +impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -8290,52 +8798,52 @@ impl Clone for C2Tuple_PaymentHashPaymentIdZ { #[no_mangle] /// Creates a new tuple which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements. +pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig: &C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ { - C2Tuple_PaymentHashPaymentIdZ { a, b, } +pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { + C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ. -pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { } +/// Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { } #[repr(C)] -/// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ -pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { +/// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ +pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, + pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure, } #[repr(C)] -/// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. +/// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { - /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either +pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { + /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr, - /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state. + pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state. -pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { - CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { - contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { + contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state. -pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { - CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { - contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { + contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8343,13 +8851,13 @@ pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool { +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ. -pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { } -impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { +/// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) { } +impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -8362,16 +8870,16 @@ impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { } } } -impl From> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result } + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err } + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err } }; Self { contents, @@ -8379,47 +8887,47 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { + Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig` +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) } +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_ThirtyTwoBytesZ { +pub struct CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { /// The elements in the array. /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::ThirtyTwoBytes, + pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_ThirtyTwoBytesZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { if self.datalen == 0 { return Vec::new(); } let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_ThirtyTwoBytesZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { + fn from(v: Vec) -> Self { let datalen = v.len(); let data = Box::into_raw(v.into_boxed_slice()); Self { datalen, data: unsafe { (*data).as_mut_ptr() } } @@ -8427,14 +8935,14 @@ impl From> for CVec_ThirtyTwoBytesZ { } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { } -impl Drop for CVec_ThirtyTwoBytesZ { +pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) { } +impl Drop for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { fn drop(&mut self) { if self.datalen == 0 { return; } let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_ThirtyTwoBytesZ { +impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -8443,115 +8951,77 @@ impl Clone for CVec_ThirtyTwoBytesZ { } } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_PaymentHashPaymentSecretZ { - /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, - /// The element at position 1 - pub b: crate::c_types::ThirtyTwoBytes, -} -impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_PaymentHashPaymentSecretZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_PaymentHashPaymentSecretZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - } - } -} -#[no_mangle] -/// Creates a new tuple which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ { - C2Tuple_PaymentHashPaymentSecretZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ. -pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { } -#[repr(C)] -/// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ -pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { +/// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ +pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, - /// Note that this value is always NULL, as there are no contents in the Err variant - pub err: *mut core::ffi::c_void, + pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure, } #[repr(C)] -/// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure. +/// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { - /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either +pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr, - /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state. + pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr, + /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state. -pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { - CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { - contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state. -pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { - CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { - contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { + err: Box::into_raw(Box::new(e)), }, result_ok: false, } } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool { +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ. -pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { } -impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { +/// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) { } +impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { let _ = unsafe { Box::from_raw(self.contents.result) }; } } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } } } } -impl From> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result } + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err } }; Self { contents, @@ -8559,187 +9029,179 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig` +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PaymentSecretNoneZ -pub union CResult_PaymentSecretNoneZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::ThirtyTwoBytes, - /// Note that this value is always NULL, as there are no contents in the Err variant - pub err: *mut core::ffi::c_void, +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_ThirtyTwoBytesPublicKeyZ { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoBytes, + /// The element at position 1 + pub b: crate::c_types::PublicKey, } -#[repr(C)] -/// A CResult_PaymentSecretNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PaymentSecretNoneZ { - /// The contents of this CResult_PaymentSecretNoneZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PaymentSecretNoneZPtr, - /// Whether this CResult_PaymentSecretNoneZ represents a success state. - pub result_ok: bool, +impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey)> for C2Tuple_ThirtyTwoBytesPublicKeyZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } } -#[no_mangle] -/// Creates a new CResult_PaymentSecretNoneZ in the success state. -pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ { - CResult_PaymentSecretNoneZ { - contents: CResult_PaymentSecretNoneZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl C2Tuple_ThirtyTwoBytesPublicKeyZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::PublicKey) { + (self.a, self.b) } } -#[no_mangle] -/// Creates a new CResult_PaymentSecretNoneZ in the error state. -pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ { - CResult_PaymentSecretNoneZ { - contents: CResult_PaymentSecretNoneZPtr { - err: core::ptr::null_mut(), - }, - result_ok: false, +impl Clone for C2Tuple_ThirtyTwoBytesPublicKeyZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } } } -/// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool { - o.result_ok +/// Creates a new tuple which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig: &C2Tuple_ThirtyTwoBytesPublicKeyZ) -> C2Tuple_ThirtyTwoBytesPublicKeyZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ThirtyTwoBytesPublicKeyZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::PublicKey) -> C2Tuple_ThirtyTwoBytesPublicKeyZ { + C2Tuple_ThirtyTwoBytesPublicKeyZ { a, b, } } + #[no_mangle] -/// Frees any resources used by the CResult_PaymentSecretNoneZ. -pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { } -impl Drop for CResult_PaymentSecretNoneZ { - fn drop(&mut self) { - if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } - } else { - } +/// Frees any resources used by the C2Tuple_ThirtyTwoBytesPublicKeyZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res: C2Tuple_ThirtyTwoBytesPublicKeyZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CResult_PaymentSecretNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_PaymentSecretNoneZPtr { result } - } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() } - }; - Self { - contents, - result_ok: o.result_ok, - } +impl From> for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ) { } +impl Drop for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CResult_PaymentSecretNoneZ { +impl Clone for CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr { - err: core::ptr::null_mut() - } } - } + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) } } -#[no_mangle] -/// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PaymentPreimageAPIErrorZ -pub union CResult_PaymentPreimageAPIErrorZPtr { +/// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ +pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::ThirtyTwoBytes, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::util::errors::APIError, + pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, + /// Note that this value is always NULL, as there are no contents in the Err variant + pub err: *mut core::ffi::c_void, } #[repr(C)] -/// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. +/// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PaymentPreimageAPIErrorZ { - /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either +pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { + /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PaymentPreimageAPIErrorZPtr, - /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state. + pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state. -pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ { - CResult_PaymentPreimageAPIErrorZ { - contents: CResult_PaymentPreimageAPIErrorZPtr { +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { + contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state. -pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ { - CResult_PaymentPreimageAPIErrorZ { - contents: CResult_PaymentPreimageAPIErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { + contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { + err: core::ptr::null_mut(), }, result_ok: false, } } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool { +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ. -pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { } -impl Drop for CResult_PaymentPreimageAPIErrorZ { +/// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) { } +impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { let _ = unsafe { Box::from_raw(self.contents.result) }; } } else { - if unsafe { !(self.contents.err as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.err) }; - } } } } -impl From> for CResult_PaymentPreimageAPIErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_PaymentPreimageAPIErrorZPtr { result } + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PaymentPreimageAPIErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -8747,60 +9209,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::CVec_ChainHashZ or not -pub enum COption_CVec_ChainHashZZ { - /// When we're in this state, this COption_CVec_ChainHashZZ contains a crate::c_types::derived::CVec_ChainHashZ - Some(crate::c_types::derived::CVec_ChainHashZ), - /// When we're in this state, this COption_CVec_ChainHashZZ contains nothing - None -} -impl COption_CVec_ChainHashZZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } - } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() - } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_ChainHashZ { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_CVec_ChainHashZZ containing a crate::c_types::derived::CVec_ChainHashZ -pub extern "C" fn COption_CVec_ChainHashZZ_some(o: crate::c_types::derived::CVec_ChainHashZ) -> COption_CVec_ChainHashZZ { - COption_CVec_ChainHashZZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_CVec_ChainHashZZ containing nothing -pub extern "C" fn COption_CVec_ChainHashZZ_none() -> COption_CVec_ChainHashZZ { - COption_CVec_ChainHashZZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::CVec_ChainHashZ, if we are in the Some state -pub extern "C" fn COption_CVec_ChainHashZZ_free(_res: COption_CVec_ChainHashZZ) { } -#[no_mangle] -/// Creates a new COption_CVec_ChainHashZZ which has the same data as `orig` +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_CVec_ChainHashZZ_clone(orig: &COption_CVec_ChainHashZZ) -> COption_CVec_ChainHashZZ { Clone::clone(&orig) } +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr { @@ -9319,15 +9744,23 @@ impl Drop for CVec_ChannelMonitorZ { let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } +impl Clone for CVec_ChannelMonitorZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_BlockHashChannelManagerZ { +pub struct C2Tuple_ThirtyTwoBytesChannelManagerZ { /// The element at position 0 pub a: crate::c_types::ThirtyTwoBytes, /// The element at position 1 pub b: crate::lightning::ln::channelmanager::ChannelManager, } -impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ { +impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ { fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self { Self { a: tup.0, @@ -9335,56 +9768,56 @@ impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager: } } } -impl C2Tuple_BlockHashChannelManagerZ { +impl C2Tuple_ThirtyTwoBytesChannelManagerZ { #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) { (self.a, self.b) } } -/// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. +/// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ { - C2Tuple_BlockHashChannelManagerZ { a, b, } +pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ { + C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ. -pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { } +/// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { } #[repr(C)] -/// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ -pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { +/// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ +pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, + pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { - /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either +pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { + /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr, - /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state. + pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state. -pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { - CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { - contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { + CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { + contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state. -pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { - CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { - contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { + CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { + contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -9392,13 +9825,13 @@ pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: cr } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ. -pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { } -impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { +/// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { } +impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -9411,16 +9844,16 @@ impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { } } } -impl From> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result } + CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err } + CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err } }; Self { contents, @@ -10117,13 +10550,13 @@ impl Clone for CResult_HTLCUpdateDecodeErrorZ { pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_OutPointScriptZ { +pub struct C2Tuple_OutPointCVec_u8ZZ { /// The element at position 0 pub a: crate::lightning::chain::transaction::OutPoint, /// The element at position 1 pub b: crate::c_types::derived::CVec_u8Z, } -impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ { +impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ { fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self { Self { a: tup.0, @@ -10131,12 +10564,12 @@ impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::deriv } } } -impl C2Tuple_OutPointScriptZ { +impl C2Tuple_OutPointCVec_u8ZZ { #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) { (self.a, self.b) } } -impl Clone for C2Tuple_OutPointScriptZ { +impl Clone for C2Tuple_OutPointCVec_u8ZZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -10147,25 +10580,25 @@ impl Clone for C2Tuple_OutPointScriptZ { #[no_mangle] /// Creates a new tuple which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_OutPointScriptZ from the contained elements. +pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ { - C2Tuple_OutPointScriptZ { a, b, } +pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ { + C2Tuple_OutPointCVec_u8ZZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_OutPointScriptZ. -pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { } +/// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ. +pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_u32ScriptZ { +pub struct C2Tuple_u32CVec_u8ZZ { /// The element at position 0 pub a: u32, /// The element at position 1 pub b: crate::c_types::derived::CVec_u8Z, } -impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ { +impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ { fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self { Self { a: tup.0, @@ -10173,12 +10606,12 @@ impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ { } } } -impl C2Tuple_u32ScriptZ { +impl C2Tuple_u32CVec_u8ZZ { #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) { (self.a, self.b) } } -impl Clone for C2Tuple_u32ScriptZ { +impl Clone for C2Tuple_u32CVec_u8ZZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -10189,40 +10622,40 @@ impl Clone for C2Tuple_u32ScriptZ { #[no_mangle] /// Creates a new tuple which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_u32ScriptZ from the contained elements. +pub extern "C" fn C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ { - C2Tuple_u32ScriptZ { a, b, } +pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ { + C2Tuple_u32CVec_u8ZZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_u32ScriptZ. -pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { } +/// Frees any resources used by the C2Tuple_u32CVec_u8ZZ. +pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_u32ScriptZZ { +pub struct CVec_C2Tuple_u32CVec_u8ZZZ { /// The elements in the array. /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ, + pub data: *mut crate::c_types::derived::C2Tuple_u32CVec_u8ZZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_u32ScriptZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C2Tuple_u32CVec_u8ZZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { if self.datalen == 0 { return Vec::new(); } let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_u32ScriptZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C2Tuple_u32CVec_u8ZZZ { + fn from(v: Vec) -> Self { let datalen = v.len(); let data = Box::into_raw(v.into_boxed_slice()); Self { datalen, data: unsafe { (*data).as_mut_ptr() } } @@ -10230,14 +10663,14 @@ impl From> for CVec_C2Tuple_u32 } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { } -impl Drop for CVec_C2Tuple_u32ScriptZZ { +pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { } +impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ { fn drop(&mut self) { if self.datalen == 0 { return; } let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_C2Tuple_u32ScriptZZ { +impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -10247,26 +10680,26 @@ impl Clone for CVec_C2Tuple_u32ScriptZZ { } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { +pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { /// The element at position 0 pub a: crate::c_types::ThirtyTwoBytes, /// The element at position 1 - pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ, + pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ, } -impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self { +impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) { +impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) { (self.a, self.b) } } -impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { +impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -10277,40 +10710,86 @@ impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { #[no_mangle] /// Creates a new tuple which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements. +pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { - C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, } +pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { + C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ. -pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { } +/// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { } +impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size. +/// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { +pub struct CVec_CommitmentTransactionZ { /// The elements in the array. /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ, + pub data: *mut crate::lightning::ln::chan_utils::CommitmentTransaction, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_CommitmentTransactionZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { if self.datalen == 0 { return Vec::new(); } let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::CommitmentTransaction] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_CommitmentTransactionZ { + fn from(v: Vec) -> Self { let datalen = v.len(); let data = Box::into_raw(v.into_boxed_slice()); Self { datalen, data: unsafe { (*data).as_mut_ptr() } } @@ -10318,14 +10797,14 @@ impl From> f } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { } -impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { +pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { } +impl Drop for CVec_CommitmentTransactionZ { fn drop(&mut self) { if self.datalen == 0 { return; } let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { +impl Clone for CVec_CommitmentTransactionZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -10469,13 +10948,13 @@ impl Clone for CVec_C2Tuple_u32TxOutZZ { } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { +pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { /// The element at position 0 pub a: crate::c_types::ThirtyTwoBytes, /// The element at position 1 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ, } -impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { +impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self { Self { a: tup.0, @@ -10483,12 +10962,12 @@ impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple } } } -impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { +impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) { (self.a, self.b) } } -impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { +impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -10499,40 +10978,40 @@ impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { #[no_mangle] /// Creates a new tuple which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements. +pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { - C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, } +pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { + C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ. -pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { } +/// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size. /// This corresponds to std::vector in C++ pub struct CVec_TransactionOutputsZ { /// The elements in the array. /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ, + pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ, /// The number of elements pointed to by `data`. pub datalen: usize } impl CVec_TransactionOutputsZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { if self.datalen == 0 { return Vec::new(); } let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_TransactionOutputsZ { - fn from(v: Vec) -> Self { +impl From> for CVec_TransactionOutputsZ { + fn from(v: Vec) -> Self { let datalen = v.len(); let data = Box::into_raw(v.into_boxed_slice()); Self { datalen, data: unsafe { (*data).as_mut_ptr() } } @@ -10603,13 +11082,13 @@ impl Clone for CVec_BalanceZ { } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_BlockHashChannelMonitorZ { +pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ { /// The element at position 0 pub a: crate::c_types::ThirtyTwoBytes, /// The element at position 1 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor, } -impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ { +impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ { fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self { Self { a: tup.0, @@ -10617,56 +11096,68 @@ impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonit } } } -impl C2Tuple_BlockHashChannelMonitorZ { +impl C2Tuple_ThirtyTwoBytesChannelMonitorZ { #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) { (self.a, self.b) } } -/// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements. +impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } + } +} #[no_mangle] -pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ { - C2Tuple_BlockHashChannelMonitorZ { a, b, } +/// Creates a new tuple which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { + C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ. -pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { } +/// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { } #[repr(C)] -/// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ -pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { +/// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ +pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, + pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { - /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either +pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr, - /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. + pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state. -pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { - contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. -pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { - contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10674,13 +11165,13 @@ pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: cr } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. -pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { } -impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { +/// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { } +impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -10693,16 +11184,16 @@ impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { } } } -impl From> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err } }; Self { contents, @@ -10710,6 +11201,23 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. pub struct C2Tuple_PublicKeyTypeZ { @@ -10731,6 +11239,18 @@ impl C2Tuple_PublicKeyTypeZ { (self.a, self.b) } } +impl Clone for C2Tuple_PublicKeyTypeZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } + } +} +#[no_mangle] +/// Creates a new tuple which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn C2Tuple_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) } /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. #[no_mangle] pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ { @@ -10778,6 +11298,14 @@ impl Drop for CVec_C2Tuple_PublicKeyTypeZZ { let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } +impl Clone for CVec_C2Tuple_PublicKeyTypeZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} #[repr(C)] #[derive(Clone)] /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not @@ -10816,6 +11344,7 @@ pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { } /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) } #[repr(C)] +#[derive(Clone)] /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not pub enum COption_CustomOnionMessageContentsZ { /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents @@ -10847,6 +11376,10 @@ pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOn #[no_mangle] /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { } +#[no_mangle] +/// Creates a new COption_CustomOnionMessageContentsZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_CustomOnionMessageContentsZ_clone(orig: &COption_CustomOnionMessageContentsZ) -> COption_CustomOnionMessageContentsZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { @@ -10926,7 +11459,25 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] +#[derive(Clone)] /// An enum which can either contain a crate::lightning::ln::wire::Type or not pub enum COption_TypeZ { /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type @@ -10958,6 +11509,10 @@ pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ { #[no_mangle] /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { } +#[no_mangle] +/// Creates a new COption_TypeZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_COption_TypeZDecodeErrorZ pub union CResult_COption_TypeZDecodeErrorZPtr { @@ -11037,65 +11592,82 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] #[derive(Clone)] -/// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not -pub enum COption_NetAddressZ { - /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress - Some(crate::lightning::ln::msgs::NetAddress), - /// When we're in this state, this COption_NetAddressZ contains nothing +/// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not +pub enum COption_SocketAddressZ { + /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress + Some(crate::lightning::ln::msgs::SocketAddress), + /// When we're in this state, this COption_SocketAddressZ contains nothing None } -impl COption_NetAddressZ { +impl COption_SocketAddressZ { #[allow(unused)] pub(crate) fn is_some(&self) -> bool { if let Self::None = self { false } else { true } } #[allow(unused)] pub(crate) fn is_none(&self) -> bool { !self.is_some() } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress -pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ { - COption_NetAddressZ::Some(o) +/// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress +pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ { + COption_SocketAddressZ::Some(o) } #[no_mangle] -/// Constructs a new COption_NetAddressZ containing nothing -pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ { - COption_NetAddressZ::None +/// Constructs a new COption_SocketAddressZ containing nothing +pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ { + COption_SocketAddressZ::None } #[no_mangle] -/// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state -pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { } +/// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state +pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { } #[no_mangle] -/// Creates a new COption_NetAddressZ which has the same data as `orig` +/// Creates a new COption_SocketAddressZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) } +pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_PublicKeyCOption_NetAddressZZ { +pub struct C2Tuple_PublicKeyCOption_SocketAddressZZ { /// The element at position 0 pub a: crate::c_types::PublicKey, /// The element at position 1 - pub b: crate::c_types::derived::COption_NetAddressZ, + pub b: crate::c_types::derived::COption_SocketAddressZ, } -impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)> for C2Tuple_PublicKeyCOption_NetAddressZZ { - fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)) -> Self { +impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)> for C2Tuple_PublicKeyCOption_SocketAddressZZ { + fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple_PublicKeyCOption_NetAddressZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ) { +impl C2Tuple_PublicKeyCOption_SocketAddressZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_SocketAddressZ) { (self.a, self.b) } } -impl Clone for C2Tuple_PublicKeyCOption_NetAddressZZ { +impl Clone for C2Tuple_PublicKeyCOption_SocketAddressZZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -11106,40 +11678,40 @@ impl Clone for C2Tuple_PublicKeyCOption_NetAddressZZ { #[no_mangle] /// Creates a new tuple which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_NetAddressZZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements. +pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_SocketAddressZZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_PublicKeyCOption_SocketAddressZZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_NetAddressZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ { - C2Tuple_PublicKeyCOption_NetAddressZZ { a, b, } +pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_SocketAddressZ) -> C2Tuple_PublicKeyCOption_SocketAddressZZ { + C2Tuple_PublicKeyCOption_SocketAddressZZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ. -pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res: C2Tuple_PublicKeyCOption_NetAddressZZ) { } +/// Frees any resources used by the C2Tuple_PublicKeyCOption_SocketAddressZZ. +pub extern "C" fn C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCOption_SocketAddressZZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ { +pub struct CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ { /// The elements in the array. /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ, + pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { if self.datalen == 0 { return Vec::new(); } let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZ] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ { + fn from(v: Vec) -> Self { let datalen = v.len(); let data = Box::into_raw(v.into_boxed_slice()); Self { datalen, data: unsafe { (*data).as_mut_ptr() } } @@ -11147,14 +11719,14 @@ impl From> f } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ) { } -impl Drop for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ { +pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ) { } +impl Drop for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ { fn drop(&mut self) { if self.datalen == 0 { return; } let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ { +impl Clone for CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -11274,25 +11846,435 @@ pub union CResult_NonePeerHandleErrorZPtr { pub struct CResult_NonePeerHandleErrorZ { /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NonePeerHandleErrorZPtr, - /// Whether this CResult_NonePeerHandleErrorZ represents a success state. + pub contents: CResult_NonePeerHandleErrorZPtr, + /// Whether this CResult_NonePeerHandleErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_NonePeerHandleErrorZ in the success state. +pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ { + CResult_NonePeerHandleErrorZ { + contents: CResult_NonePeerHandleErrorZPtr { + result: core::ptr::null_mut(), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_NonePeerHandleErrorZ in the error state. +pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ { + CResult_NonePeerHandleErrorZ { + contents: CResult_NonePeerHandleErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_NonePeerHandleErrorZ. +pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { } +impl Drop for CResult_NonePeerHandleErrorZ { + fn drop(&mut self) { + if self.result_ok { + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_NonePeerHandleErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self { + let contents = if o.result_ok { + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NonePeerHandleErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_NonePeerHandleErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr { + result: core::ptr::null_mut() + } } + } else { + Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_boolPeerHandleErrorZ +pub union CResult_boolPeerHandleErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut bool, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError, +} +#[repr(C)] +/// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation, +/// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_boolPeerHandleErrorZ { + /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_boolPeerHandleErrorZPtr, + /// Whether this CResult_boolPeerHandleErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_boolPeerHandleErrorZ in the success state. +pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ { + CResult_boolPeerHandleErrorZ { + contents: CResult_boolPeerHandleErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_boolPeerHandleErrorZ in the error state. +pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ { + CResult_boolPeerHandleErrorZ { + contents: CResult_boolPeerHandleErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_boolPeerHandleErrorZ. +pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { } +impl Drop for CResult_boolPeerHandleErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_boolPeerHandleErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_boolPeerHandleErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_boolPeerHandleErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_boolPeerHandleErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_u32GraphSyncErrorZ +pub union CResult_u32GraphSyncErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut u32, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError, +} +#[repr(C)] +/// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation, +/// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_u32GraphSyncErrorZ { + /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_u32GraphSyncErrorZPtr, + /// Whether this CResult_u32GraphSyncErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_u32GraphSyncErrorZ in the success state. +pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ { + CResult_u32GraphSyncErrorZ { + contents: CResult_u32GraphSyncErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_u32GraphSyncErrorZ in the error state. +pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ { + CResult_u32GraphSyncErrorZ { + contents: CResult_u32GraphSyncErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_u32GraphSyncErrorZ. +pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { } +impl Drop for CResult_u32GraphSyncErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_u32GraphSyncErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_u32GraphSyncErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_u32GraphSyncErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +#[repr(C)] +/// The contents of CResult_CVec_u8ZIOErrorZ +pub union CResult_CVec_u8ZIOErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::c_types::derived::CVec_u8Z, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::c_types::IOError, +} +#[repr(C)] +/// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_CVec_u8ZIOErrorZ { + /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_CVec_u8ZIOErrorZPtr, + /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_CVec_u8ZIOErrorZ in the success state. +pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ { + CResult_CVec_u8ZIOErrorZ { + contents: CResult_CVec_u8ZIOErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_CVec_u8ZIOErrorZ in the error state. +pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ { + CResult_CVec_u8ZIOErrorZ { + contents: CResult_CVec_u8ZIOErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_CVec_u8ZIOErrorZ. +pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { } +impl Drop for CResult_CVec_u8ZIOErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_CVec_u8ZIOErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_CVec_u8ZIOErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_CVec_u8ZIOErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_CVec_u8ZIOErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::Strs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_StrZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::Str, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_StrZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_StrZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { } +impl Drop for CVec_StrZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_StrZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// The contents of CResult_CVec_StrZIOErrorZ +pub union CResult_CVec_StrZIOErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::c_types::derived::CVec_StrZ, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::c_types::IOError, +} +#[repr(C)] +/// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_CVec_StrZIOErrorZ { + /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_CVec_StrZIOErrorZPtr, + /// Whether this CResult_CVec_StrZIOErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NonePeerHandleErrorZ in the success state. -pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ { - CResult_NonePeerHandleErrorZ { - contents: CResult_NonePeerHandleErrorZPtr { - result: core::ptr::null_mut(), +/// Creates a new CResult_CVec_StrZIOErrorZ in the success state. +pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ { + CResult_CVec_StrZIOErrorZ { + contents: CResult_CVec_StrZIOErrorZPtr { + result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NonePeerHandleErrorZ in the error state. -pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ { - CResult_NonePeerHandleErrorZ { - contents: CResult_NonePeerHandleErrorZPtr { +/// Creates a new CResult_CVec_StrZIOErrorZ in the error state. +pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ { + CResult_CVec_StrZIOErrorZ { + contents: CResult_CVec_StrZIOErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11300,15 +12282,18 @@ pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool { +pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NonePeerHandleErrorZ. -pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { } -impl Drop for CResult_NonePeerHandleErrorZ { +/// Frees any resources used by the CResult_CVec_StrZIOErrorZ. +pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { } +impl Drop for CResult_CVec_StrZIOErrorZ { fn drop(&mut self) { if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } } else { if unsafe { !(self.contents.err as *mut ()).is_null() } { let _ = unsafe { Box::from_raw(self.contents.err) }; @@ -11316,16 +12301,16 @@ impl Drop for CResult_NonePeerHandleErrorZ { } } } -impl From> for CResult_NonePeerHandleErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self { +impl From> for CResult_CVec_StrZIOErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { - let _ = unsafe { Box::from_raw(o.contents.result) }; - o.contents.result = core::ptr::null_mut(); - CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() } + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_CVec_StrZIOErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NonePeerHandleErrorZPtr { err } + CResult_CVec_StrZIOErrorZPtr { err } }; Self { contents, @@ -11333,59 +12318,105 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr { - result: core::ptr::null_mut() + Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` +/// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_boolPeerHandleErrorZ -pub union CResult_boolPeerHandleErrorZPtr { +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { } +impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ +pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut bool, + pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError, + pub err: *mut crate::c_types::IOError, } #[repr(C)] -/// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation, -/// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. +/// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_boolPeerHandleErrorZ { - /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either +pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_boolPeerHandleErrorZPtr, - /// Whether this CResult_boolPeerHandleErrorZ represents a success state. + pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr, + /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_boolPeerHandleErrorZ in the success state. -pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ { - CResult_boolPeerHandleErrorZ { - contents: CResult_boolPeerHandleErrorZPtr { +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_boolPeerHandleErrorZ in the error state. -pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ { - CResult_boolPeerHandleErrorZ { - contents: CResult_boolPeerHandleErrorZPtr { +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11393,13 +12424,13 @@ pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool { +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_boolPeerHandleErrorZ. -pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { } -impl Drop for CResult_boolPeerHandleErrorZ { +/// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { } +impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11412,16 +12443,16 @@ impl Drop for CResult_boolPeerHandleErrorZ { } } } -impl From> for CResult_boolPeerHandleErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_boolPeerHandleErrorZPtr { result } + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_boolPeerHandleErrorZPtr { err } + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err } }; Self { contents, @@ -11429,59 +12460,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_u32GraphSyncErrorZ -pub union CResult_u32GraphSyncErrorZPtr { +/// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ +pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut u32, + pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError, + pub err: *mut crate::c_types::IOError, } #[repr(C)] -/// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation, -/// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure. +/// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_u32GraphSyncErrorZ { - /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either +pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_u32GraphSyncErrorZPtr, - /// Whether this CResult_u32GraphSyncErrorZ represents a success state. + pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_u32GraphSyncErrorZ in the success state. -pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ { - CResult_u32GraphSyncErrorZ { - contents: CResult_u32GraphSyncErrorZPtr { +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_u32GraphSyncErrorZ in the error state. -pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ { - CResult_u32GraphSyncErrorZ { - contents: CResult_u32GraphSyncErrorZPtr { +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11489,13 +12520,13 @@ pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossi } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool { +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_u32GraphSyncErrorZ. -pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { } -impl Drop for CResult_u32GraphSyncErrorZ { +/// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { } +impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11508,16 +12539,16 @@ impl Drop for CResult_u32GraphSyncErrorZ { } } } -impl From> for CResult_u32GraphSyncErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_u32GraphSyncErrorZPtr { result } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_u32GraphSyncErrorZPtr { err } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err } }; Self { contents, @@ -11525,16 +12556,33 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) } #[repr(C)] #[derive(Clone)] /// An enum which can either contain a crate::c_types::SecretKey or not -pub enum COption_KeyPairZ { - /// When we're in this state, this COption_KeyPairZ contains a crate::c_types::SecretKey +pub enum COption_SecretKeyZ { + /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey Some(crate::c_types::SecretKey), - /// When we're in this state, this COption_KeyPairZ contains nothing + /// When we're in this state, this COption_SecretKeyZ contains nothing None } -impl COption_KeyPairZ { +impl COption_SecretKeyZ { #[allow(unused)] pub(crate) fn is_some(&self) -> bool { if let Self::None = self { false } else { true } } @@ -11546,57 +12594,57 @@ impl COption_KeyPairZ { } } #[no_mangle] -/// Constructs a new COption_KeyPairZ containing a crate::c_types::SecretKey -pub extern "C" fn COption_KeyPairZ_some(o: crate::c_types::SecretKey) -> COption_KeyPairZ { - COption_KeyPairZ::Some(o) +/// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey +pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ { + COption_SecretKeyZ::Some(o) } #[no_mangle] -/// Constructs a new COption_KeyPairZ containing nothing -pub extern "C" fn COption_KeyPairZ_none() -> COption_KeyPairZ { - COption_KeyPairZ::None +/// Constructs a new COption_SecretKeyZ containing nothing +pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ { + COption_SecretKeyZ::None } #[no_mangle] /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state -pub extern "C" fn COption_KeyPairZ_free(_res: COption_KeyPairZ) { } +pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { } #[no_mangle] -/// Creates a new COption_KeyPairZ which has the same data as `orig` +/// Creates a new COption_SecretKeyZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_KeyPairZ_clone(orig: &COption_KeyPairZ) -> COption_KeyPairZ { Clone::clone(&orig) } +pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_KeyPairZNoneZ -pub union CResult_COption_KeyPairZNoneZPtr { +/// The contents of CResult_VerifiedInvoiceRequestNoneZ +pub union CResult_VerifiedInvoiceRequestNoneZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::COption_KeyPairZ, + pub result: *mut crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, /// Note that this value is always NULL, as there are no contents in the Err variant pub err: *mut core::ffi::c_void, } #[repr(C)] -/// A CResult_COption_KeyPairZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_KeyPairZ on success and a () on failure. +/// A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_COption_KeyPairZNoneZ { - /// The contents of this CResult_COption_KeyPairZNoneZ, accessible via either +pub struct CResult_VerifiedInvoiceRequestNoneZ { + /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_KeyPairZNoneZPtr, - /// Whether this CResult_COption_KeyPairZNoneZ represents a success state. + pub contents: CResult_VerifiedInvoiceRequestNoneZPtr, + /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_KeyPairZNoneZ in the success state. -pub extern "C" fn CResult_COption_KeyPairZNoneZ_ok(o: crate::c_types::derived::COption_KeyPairZ) -> CResult_COption_KeyPairZNoneZ { - CResult_COption_KeyPairZNoneZ { - contents: CResult_COption_KeyPairZNoneZPtr { +/// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state. +pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ { + CResult_VerifiedInvoiceRequestNoneZ { + contents: CResult_VerifiedInvoiceRequestNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_KeyPairZNoneZ in the error state. -pub extern "C" fn CResult_COption_KeyPairZNoneZ_err() -> CResult_COption_KeyPairZNoneZ { - CResult_COption_KeyPairZNoneZ { - contents: CResult_COption_KeyPairZNoneZPtr { +/// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state. +pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ { + CResult_VerifiedInvoiceRequestNoneZ { + contents: CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -11604,13 +12652,13 @@ pub extern "C" fn CResult_COption_KeyPairZNoneZ_err() -> CResult_COption_KeyPair } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_KeyPairZNoneZ_is_ok(o: &CResult_COption_KeyPairZNoneZ) -> bool { +pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_KeyPairZNoneZ. -pub extern "C" fn CResult_COption_KeyPairZNoneZ_free(_res: CResult_COption_KeyPairZNoneZ) { } -impl Drop for CResult_COption_KeyPairZNoneZ { +/// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ. +pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { } +impl Drop for CResult_VerifiedInvoiceRequestNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11620,16 +12668,16 @@ impl Drop for CResult_COption_KeyPairZNoneZ { } } } -impl From> for CResult_COption_KeyPairZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_VerifiedInvoiceRequestNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_COption_KeyPairZNoneZPtr { result } + CResult_VerifiedInvoiceRequestNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_COption_KeyPairZNoneZPtr { err: core::ptr::null_mut() } + CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -11637,60 +12685,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_KeyPairZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_KeyPairZNoneZPtr { + Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_COption_KeyPairZNoneZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_KeyPairZNoneZ_clone(orig: &CResult_COption_KeyPairZNoneZ) -> CResult_COption_KeyPairZNoneZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not -pub enum COption_ScriptZ { - /// When we're in this state, this COption_ScriptZ contains a crate::c_types::derived::CVec_u8Z - Some(crate::c_types::derived::CVec_u8Z), - /// When we're in this state, this COption_ScriptZ contains nothing - None -} -impl COption_ScriptZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } - } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() - } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_ScriptZ containing a crate::c_types::derived::CVec_u8Z -pub extern "C" fn COption_ScriptZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_ScriptZ { - COption_ScriptZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_ScriptZ containing nothing -pub extern "C" fn COption_ScriptZ_none() -> COption_ScriptZ { - COption_ScriptZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state -pub extern "C" fn COption_ScriptZ_free(_res: COption_ScriptZ) { } -#[no_mangle] -/// Creates a new COption_ScriptZ which has the same data as `orig` +/// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_ScriptZ_clone(orig: &COption_ScriptZ) -> COption_ScriptZ { Clone::clone(&orig) } +pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) } #[repr(C)] /// An enum which can either contain a or not pub enum COption_NoneZ { @@ -11804,78 +12815,137 @@ pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { } /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not -pub enum COption_TxidZ { - /// When we're in this state, this COption_TxidZ contains a crate::c_types::ThirtyTwoBytes - Some(crate::c_types::ThirtyTwoBytes), - /// When we're in this state, this COption_TxidZ contains nothing - None +/// The contents of CResult_SocketAddressDecodeErrorZ +pub union CResult_SocketAddressDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::ln::msgs::SocketAddress, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, } -impl COption_TxidZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } - } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() - } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes { - if let Self::Some(v) = self { v } else { unreachable!() } +#[repr(C)] +/// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_SocketAddressDecodeErrorZ { + /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_SocketAddressDecodeErrorZPtr, + /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_SocketAddressDecodeErrorZ in the success state. +pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ { + CResult_SocketAddressDecodeErrorZ { + contents: CResult_SocketAddressDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } #[no_mangle] -/// Constructs a new COption_TxidZ containing a crate::c_types::ThirtyTwoBytes -pub extern "C" fn COption_TxidZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_TxidZ { - COption_TxidZ::Some(o) +/// Creates a new CResult_SocketAddressDecodeErrorZ in the error state. +pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ { + CResult_SocketAddressDecodeErrorZ { + contents: CResult_SocketAddressDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } } +/// Checks if the given object is currently in the success state #[no_mangle] -/// Constructs a new COption_TxidZ containing nothing -pub extern "C" fn COption_TxidZ_none() -> COption_TxidZ { - COption_TxidZ::None +pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool { + o.result_ok } #[no_mangle] -/// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state -pub extern "C" fn COption_TxidZ_free(_res: COption_TxidZ) { } +/// Frees any resources used by the CResult_SocketAddressDecodeErrorZ. +pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { } +impl Drop for CResult_SocketAddressDecodeErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_SocketAddressDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_SocketAddressDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_SocketAddressDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_SocketAddressDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} #[no_mangle] -/// Creates a new COption_TxidZ which has the same data as `orig` +/// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_TxidZ_clone(orig: &COption_TxidZ) -> COption_TxidZ { Clone::clone(&orig) } +pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NetAddressDecodeErrorZ -pub union CResult_NetAddressDecodeErrorZPtr { +/// The contents of CResult_SocketAddressSocketAddressParseErrorZ +pub union CResult_SocketAddressSocketAddressParseErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::msgs::NetAddress, + pub result: *mut crate::lightning::ln::msgs::SocketAddress, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, + pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError, } #[repr(C)] -/// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NetAddressDecodeErrorZ { - /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either +pub struct CResult_SocketAddressSocketAddressParseErrorZ { + /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NetAddressDecodeErrorZPtr, - /// Whether this CResult_NetAddressDecodeErrorZ represents a success state. + pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr, + /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NetAddressDecodeErrorZ in the success state. -pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ { - CResult_NetAddressDecodeErrorZ { - contents: CResult_NetAddressDecodeErrorZPtr { +/// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state. +pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ { + CResult_SocketAddressSocketAddressParseErrorZ { + contents: CResult_SocketAddressSocketAddressParseErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NetAddressDecodeErrorZ in the error state. -pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ { - CResult_NetAddressDecodeErrorZ { - contents: CResult_NetAddressDecodeErrorZPtr { +/// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state. +pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ { + CResult_SocketAddressSocketAddressParseErrorZ { + contents: CResult_SocketAddressSocketAddressParseErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11883,13 +12953,13 @@ pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::ms } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool { +pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NetAddressDecodeErrorZ. -pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { } -impl Drop for CResult_NetAddressDecodeErrorZ { +/// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ. +pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { } +impl Drop for CResult_SocketAddressSocketAddressParseErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11902,16 +12972,16 @@ impl Drop for CResult_NetAddressDecodeErrorZ { } } } -impl From> for CResult_NetAddressDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SocketAddressSocketAddressParseErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_NetAddressDecodeErrorZPtr { result } + CResult_SocketAddressSocketAddressParseErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NetAddressDecodeErrorZPtr { err } + CResult_SocketAddressSocketAddressParseErrorZPtr { err } }; Self { contents, @@ -11919,23 +12989,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) } #[repr(C)] /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size. /// This corresponds to std::vector in C++ @@ -17771,40 +18841,40 @@ impl From CResult_CVec_SignatureZNoneZ { - CResult_CVec_SignatureZNoneZ { - contents: CResult_CVec_SignatureZNoneZPtr { +/// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state. +pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ { + CResult_CVec_ECDSASignatureZNoneZ { + contents: CResult_CVec_ECDSASignatureZNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CVec_SignatureZNoneZ in the error state. -pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ { - CResult_CVec_SignatureZNoneZ { - contents: CResult_CVec_SignatureZNoneZPtr { +/// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state. +pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ { + CResult_CVec_ECDSASignatureZNoneZ { + contents: CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -17812,13 +18882,13 @@ pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZN } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool { +pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_SignatureZNoneZ. -pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { } -impl Drop for CResult_CVec_SignatureZNoneZ { +/// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ. +pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { } +impl Drop for CResult_CVec_ECDSASignatureZNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17828,40 +18898,77 @@ impl Drop for CResult_CVec_SignatureZNoneZ { } } } -impl From> for CResult_CVec_SignatureZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_ECDSASignatureZNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_CVec_SignatureZNoneZPtr { result } + CResult_CVec_ECDSASignatureZNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() } + CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, result_ok: o.result_ok, } } -} -impl Clone for CResult_CVec_SignatureZNoneZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr { - err: core::ptr::null_mut() - } } - } +} +impl Clone for CResult_CVec_ECDSASignatureZNoneZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a usize or not +pub enum COption_usizeZ { + /// When we're in this state, this COption_usizeZ contains a usize + Some(usize), + /// When we're in this state, this COption_usizeZ contains nothing + None +} +impl COption_usizeZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> usize { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig` +/// Constructs a new COption_usizeZ containing a usize +pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ { + COption_usizeZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_usizeZ containing nothing +pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ { + COption_usizeZ::None +} +#[no_mangle] +/// Frees any resources associated with the usize, if we are in the Some state +pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { } +#[no_mangle] +/// Creates a new COption_usizeZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) } +pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_ShutdownScriptDecodeErrorZ pub union CResult_ShutdownScriptDecodeErrorZPtr { @@ -18151,6 +19258,102 @@ impl Clone for CResult_PaymentPurposeDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] +/// The contents of CResult_ClaimedHTLCDecodeErrorZ +pub union CResult_ClaimedHTLCDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::events::ClaimedHTLC, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_ClaimedHTLCDecodeErrorZ { + /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_ClaimedHTLCDecodeErrorZPtr, + /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state. +pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ { + CResult_ClaimedHTLCDecodeErrorZ { + contents: CResult_ClaimedHTLCDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state. +pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ { + CResult_ClaimedHTLCDecodeErrorZ { + contents: CResult_ClaimedHTLCDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ. +pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { } +impl Drop for CResult_ClaimedHTLCDecodeErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_ClaimedHTLCDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_ClaimedHTLCDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ClaimedHTLCDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_ClaimedHTLCDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] #[derive(Clone)] /// An enum which can either contain a crate::lightning::events::PathFailure or not pub enum COption_PathFailureZ { @@ -18648,13 +19851,13 @@ pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_ #[repr(C)] #[derive(Clone)] /// An enum which can either contain a crate::c_types::U128 or not -pub enum COption_u128Z { - /// When we're in this state, this COption_u128Z contains a crate::c_types::U128 +pub enum COption_U128Z { + /// When we're in this state, this COption_U128Z contains a crate::c_types::U128 Some(crate::c_types::U128), - /// When we're in this state, this COption_u128Z contains nothing + /// When we're in this state, this COption_U128Z contains nothing None } -impl COption_u128Z { +impl COption_U128Z { #[allow(unused)] pub(crate) fn is_some(&self) -> bool { if let Self::None = self { false } else { true } } @@ -18666,59 +19869,68 @@ impl COption_u128Z { } } #[no_mangle] -/// Constructs a new COption_u128Z containing a crate::c_types::U128 -pub extern "C" fn COption_u128Z_some(o: crate::c_types::U128) -> COption_u128Z { - COption_u128Z::Some(o) +/// Constructs a new COption_U128Z containing a crate::c_types::U128 +pub extern "C" fn COption_U128Z_some(o: crate::c_types::U128) -> COption_U128Z { + COption_U128Z::Some(o) } #[no_mangle] -/// Constructs a new COption_u128Z containing nothing -pub extern "C" fn COption_u128Z_none() -> COption_u128Z { - COption_u128Z::None +/// Constructs a new COption_U128Z containing nothing +pub extern "C" fn COption_U128Z_none() -> COption_U128Z { + COption_U128Z::None } #[no_mangle] /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state -pub extern "C" fn COption_u128Z_free(_res: COption_u128Z) { } +pub extern "C" fn COption_U128Z_free(_res: COption_U128Z) { } #[no_mangle] -/// Creates a new COption_u128Z which has the same data as `orig` +/// Creates a new COption_U128Z which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_u128Z_clone(orig: &COption_u128Z) -> COption_u128Z { Clone::clone(&orig) } +pub extern "C" fn COption_U128Z_clone(orig: &COption_U128Z) -> COption_U128Z { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not -pub enum COption_PaymentIdZ { - /// When we're in this state, this COption_PaymentIdZ contains a crate::c_types::ThirtyTwoBytes - Some(crate::c_types::ThirtyTwoBytes), - /// When we're in this state, this COption_PaymentIdZ contains nothing - None +/// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_ClaimedHTLCZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::lightning::events::ClaimedHTLC, + /// The number of elements pointed to by `data`. + pub datalen: usize } -impl COption_PaymentIdZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } +impl CVec_ClaimedHTLCZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes { - if let Self::Some(v) = self { v } else { unreachable!() } +} +impl From> for CVec_ClaimedHTLCZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } } } #[no_mangle] -/// Constructs a new COption_PaymentIdZ containing a crate::c_types::ThirtyTwoBytes -pub extern "C" fn COption_PaymentIdZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_PaymentIdZ { - COption_PaymentIdZ::Some(o) +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { } +impl Drop for CVec_ClaimedHTLCZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } } -#[no_mangle] -/// Constructs a new COption_PaymentIdZ containing nothing -pub extern "C" fn COption_PaymentIdZ_none() -> COption_PaymentIdZ { - COption_PaymentIdZ::None +impl Clone for CVec_ClaimedHTLCZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } } -#[no_mangle] -/// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state -pub extern "C" fn COption_PaymentIdZ_free(_res: COption_PaymentIdZ) { } -#[no_mangle] -/// Creates a new COption_PaymentIdZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_PaymentIdZ_clone(orig: &COption_PaymentIdZ) -> COption_PaymentIdZ { Clone::clone(&orig) } #[repr(C)] #[derive(Clone)] /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not @@ -18890,123 +20102,6 @@ impl Clone for CResult_COption_EventZDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_C2Tuple_BlockHashChannelMonitorZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_C2Tuple_BlockHashChannelMonitorZZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } - } -} -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { } -impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} -#[repr(C)] -/// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ -pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::c_types::IOError, -} -#[repr(C)] -/// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { - /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr, - /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state. -pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { - CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { - contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state. -pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { - CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { - contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, - } -} -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ. -pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { } -impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { - fn drop(&mut self) { - if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } - } else { - if unsafe { !(self.contents.err as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.err) }; - } - } - } -} -impl From> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -#[repr(C)] /// The contents of CResult_SiPrefixBolt11ParseErrorZ pub union CResult_SiPrefixBolt11ParseErrorZPtr { /// A pointer to the contents in the success state. @@ -19341,8 +20436,8 @@ pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a: cr /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ. pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { } #[repr(C)] -/// The contents of CResult_PayeePubKeyErrorZ -pub union CResult_PayeePubKeyErrorZPtr { +/// The contents of CResult_PayeePubKeySecp256k1ErrorZ +pub union CResult_PayeePubKeySecp256k1ErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. pub result: *mut crate::lightning_invoice::PayeePubKey, @@ -19351,31 +20446,31 @@ pub union CResult_PayeePubKeyErrorZPtr { pub err: *mut crate::c_types::Secp256k1Error, } #[repr(C)] -/// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation, +/// A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation, /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PayeePubKeyErrorZ { - /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either +pub struct CResult_PayeePubKeySecp256k1ErrorZ { + /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PayeePubKeyErrorZPtr, - /// Whether this CResult_PayeePubKeyErrorZ represents a success state. + pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr, + /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PayeePubKeyErrorZ in the success state. -pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ { - CResult_PayeePubKeyErrorZ { - contents: CResult_PayeePubKeyErrorZPtr { +/// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state. +pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ { + CResult_PayeePubKeySecp256k1ErrorZ { + contents: CResult_PayeePubKeySecp256k1ErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PayeePubKeyErrorZ in the error state. -pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ { - CResult_PayeePubKeyErrorZ { - contents: CResult_PayeePubKeyErrorZPtr { +/// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state. +pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ { + CResult_PayeePubKeySecp256k1ErrorZ { + contents: CResult_PayeePubKeySecp256k1ErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19383,13 +20478,13 @@ pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Erro } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool { +pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PayeePubKeyErrorZ. -pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { } -impl Drop for CResult_PayeePubKeyErrorZ { +/// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ. +pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { } +impl Drop for CResult_PayeePubKeySecp256k1ErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19402,16 +20497,16 @@ impl Drop for CResult_PayeePubKeyErrorZ { } } } -impl From> for CResult_PayeePubKeyErrorZ { +impl From> for CResult_PayeePubKeySecp256k1ErrorZ { fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_PayeePubKeyErrorZPtr { result } + CResult_PayeePubKeySecp256k1ErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PayeePubKeyErrorZPtr { err } + CResult_PayeePubKeySecp256k1ErrorZPtr { err } }; Self { contents, @@ -19419,23 +20514,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr { + Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr { result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr { + Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` +/// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) } #[repr(C)] /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size. /// This corresponds to std::vector in C++ @@ -19752,66 +20847,20 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::Strs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_AddressZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::Str, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_AddressZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_AddressZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } - } -} -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_AddressZ_free(_res: CVec_AddressZ) { } -impl Drop for CVec_AddressZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} -impl Clone for CVec_AddressZ { - fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) + Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } +#[no_mangle] +/// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_DescriptionCreationErrorZ pub union CResult_DescriptionCreationErrorZPtr { @@ -20416,10 +21465,298 @@ pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::ligh } } #[no_mangle] -/// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state. -pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ { - CResult_TransactionU16LenLimitedDecodeErrorZ { - contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { +/// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state. +pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ { + CResult_TransactionU16LenLimitedDecodeErrorZ { + contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ. +pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { } +impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_TransactionU16LenLimitedDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_TransactionU16LenLimitedDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_TransactionU16LenLimitedDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_UntrustedStringDecodeErrorZ +pub union CResult_UntrustedStringDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::util::string::UntrustedString, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_UntrustedStringDecodeErrorZ { + /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_UntrustedStringDecodeErrorZPtr, + /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state. +pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ { + CResult_UntrustedStringDecodeErrorZ { + contents: CResult_UntrustedStringDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state. +pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ { + CResult_UntrustedStringDecodeErrorZ { + contents: CResult_UntrustedStringDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ. +pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { } +impl Drop for CResult_UntrustedStringDecodeErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_UntrustedStringDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_UntrustedStringDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_UntrustedStringDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_UntrustedStringDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_ReceiveTlvsDecodeErrorZ +pub union CResult_ReceiveTlvsDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::blinded_path::payment::ReceiveTlvs, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// A CResult_ReceiveTlvsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::blinded_path::payment::ReceiveTlvs on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_ReceiveTlvsDecodeErrorZ { + /// The contents of this CResult_ReceiveTlvsDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_ReceiveTlvsDecodeErrorZPtr, + /// Whether this CResult_ReceiveTlvsDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_ReceiveTlvsDecodeErrorZ in the success state. +pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::ReceiveTlvs) -> CResult_ReceiveTlvsDecodeErrorZ { + CResult_ReceiveTlvsDecodeErrorZ { + contents: CResult_ReceiveTlvsDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_ReceiveTlvsDecodeErrorZ in the error state. +pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReceiveTlvsDecodeErrorZ { + CResult_ReceiveTlvsDecodeErrorZ { + contents: CResult_ReceiveTlvsDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_is_ok(o: &CResult_ReceiveTlvsDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_ReceiveTlvsDecodeErrorZ. +pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_free(_res: CResult_ReceiveTlvsDecodeErrorZ) { } +impl Drop for CResult_ReceiveTlvsDecodeErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_ReceiveTlvsDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_ReceiveTlvsDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ReceiveTlvsDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_ReceiveTlvsDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ReceiveTlvsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ReceiveTlvsDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_ReceiveTlvsDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ReceiveTlvsDecodeErrorZ_clone(orig: &CResult_ReceiveTlvsDecodeErrorZ) -> CResult_ReceiveTlvsDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_PaymentRelayDecodeErrorZ +pub union CResult_PaymentRelayDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::blinded_path::payment::PaymentRelay, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_PaymentRelayDecodeErrorZ { + /// The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_PaymentRelayDecodeErrorZPtr, + /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_PaymentRelayDecodeErrorZ in the success state. +pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentRelay) -> CResult_PaymentRelayDecodeErrorZ { + CResult_PaymentRelayDecodeErrorZ { + contents: CResult_PaymentRelayDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_PaymentRelayDecodeErrorZ in the error state. +pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentRelayDecodeErrorZ { + CResult_PaymentRelayDecodeErrorZ { + contents: CResult_PaymentRelayDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20427,13 +21764,13 @@ pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lig } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ. -pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { } -impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ { +/// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ. +pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { } +impl Drop for CResult_PaymentRelayDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20446,16 +21783,16 @@ impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ { } } } -impl From> for CResult_TransactionU16LenLimitedDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PaymentRelayDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_TransactionU16LenLimitedDecodeErrorZPtr { result } + CResult_PaymentRelayDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TransactionU16LenLimitedDecodeErrorZPtr { err } + CResult_PaymentRelayDecodeErrorZPtr { err } }; Self { contents, @@ -20463,59 +21800,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UntrustedStringDecodeErrorZ -pub union CResult_UntrustedStringDecodeErrorZPtr { +/// The contents of CResult_PaymentConstraintsDecodeErrorZ +pub union CResult_PaymentConstraintsDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::util::string::UntrustedString, + pub result: *mut crate::lightning::blinded_path::payment::PaymentConstraints, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_UntrustedStringDecodeErrorZ { - /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either +pub struct CResult_PaymentConstraintsDecodeErrorZ { + /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UntrustedStringDecodeErrorZPtr, - /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state. + pub contents: CResult_PaymentConstraintsDecodeErrorZPtr, + /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state. -pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ { - CResult_UntrustedStringDecodeErrorZ { - contents: CResult_UntrustedStringDecodeErrorZPtr { +/// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state. +pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentConstraints) -> CResult_PaymentConstraintsDecodeErrorZ { + CResult_PaymentConstraintsDecodeErrorZ { + contents: CResult_PaymentConstraintsDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state. -pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ { - CResult_UntrustedStringDecodeErrorZ { - contents: CResult_UntrustedStringDecodeErrorZPtr { +/// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state. +pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentConstraintsDecodeErrorZ { + CResult_PaymentConstraintsDecodeErrorZ { + contents: CResult_PaymentConstraintsDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20523,13 +21860,13 @@ pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ. -pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { } -impl Drop for CResult_UntrustedStringDecodeErrorZ { +/// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ. +pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { } +impl Drop for CResult_PaymentConstraintsDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20542,16 +21879,16 @@ impl Drop for CResult_UntrustedStringDecodeErrorZ { } } } -impl From> for CResult_UntrustedStringDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PaymentConstraintsDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_UntrustedStringDecodeErrorZPtr { result } + CResult_PaymentConstraintsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UntrustedStringDecodeErrorZPtr { err } + CResult_PaymentConstraintsDecodeErrorZPtr { err } }; Self { contents, @@ -20559,26 +21896,26 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PaymentIdPaymentErrorZ -pub union CResult_PaymentIdPaymentErrorZPtr { +/// The contents of CResult_ThirtyTwoBytesPaymentErrorZ +pub union CResult_ThirtyTwoBytesPaymentErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. pub result: *mut crate::c_types::ThirtyTwoBytes, @@ -20587,31 +21924,31 @@ pub union CResult_PaymentIdPaymentErrorZPtr { pub err: *mut crate::lightning_invoice::payment::PaymentError, } #[repr(C)] -/// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation, +/// A CResult_ThirtyTwoBytesPaymentErrorZ represents the result of a fallible operation, /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PaymentIdPaymentErrorZ { - /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either +pub struct CResult_ThirtyTwoBytesPaymentErrorZ { + /// The contents of this CResult_ThirtyTwoBytesPaymentErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PaymentIdPaymentErrorZPtr, - /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state. + pub contents: CResult_ThirtyTwoBytesPaymentErrorZPtr, + /// Whether this CResult_ThirtyTwoBytesPaymentErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PaymentIdPaymentErrorZ in the success state. -pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ { - CResult_PaymentIdPaymentErrorZ { - contents: CResult_PaymentIdPaymentErrorZPtr { +/// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the success state. +pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentErrorZ { + CResult_ThirtyTwoBytesPaymentErrorZ { + contents: CResult_ThirtyTwoBytesPaymentErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PaymentIdPaymentErrorZ in the error state. -pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ { - CResult_PaymentIdPaymentErrorZ { - contents: CResult_PaymentIdPaymentErrorZPtr { +/// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the error state. +pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_ThirtyTwoBytesPaymentErrorZ { + CResult_ThirtyTwoBytesPaymentErrorZ { + contents: CResult_ThirtyTwoBytesPaymentErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20619,13 +21956,13 @@ pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool { +pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PaymentIdPaymentErrorZ. -pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { } -impl Drop for CResult_PaymentIdPaymentErrorZ { +/// Frees any resources used by the CResult_ThirtyTwoBytesPaymentErrorZ. +pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_free(_res: CResult_ThirtyTwoBytesPaymentErrorZ) { } +impl Drop for CResult_ThirtyTwoBytesPaymentErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20638,16 +21975,16 @@ impl Drop for CResult_PaymentIdPaymentErrorZ { } } } -impl From> for CResult_PaymentIdPaymentErrorZ { +impl From> for CResult_ThirtyTwoBytesPaymentErrorZ { fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_PaymentIdPaymentErrorZPtr { result } + CResult_ThirtyTwoBytesPaymentErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PaymentIdPaymentErrorZPtr { err } + CResult_ThirtyTwoBytesPaymentErrorZPtr { err } }; Self { contents, @@ -20655,23 +21992,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr { + Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentErrorZPtr { result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr { + Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig` +/// Creates a new CResult_ThirtyTwoBytesPaymentErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ThirtyTwoBytesPaymentErrorZ_clone(orig: &CResult_ThirtyTwoBytesPaymentErrorZ) -> CResult_ThirtyTwoBytesPaymentErrorZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_NonePaymentErrorZ pub union CResult_NonePaymentErrorZPtr { @@ -20765,8 +22102,104 @@ impl Clone for CResult_NonePaymentErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_StringErrorZ -pub union CResult_StringErrorZPtr { +/// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ +pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning_invoice::payment::ProbingError, +} +#[repr(C)] +/// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning_invoice::payment::ProbingError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { + /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr, + /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the success state. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { + contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the error state. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(e: crate::lightning_invoice::payment::ProbingError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { + contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) { } +impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_StrSecp256k1ErrorZ +pub union CResult_StrSecp256k1ErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. pub result: *mut crate::c_types::Str, @@ -20775,31 +22208,31 @@ pub union CResult_StringErrorZPtr { pub err: *mut crate::c_types::Secp256k1Error, } #[repr(C)] -/// A CResult_StringErrorZ represents the result of a fallible operation, +/// A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation, /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_StringErrorZ { - /// The contents of this CResult_StringErrorZ, accessible via either +pub struct CResult_StrSecp256k1ErrorZ { + /// The contents of this CResult_StrSecp256k1ErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_StringErrorZPtr, - /// Whether this CResult_StringErrorZ represents a success state. + pub contents: CResult_StrSecp256k1ErrorZPtr, + /// Whether this CResult_StrSecp256k1ErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_StringErrorZ in the success state. -pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ { - CResult_StringErrorZ { - contents: CResult_StringErrorZPtr { +/// Creates a new CResult_StrSecp256k1ErrorZ in the success state. +pub extern "C" fn CResult_StrSecp256k1ErrorZ_ok(o: crate::c_types::Str) -> CResult_StrSecp256k1ErrorZ { + CResult_StrSecp256k1ErrorZ { + contents: CResult_StrSecp256k1ErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_StringErrorZ in the error state. -pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ { - CResult_StringErrorZ { - contents: CResult_StringErrorZPtr { +/// Creates a new CResult_StrSecp256k1ErrorZ in the error state. +pub extern "C" fn CResult_StrSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StrSecp256k1ErrorZ { + CResult_StrSecp256k1ErrorZ { + contents: CResult_StrSecp256k1ErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20807,13 +22240,13 @@ pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool { +pub extern "C" fn CResult_StrSecp256k1ErrorZ_is_ok(o: &CResult_StrSecp256k1ErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_StringErrorZ. -pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { } -impl Drop for CResult_StringErrorZ { +/// Frees any resources used by the CResult_StrSecp256k1ErrorZ. +pub extern "C" fn CResult_StrSecp256k1ErrorZ_free(_res: CResult_StrSecp256k1ErrorZ) { } +impl Drop for CResult_StrSecp256k1ErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20826,16 +22259,16 @@ impl Drop for CResult_StringErrorZ { } } } -impl From> for CResult_StringErrorZ { +impl From> for CResult_StrSecp256k1ErrorZ { fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_StringErrorZPtr { result } + CResult_StrSecp256k1ErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_StringErrorZPtr { err } + CResult_StrSecp256k1ErrorZPtr { err } }; Self { contents, @@ -20843,23 +22276,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_StringErrorZPtr { + Self { result_ok: true, contents: CResult_StrSecp256k1ErrorZPtr { result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_StringErrorZPtr { + Self { result_ok: false, contents: CResult_StrSecp256k1ErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_StringErrorZ which has the same data as `orig` +/// Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_StrSecp256k1ErrorZ_clone(orig: &CResult_StrSecp256k1ErrorZ) -> CResult_StrSecp256k1ErrorZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_TxOutUtxoLookupErrorZ pub union CResult_TxOutUtxoLookupErrorZPtr { @@ -21049,6 +22482,127 @@ impl Clone for CResult_OnionMessagePathNoneZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) } #[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_PublicKeyOnionMessageZ { + /// The element at position 0 + pub a: crate::c_types::PublicKey, + /// The element at position 1 + pub b: crate::lightning::ln::msgs::OnionMessage, +} +impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage)> for C2Tuple_PublicKeyOnionMessageZ { + fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_PublicKeyOnionMessageZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_PublicKeyOnionMessageZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } + } +} +#[no_mangle] +/// Creates a new tuple which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_clone(orig: &C2Tuple_PublicKeyOnionMessageZ) -> C2Tuple_PublicKeyOnionMessageZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_PublicKeyOnionMessageZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::msgs::OnionMessage) -> C2Tuple_PublicKeyOnionMessageZ { + C2Tuple_PublicKeyOnionMessageZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_PublicKeyOnionMessageZ. +pub extern "C" fn C2Tuple_PublicKeyOnionMessageZ_free(_res: C2Tuple_PublicKeyOnionMessageZ) { } +#[repr(C)] +/// The contents of CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ +pub union CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::onion_message::messenger::SendError, +} +#[repr(C)] +/// A CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ on success and a crate::lightning::onion_message::messenger::SendError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ { + /// The contents of this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr, + /// Whether this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the success state. +pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(o: crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ) -> CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ { + CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ { + contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the error state. +pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ { + CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ { + contents: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(o: &CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ. +pub extern "C" fn CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res: CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ) { } +impl Drop for CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +#[repr(C)] /// The contents of CResult_NoneSendErrorZ pub union CResult_NoneSendErrorZPtr { /// Note that this value is always NULL, as there are no contents in the OK variant @@ -21216,6 +22770,98 @@ impl Clone for CResult_BlindedPathNoneZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) } #[repr(C)] +/// The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ +pub union CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, + /// Note that this value is always NULL, as there are no contents in the Err variant + pub err: *mut core::ffi::c_void, +} +#[repr(C)] +/// A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { + /// The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr, + /// Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state. +pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o: crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { + CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { + contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state. +pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { + CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { + contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { + err: core::ptr::null_mut(), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ. +pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) { } +impl Drop for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + } + } +} +impl From> for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { Clone::clone(&orig) } +#[repr(C)] /// The contents of CResult_BlindedPathDecodeErrorZ pub union CResult_BlindedPathDecodeErrorZPtr { /// A pointer to the contents in the success state. diff --git a/lightning-c-bindings/src/c_types/mod.rs b/lightning-c-bindings/src/c_types/mod.rs index 1cb1ecce..eb9be439 100644 --- a/lightning-c-bindings/src/c_types/mod.rs +++ b/lightning-c-bindings/src/c_types/mod.rs @@ -8,7 +8,8 @@ use bitcoin::Witness as BitcoinWitness; use bitcoin::hashes::Hash; use bitcoin::secp256k1::PublicKey as SecpPublicKey; use bitcoin::secp256k1::SecretKey as SecpSecretKey; -use bitcoin::secp256k1::ecdsa::Signature as SecpSignature; +use bitcoin::secp256k1::ecdsa::Signature as ECDSASecpSignature; +use bitcoin::secp256k1::schnorr::Signature as SchnorrSecpSignature; use bitcoin::secp256k1::Error as SecpError; use bitcoin::secp256k1::ecdsa::RecoveryId; use bitcoin::secp256k1::ecdsa::RecoverableSignature as SecpRecoverableSignature; @@ -17,6 +18,7 @@ use bitcoin::bech32; use bitcoin::util::address; use core::convert::TryInto; // Bindings need at least rustc 1.34 +use alloc::borrow::ToOwned; use core::ffi::c_void; #[cfg(feature = "std")] @@ -135,23 +137,38 @@ impl SecretKey { #[repr(C)] #[derive(Clone)] -/// Represents a secp256k1 signature serialized as two 32-byte numbers -pub struct Signature { +/// Represents a secp256k1 ECDSA signature serialized as two 32-byte numbers +pub struct ECDSASignature { /// The bytes of the signature in "compact" form pub compact_form: [u8; 64], } -impl Signature { - pub(crate) fn from_rust(pk: &SecpSignature) -> Self { +impl ECDSASignature { + pub(crate) fn from_rust(pk: &ECDSASecpSignature) -> Self { Self { compact_form: pk.serialize_compact(), } } - pub(crate) fn into_rust(&self) -> SecpSignature { - SecpSignature::from_compact(&self.compact_form).unwrap() + pub(crate) fn into_rust(&self) -> ECDSASecpSignature { + ECDSASecpSignature::from_compact(&self.compact_form).unwrap() + } +} + +#[repr(C)] +#[derive(Clone)] +/// Represents a secp256k1 Schnorr signature serialized as two 32-byte numbers +pub struct SchnorrSignature { + /// The bytes of the signature as two 32-byte numbers + pub compact_form: [u8; 64], +} +impl SchnorrSignature { + pub(crate) fn from_rust(pk: &SchnorrSecpSignature) -> Self { + Self { + compact_form: pk.as_ref().clone(), + } + } + pub(crate) fn into_rust(&self) -> SchnorrSecpSignature { + SchnorrSecpSignature::from_slice(&self.compact_form).unwrap() } - // The following are used for Option which we support, but don't use anymore - #[allow(unused)] pub(crate) fn is_null(&self) -> bool { self.compact_form[..] == [0; 64][..] } - #[allow(unused)] pub(crate) fn null() -> Self { Self { compact_form: [0; 64] } } } #[repr(C)] @@ -673,8 +690,8 @@ pub struct TwentyBytes { /** The twenty bytes */ pub data: [u8; 20], } #[derive(Clone)] #[repr(C)] -/// 8 u16s -pub struct EightU16s { /** The eight 16-bit integers */ pub data: [u16; 8], } +/// 32 u16s +pub struct ThirtyTwoU16s { /** The thirty-two 16-bit integers */ pub data: [u16; 32], } pub(crate) struct VecWriter(pub Vec); impl lightning::util::ser::Writer for VecWriter { @@ -709,14 +726,14 @@ pub struct Str { /// Whether the data pointed to by `chars` should be freed or not. pub chars_is_owned: bool, } -impl Into for &'static str { +impl Into for &str { fn into(self) -> Str { - Str { chars: self.as_ptr(), len: self.len(), chars_is_owned: false } + self.to_owned().into() } } -impl Into for &mut &'static str { +impl Into for &mut &str { fn into(self) -> Str { - let us: &'static str = *self; + let us: &str = *self; us.into() } } @@ -742,6 +759,10 @@ impl Str { }; String::from_utf8(bytes).unwrap() } + #[cfg(feature = "std")] + pub(crate) fn into_pathbuf(mut self) -> std::path::PathBuf { + std::path::PathBuf::from(self.into_string()) + } } impl Into for String { fn into(self) -> Str { @@ -749,6 +770,12 @@ impl Into for String { Str { chars: s.as_ptr(), len: s.len(), chars_is_owned: true } } } +#[cfg(feature = "std")] +impl Into for std::path::PathBuf { + fn into(self) -> Str { + self.into_os_string().into_string().expect("We expect paths to be UTF-8 valid").into() + } +} impl Clone for Str { fn clone(&self) -> Self { String::from(self.into_str()).into() diff --git a/lightning-c-bindings/src/lightning/blinded_path.rs b/lightning-c-bindings/src/lightning/blinded_path/mod.rs similarity index 60% rename from lightning-c-bindings/src/lightning/blinded_path.rs rename to lightning-c-bindings/src/lightning/blinded_path/mod.rs index 1972ae83..949321c3 100644 --- a/lightning-c-bindings/src/lightning/blinded_path.rs +++ b/lightning-c-bindings/src/lightning/blinded_path/mod.rs @@ -9,6 +9,7 @@ //! Creating blinded paths and related utilities live here. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -16,9 +17,23 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; +pub mod payment; +mod message { + +use alloc::str::FromStr; +use alloc::string::String; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +} mod utils { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -79,6 +94,66 @@ impl BlindedPath { ret } } +/// To send to a blinded path, the sender first finds a route to the unblinded +/// `introduction_node_id`, which can unblind its [`encrypted_payload`] to find out the onion +/// message or payment's next hop and forward it along. +/// +/// [`encrypted_payload`]: BlindedHop::encrypted_payload +#[no_mangle] +pub extern "C" fn BlindedPath_get_introduction_node_id(this_ptr: &BlindedPath) -> crate::c_types::PublicKey { + let mut inner_val = &mut this_ptr.get_native_mut_ref().introduction_node_id; + crate::c_types::PublicKey::from_rust(&inner_val) +} +/// To send to a blinded path, the sender first finds a route to the unblinded +/// `introduction_node_id`, which can unblind its [`encrypted_payload`] to find out the onion +/// message or payment's next hop and forward it along. +/// +/// [`encrypted_payload`]: BlindedHop::encrypted_payload +#[no_mangle] +pub extern "C" fn BlindedPath_set_introduction_node_id(this_ptr: &mut BlindedPath, mut val: crate::c_types::PublicKey) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.introduction_node_id = val.into_rust(); +} +/// Used by the introduction node to decrypt its [`encrypted_payload`] to forward the onion +/// message or payment. +/// +/// [`encrypted_payload`]: BlindedHop::encrypted_payload +#[no_mangle] +pub extern "C" fn BlindedPath_get_blinding_point(this_ptr: &BlindedPath) -> crate::c_types::PublicKey { + let mut inner_val = &mut this_ptr.get_native_mut_ref().blinding_point; + crate::c_types::PublicKey::from_rust(&inner_val) +} +/// Used by the introduction node to decrypt its [`encrypted_payload`] to forward the onion +/// message or payment. +/// +/// [`encrypted_payload`]: BlindedHop::encrypted_payload +#[no_mangle] +pub extern "C" fn BlindedPath_set_blinding_point(this_ptr: &mut BlindedPath, mut val: crate::c_types::PublicKey) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.blinding_point = val.into_rust(); +} +/// The hops composing the blinded path. +#[no_mangle] +pub extern "C" fn BlindedPath_get_blinded_hops(this_ptr: &BlindedPath) -> crate::c_types::derived::CVec_BlindedHopZ { + let mut inner_val = &mut this_ptr.get_native_mut_ref().blinded_hops; + let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::blinded_path::BlindedHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::blinded_path::BlindedHop<>) as *mut _) }, is_owned: false } }); }; + local_inner_val.into() +} +/// The hops composing the blinded path. +#[no_mangle] +pub extern "C" fn BlindedPath_set_blinded_hops(this_ptr: &mut BlindedPath, mut val: crate::c_types::derived::CVec_BlindedHopZ) { + let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.blinded_hops = local_val; +} +/// Constructs a new BlindedPath given each field +#[must_use] +#[no_mangle] +pub extern "C" fn BlindedPath_new(mut introduction_node_id_arg: crate::c_types::PublicKey, mut blinding_point_arg: crate::c_types::PublicKey, mut blinded_hops_arg: crate::c_types::derived::CVec_BlindedHopZ) -> BlindedPath { + let mut local_blinded_hops_arg = Vec::new(); for mut item in blinded_hops_arg.into_rust().drain(..) { local_blinded_hops_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + BlindedPath { inner: ObjOps::heap_alloc(nativeBlindedPath { + introduction_node_id: introduction_node_id_arg.into_rust(), + blinding_point: blinding_point_arg.into_rust(), + blinded_hops: local_blinded_hops_arg, + }), is_owned: true } +} impl Clone for BlindedPath { fn clone(&self) -> Self { Self { @@ -121,8 +196,9 @@ pub extern "C" fn BlindedPath_eq(a: &BlindedPath, b: &BlindedPath) -> bool { use lightning::blinded_path::BlindedHop as nativeBlindedHopImport; pub(crate) type nativeBlindedHop = nativeBlindedHopImport; -/// Used to construct the blinded hops portion of a blinded path. These hops cannot be identified -/// by outside observers and thus can be used to hide the identity of the recipient. +/// An encrypted payload and node id corresponding to a hop in a payment or onion message path, to +/// be encoded in the sender's onion packet. These hops cannot be identified by outside observers +/// and thus can be used to hide the identity of the recipient. #[must_use] #[repr(C)] pub struct BlindedHop { @@ -169,6 +245,42 @@ impl BlindedHop { ret } } +/// The blinded node id of this hop in a [`BlindedPath`]. +#[no_mangle] +pub extern "C" fn BlindedHop_get_blinded_node_id(this_ptr: &BlindedHop) -> crate::c_types::PublicKey { + let mut inner_val = &mut this_ptr.get_native_mut_ref().blinded_node_id; + crate::c_types::PublicKey::from_rust(&inner_val) +} +/// The blinded node id of this hop in a [`BlindedPath`]. +#[no_mangle] +pub extern "C" fn BlindedHop_set_blinded_node_id(this_ptr: &mut BlindedHop, mut val: crate::c_types::PublicKey) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.blinded_node_id = val.into_rust(); +} +/// The encrypted payload intended for this hop in a [`BlindedPath`]. +/// +/// Returns a copy of the field. +#[no_mangle] +pub extern "C" fn BlindedHop_get_encrypted_payload(this_ptr: &BlindedHop) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = this_ptr.get_native_mut_ref().encrypted_payload.clone(); + let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { item }); }; + local_inner_val.into() +} +/// The encrypted payload intended for this hop in a [`BlindedPath`]. +#[no_mangle] +pub extern "C" fn BlindedHop_set_encrypted_payload(this_ptr: &mut BlindedHop, mut val: crate::c_types::derived::CVec_u8Z) { + let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.encrypted_payload = local_val; +} +/// Constructs a new BlindedHop given each field +#[must_use] +#[no_mangle] +pub extern "C" fn BlindedHop_new(mut blinded_node_id_arg: crate::c_types::PublicKey, mut encrypted_payload_arg: crate::c_types::derived::CVec_u8Z) -> BlindedHop { + let mut local_encrypted_payload_arg = Vec::new(); for mut item in encrypted_payload_arg.into_rust().drain(..) { local_encrypted_payload_arg.push( { item }); }; + BlindedHop { inner: ObjOps::heap_alloc(nativeBlindedHop { + blinded_node_id: blinded_node_id_arg.into_rust(), + encrypted_payload: local_encrypted_payload_arg, + }), is_owned: true } +} impl Clone for BlindedHop { fn clone(&self) -> Self { Self { @@ -220,6 +332,15 @@ pub extern "C" fn BlindedPath_new_for_message(mut node_pks: crate::c_types::deri local_ret } +/// Create a one-hop blinded path for a payment. +#[must_use] +#[no_mangle] +pub extern "C" fn BlindedPath_one_hop_for_payment(mut payee_node_id: crate::c_types::PublicKey, mut payee_tlvs: crate::lightning::blinded_path::payment::ReceiveTlvs, entropy_source: &crate::lightning::sign::EntropySource) -> crate::c_types::derived::CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { + let mut ret = lightning::blinded_path::BlindedPath::one_hop_for_payment(payee_node_id.into_rust(), *unsafe { Box::from_raw(payee_tlvs.take_inner()) }, entropy_source, secp256k1::global::SECP256K1); + 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::lightning::offers::invoice::BlindedPayInfo { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + #[no_mangle] /// Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read pub extern "C" fn BlindedPath_write(obj: &crate::lightning::blinded_path::BlindedPath) -> crate::c_types::derived::CVec_u8Z { diff --git a/lightning-c-bindings/src/lightning/blinded_path/payment.rs b/lightning-c-bindings/src/lightning/blinded_path/payment.rs new file mode 100644 index 00000000..87766183 --- /dev/null +++ b/lightning-c-bindings/src/lightning/blinded_path/payment.rs @@ -0,0 +1,650 @@ +// This file is Copyright its original authors, visible in version control +// history and in the source files from which this was generated. +// +// This file is licensed under the license available in the LICENSE or LICENSE.md +// file in the root of this repository or, if no such file exists, the same +// license as that which applies to the original source files from which this +// source was automatically generated. + +//! Data structures and methods for constructing [`BlindedPath`]s to send a payment over. +//! +//! [`BlindedPath`]: crate::blinded_path::BlindedPath + +use alloc::str::FromStr; +use alloc::string::String; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + + +use lightning::blinded_path::payment::ForwardNode as nativeForwardNodeImport; +pub(crate) type nativeForwardNode = nativeForwardNodeImport; + +/// An intermediate node, its outbound channel, and relay parameters. +#[must_use] +#[repr(C)] +pub struct ForwardNode { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, inner must be non-null, however in places where + /// the Rust equivalent takes an Option, it may be set to null to indicate None. + pub inner: *mut nativeForwardNode, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for ForwardNode { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeForwardNode>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ForwardNode, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ForwardNode_free(this_obj: ForwardNode) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ForwardNode_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeForwardNode) }; +} +#[allow(unused)] +impl ForwardNode { + pub(crate) fn get_native_ref(&self) -> &'static nativeForwardNode { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeForwardNode { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeForwardNode { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also +/// used for [`BlindedPayInfo`] construction. +#[no_mangle] +pub extern "C" fn ForwardNode_get_tlvs(this_ptr: &ForwardNode) -> crate::lightning::blinded_path::payment::ForwardTlvs { + let mut inner_val = &mut this_ptr.get_native_mut_ref().tlvs; + crate::lightning::blinded_path::payment::ForwardTlvs { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::blinded_path::payment::ForwardTlvs<>) as *mut _) }, is_owned: false } +} +/// The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also +/// used for [`BlindedPayInfo`] construction. +#[no_mangle] +pub extern "C" fn ForwardNode_set_tlvs(this_ptr: &mut ForwardNode, mut val: crate::lightning::blinded_path::payment::ForwardTlvs) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.tlvs = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// This node's pubkey. +#[no_mangle] +pub extern "C" fn ForwardNode_get_node_id(this_ptr: &ForwardNode) -> crate::c_types::PublicKey { + let mut inner_val = &mut this_ptr.get_native_mut_ref().node_id; + crate::c_types::PublicKey::from_rust(&inner_val) +} +/// This node's pubkey. +#[no_mangle] +pub extern "C" fn ForwardNode_set_node_id(this_ptr: &mut ForwardNode, mut val: crate::c_types::PublicKey) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_id = val.into_rust(); +} +/// The maximum value, in msat, that may be accepted by this node. +#[no_mangle] +pub extern "C" fn ForwardNode_get_htlc_maximum_msat(this_ptr: &ForwardNode) -> u64 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_maximum_msat; + *inner_val +} +/// The maximum value, in msat, that may be accepted by this node. +#[no_mangle] +pub extern "C" fn ForwardNode_set_htlc_maximum_msat(this_ptr: &mut ForwardNode, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_maximum_msat = val; +} +/// Constructs a new ForwardNode given each field +#[must_use] +#[no_mangle] +pub extern "C" fn ForwardNode_new(mut tlvs_arg: crate::lightning::blinded_path::payment::ForwardTlvs, mut node_id_arg: crate::c_types::PublicKey, mut htlc_maximum_msat_arg: u64) -> ForwardNode { + ForwardNode { inner: ObjOps::heap_alloc(nativeForwardNode { + tlvs: *unsafe { Box::from_raw(tlvs_arg.take_inner()) }, + node_id: node_id_arg.into_rust(), + htlc_maximum_msat: htlc_maximum_msat_arg, + }), is_owned: true } +} +impl Clone for ForwardNode { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeForwardNode>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ForwardNode_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeForwardNode)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ForwardNode +pub extern "C" fn ForwardNode_clone(orig: &ForwardNode) -> ForwardNode { + orig.clone() +} + +use lightning::blinded_path::payment::ForwardTlvs as nativeForwardTlvsImport; +pub(crate) type nativeForwardTlvs = nativeForwardTlvsImport; + +/// Data to construct a [`BlindedHop`] for forwarding a payment. +#[must_use] +#[repr(C)] +pub struct ForwardTlvs { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, inner must be non-null, however in places where + /// the Rust equivalent takes an Option, it may be set to null to indicate None. + pub inner: *mut nativeForwardTlvs, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for ForwardTlvs { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeForwardTlvs>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ForwardTlvs, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ForwardTlvs_free(this_obj: ForwardTlvs) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ForwardTlvs_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeForwardTlvs) }; +} +#[allow(unused)] +impl ForwardTlvs { + pub(crate) fn get_native_ref(&self) -> &'static nativeForwardTlvs { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeForwardTlvs { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeForwardTlvs { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// The short channel id this payment should be forwarded out over. +#[no_mangle] +pub extern "C" fn ForwardTlvs_get_short_channel_id(this_ptr: &ForwardTlvs) -> u64 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id; + *inner_val +} +/// The short channel id this payment should be forwarded out over. +#[no_mangle] +pub extern "C" fn ForwardTlvs_set_short_channel_id(this_ptr: &mut ForwardTlvs, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.short_channel_id = val; +} +/// Payment parameters for relaying over [`Self::short_channel_id`]. +#[no_mangle] +pub extern "C" fn ForwardTlvs_get_payment_relay(this_ptr: &ForwardTlvs) -> crate::lightning::blinded_path::payment::PaymentRelay { + let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_relay; + crate::lightning::blinded_path::payment::PaymentRelay { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::blinded_path::payment::PaymentRelay<>) as *mut _) }, is_owned: false } +} +/// Payment parameters for relaying over [`Self::short_channel_id`]. +#[no_mangle] +pub extern "C" fn ForwardTlvs_set_payment_relay(this_ptr: &mut ForwardTlvs, mut val: crate::lightning::blinded_path::payment::PaymentRelay) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_relay = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// Payment constraints for relaying over [`Self::short_channel_id`]. +#[no_mangle] +pub extern "C" fn ForwardTlvs_get_payment_constraints(this_ptr: &ForwardTlvs) -> crate::lightning::blinded_path::payment::PaymentConstraints { + let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_constraints; + crate::lightning::blinded_path::payment::PaymentConstraints { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::blinded_path::payment::PaymentConstraints<>) as *mut _) }, is_owned: false } +} +/// Payment constraints for relaying over [`Self::short_channel_id`]. +#[no_mangle] +pub extern "C" fn ForwardTlvs_set_payment_constraints(this_ptr: &mut ForwardTlvs, mut val: crate::lightning::blinded_path::payment::PaymentConstraints) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_constraints = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// Supported and required features when relaying a payment onion containing this object's +/// corresponding [`BlindedHop::encrypted_payload`]. +/// +/// [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload +#[no_mangle] +pub extern "C" fn ForwardTlvs_get_features(this_ptr: &ForwardTlvs) -> crate::lightning::ln::features::BlindedHopFeatures { + let mut inner_val = &mut this_ptr.get_native_mut_ref().features; + crate::lightning::ln::features::BlindedHopFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::BlindedHopFeatures<>) as *mut _) }, is_owned: false } +} +/// Supported and required features when relaying a payment onion containing this object's +/// corresponding [`BlindedHop::encrypted_payload`]. +/// +/// [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload +#[no_mangle] +pub extern "C" fn ForwardTlvs_set_features(this_ptr: &mut ForwardTlvs, mut val: crate::lightning::ln::features::BlindedHopFeatures) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.features = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// Constructs a new ForwardTlvs given each field +#[must_use] +#[no_mangle] +pub extern "C" fn ForwardTlvs_new(mut short_channel_id_arg: u64, mut payment_relay_arg: crate::lightning::blinded_path::payment::PaymentRelay, mut payment_constraints_arg: crate::lightning::blinded_path::payment::PaymentConstraints, mut features_arg: crate::lightning::ln::features::BlindedHopFeatures) -> ForwardTlvs { + ForwardTlvs { inner: ObjOps::heap_alloc(nativeForwardTlvs { + short_channel_id: short_channel_id_arg, + payment_relay: *unsafe { Box::from_raw(payment_relay_arg.take_inner()) }, + payment_constraints: *unsafe { Box::from_raw(payment_constraints_arg.take_inner()) }, + features: *unsafe { Box::from_raw(features_arg.take_inner()) }, + }), is_owned: true } +} +impl Clone for ForwardTlvs { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeForwardTlvs>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ForwardTlvs_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeForwardTlvs)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ForwardTlvs +pub extern "C" fn ForwardTlvs_clone(orig: &ForwardTlvs) -> ForwardTlvs { + orig.clone() +} + +use lightning::blinded_path::payment::ReceiveTlvs as nativeReceiveTlvsImport; +pub(crate) type nativeReceiveTlvs = nativeReceiveTlvsImport; + +/// Data to construct a [`BlindedHop`] for receiving a payment. This payload is custom to LDK and +/// may not be valid if received by another lightning implementation. +#[must_use] +#[repr(C)] +pub struct ReceiveTlvs { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, inner must be non-null, however in places where + /// the Rust equivalent takes an Option, it may be set to null to indicate None. + pub inner: *mut nativeReceiveTlvs, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for ReceiveTlvs { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeReceiveTlvs>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ReceiveTlvs, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ReceiveTlvs_free(this_obj: ReceiveTlvs) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ReceiveTlvs_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeReceiveTlvs) }; +} +#[allow(unused)] +impl ReceiveTlvs { + pub(crate) fn get_native_ref(&self) -> &'static nativeReceiveTlvs { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeReceiveTlvs { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeReceiveTlvs { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. +#[no_mangle] +pub extern "C" fn ReceiveTlvs_get_payment_secret(this_ptr: &ReceiveTlvs) -> *const [u8; 32] { + let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_secret; + &inner_val.0 +} +/// Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. +#[no_mangle] +pub extern "C" fn ReceiveTlvs_set_payment_secret(this_ptr: &mut ReceiveTlvs, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_secret = ::lightning::ln::PaymentSecret(val.data); +} +/// Constraints for the receiver of this payment. +#[no_mangle] +pub extern "C" fn ReceiveTlvs_get_payment_constraints(this_ptr: &ReceiveTlvs) -> crate::lightning::blinded_path::payment::PaymentConstraints { + let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_constraints; + crate::lightning::blinded_path::payment::PaymentConstraints { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::blinded_path::payment::PaymentConstraints<>) as *mut _) }, is_owned: false } +} +/// Constraints for the receiver of this payment. +#[no_mangle] +pub extern "C" fn ReceiveTlvs_set_payment_constraints(this_ptr: &mut ReceiveTlvs, mut val: crate::lightning::blinded_path::payment::PaymentConstraints) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_constraints = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// Constructs a new ReceiveTlvs given each field +#[must_use] +#[no_mangle] +pub extern "C" fn ReceiveTlvs_new(mut payment_secret_arg: crate::c_types::ThirtyTwoBytes, mut payment_constraints_arg: crate::lightning::blinded_path::payment::PaymentConstraints) -> ReceiveTlvs { + ReceiveTlvs { inner: ObjOps::heap_alloc(nativeReceiveTlvs { + payment_secret: ::lightning::ln::PaymentSecret(payment_secret_arg.data), + payment_constraints: *unsafe { Box::from_raw(payment_constraints_arg.take_inner()) }, + }), is_owned: true } +} +impl Clone for ReceiveTlvs { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeReceiveTlvs>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ReceiveTlvs_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReceiveTlvs)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ReceiveTlvs +pub extern "C" fn ReceiveTlvs_clone(orig: &ReceiveTlvs) -> ReceiveTlvs { + orig.clone() +} + +use lightning::blinded_path::payment::PaymentRelay as nativePaymentRelayImport; +pub(crate) type nativePaymentRelay = nativePaymentRelayImport; + +/// Parameters for relaying over a given [`BlindedHop`]. +/// +/// [`BlindedHop`]: crate::blinded_path::BlindedHop +#[must_use] +#[repr(C)] +pub struct PaymentRelay { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, inner must be non-null, however in places where + /// the Rust equivalent takes an Option, it may be set to null to indicate None. + pub inner: *mut nativePaymentRelay, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for PaymentRelay { + fn drop(&mut self) { + if self.is_owned && !<*mut nativePaymentRelay>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the PaymentRelay, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn PaymentRelay_free(this_obj: PaymentRelay) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn PaymentRelay_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePaymentRelay) }; +} +#[allow(unused)] +impl PaymentRelay { + pub(crate) fn get_native_ref(&self) -> &'static nativePaymentRelay { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativePaymentRelay { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativePaymentRelay { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`]. +#[no_mangle] +pub extern "C" fn PaymentRelay_get_cltv_expiry_delta(this_ptr: &PaymentRelay) -> u16 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta; + *inner_val +} +/// Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`]. +#[no_mangle] +pub extern "C" fn PaymentRelay_set_cltv_expiry_delta(this_ptr: &mut PaymentRelay, mut val: u16) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry_delta = val; +} +/// Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over +/// this [`BlindedHop`], (i.e., 10,000 is 1%). +#[no_mangle] +pub extern "C" fn PaymentRelay_get_fee_proportional_millionths(this_ptr: &PaymentRelay) -> u32 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_proportional_millionths; + *inner_val +} +/// Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over +/// this [`BlindedHop`], (i.e., 10,000 is 1%). +#[no_mangle] +pub extern "C" fn PaymentRelay_set_fee_proportional_millionths(this_ptr: &mut PaymentRelay, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_proportional_millionths = val; +} +/// Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. +#[no_mangle] +pub extern "C" fn PaymentRelay_get_fee_base_msat(this_ptr: &PaymentRelay) -> u32 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_base_msat; + *inner_val +} +/// Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. +#[no_mangle] +pub extern "C" fn PaymentRelay_set_fee_base_msat(this_ptr: &mut PaymentRelay, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_base_msat = val; +} +/// Constructs a new PaymentRelay given each field +#[must_use] +#[no_mangle] +pub extern "C" fn PaymentRelay_new(mut cltv_expiry_delta_arg: u16, mut fee_proportional_millionths_arg: u32, mut fee_base_msat_arg: u32) -> PaymentRelay { + PaymentRelay { inner: ObjOps::heap_alloc(nativePaymentRelay { + cltv_expiry_delta: cltv_expiry_delta_arg, + fee_proportional_millionths: fee_proportional_millionths_arg, + fee_base_msat: fee_base_msat_arg, + }), is_owned: true } +} +impl Clone for PaymentRelay { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativePaymentRelay>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn PaymentRelay_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePaymentRelay)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the PaymentRelay +pub extern "C" fn PaymentRelay_clone(orig: &PaymentRelay) -> PaymentRelay { + orig.clone() +} + +use lightning::blinded_path::payment::PaymentConstraints as nativePaymentConstraintsImport; +pub(crate) type nativePaymentConstraints = nativePaymentConstraintsImport; + +/// Constraints for relaying over a given [`BlindedHop`]. +/// +/// [`BlindedHop`]: crate::blinded_path::BlindedHop +#[must_use] +#[repr(C)] +pub struct PaymentConstraints { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, inner must be non-null, however in places where + /// the Rust equivalent takes an Option, it may be set to null to indicate None. + pub inner: *mut nativePaymentConstraints, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for PaymentConstraints { + fn drop(&mut self) { + if self.is_owned && !<*mut nativePaymentConstraints>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the PaymentConstraints, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn PaymentConstraints_free(this_obj: PaymentConstraints) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn PaymentConstraints_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePaymentConstraints) }; +} +#[allow(unused)] +impl PaymentConstraints { + pub(crate) fn get_native_ref(&self) -> &'static nativePaymentConstraints { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativePaymentConstraints { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativePaymentConstraints { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// The maximum total CLTV delta that is acceptable when relaying a payment over this +/// [`BlindedHop`]. +#[no_mangle] +pub extern "C" fn PaymentConstraints_get_max_cltv_expiry(this_ptr: &PaymentConstraints) -> u32 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().max_cltv_expiry; + *inner_val +} +/// The maximum total CLTV delta that is acceptable when relaying a payment over this +/// [`BlindedHop`]. +#[no_mangle] +pub extern "C" fn PaymentConstraints_set_max_cltv_expiry(this_ptr: &mut PaymentConstraints, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_cltv_expiry = val; +} +/// The minimum value, in msat, that may be accepted by the node corresponding to this +/// [`BlindedHop`]. +#[no_mangle] +pub extern "C" fn PaymentConstraints_get_htlc_minimum_msat(this_ptr: &PaymentConstraints) -> u64 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_minimum_msat; + *inner_val +} +/// The minimum value, in msat, that may be accepted by the node corresponding to this +/// [`BlindedHop`]. +#[no_mangle] +pub extern "C" fn PaymentConstraints_set_htlc_minimum_msat(this_ptr: &mut PaymentConstraints, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_minimum_msat = val; +} +/// Constructs a new PaymentConstraints given each field +#[must_use] +#[no_mangle] +pub extern "C" fn PaymentConstraints_new(mut max_cltv_expiry_arg: u32, mut htlc_minimum_msat_arg: u64) -> PaymentConstraints { + PaymentConstraints { inner: ObjOps::heap_alloc(nativePaymentConstraints { + max_cltv_expiry: max_cltv_expiry_arg, + htlc_minimum_msat: htlc_minimum_msat_arg, + }), is_owned: true } +} +impl Clone for PaymentConstraints { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativePaymentConstraints>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn PaymentConstraints_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePaymentConstraints)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the PaymentConstraints +pub extern "C" fn PaymentConstraints_clone(orig: &PaymentConstraints) -> PaymentConstraints { + orig.clone() +} +#[no_mangle] +/// Serialize the ForwardTlvs object into a byte array which can be read by ForwardTlvs_read +pub extern "C" fn ForwardTlvs_write(obj: &crate::lightning::blinded_path::payment::ForwardTlvs) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn ForwardTlvs_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeForwardTlvs) }) +} +#[no_mangle] +/// Serialize the ReceiveTlvs object into a byte array which can be read by ReceiveTlvs_read +pub extern "C" fn ReceiveTlvs_write(obj: &crate::lightning::blinded_path::payment::ReceiveTlvs) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn ReceiveTlvs_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeReceiveTlvs) }) +} +#[no_mangle] +/// Read a ReceiveTlvs from a byte array, created by ReceiveTlvs_write +pub extern "C" fn ReceiveTlvs_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReceiveTlvsDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::blinded_path::payment::ReceiveTlvs { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} +#[no_mangle] +/// Serialize the PaymentRelay object into a byte array which can be read by PaymentRelay_read +pub extern "C" fn PaymentRelay_write(obj: &crate::lightning::blinded_path::payment::PaymentRelay) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn PaymentRelay_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePaymentRelay) }) +} +#[no_mangle] +/// Read a PaymentRelay from a byte array, created by PaymentRelay_write +pub extern "C" fn PaymentRelay_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PaymentRelayDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::blinded_path::payment::PaymentRelay { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} +#[no_mangle] +/// Serialize the PaymentConstraints object into a byte array which can be read by PaymentConstraints_read +pub extern "C" fn PaymentConstraints_write(obj: &crate::lightning::blinded_path::payment::PaymentConstraints) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn PaymentConstraints_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePaymentConstraints) }) +} +#[no_mangle] +/// Read a PaymentConstraints from a byte array, created by PaymentConstraints_write +pub extern "C" fn PaymentConstraints_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PaymentConstraintsDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::blinded_path::payment::PaymentConstraints { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} diff --git a/lightning-c-bindings/src/lightning/chain/chaininterface.rs b/lightning-c-bindings/src/lightning/chain/chaininterface.rs index e27203a8..0dc8d6c5 100644 --- a/lightning-c-bindings/src/lightning/chain/chaininterface.rs +++ b/lightning-c-bindings/src/lightning/chain/chaininterface.rs @@ -13,6 +13,7 @@ //! disconnections, transaction broadcasting, and feerate information requests. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -46,8 +47,7 @@ pub struct BroadcasterInterface { } unsafe impl Send for BroadcasterInterface {} unsafe impl Sync for BroadcasterInterface {} -#[no_mangle] -pub(crate) extern "C" fn BroadcasterInterface_clone_fields(orig: &BroadcasterInterface) -> BroadcasterInterface { +pub(crate) fn BroadcasterInterface_clone_fields(orig: &BroadcasterInterface) -> BroadcasterInterface { BroadcasterInterface { this_arg: orig.this_arg, broadcast_transactions: Clone::clone(&orig.broadcast_transactions), @@ -71,6 +71,11 @@ impl core::ops::Deref for BroadcasterInterface { self } } +impl core::ops::DerefMut for BroadcasterInterface { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn BroadcasterInterface_free(this_ptr: BroadcasterInterface) { } @@ -210,8 +215,7 @@ pub struct FeeEstimator { } unsafe impl Send for FeeEstimator {} unsafe impl Sync for FeeEstimator {} -#[no_mangle] -pub(crate) extern "C" fn FeeEstimator_clone_fields(orig: &FeeEstimator) -> FeeEstimator { +pub(crate) fn FeeEstimator_clone_fields(orig: &FeeEstimator) -> FeeEstimator { FeeEstimator { this_arg: orig.this_arg, get_est_sat_per_1000_weight: Clone::clone(&orig.get_est_sat_per_1000_weight), @@ -235,6 +239,11 @@ impl core::ops::Deref for FeeEstimator { self } } +impl core::ops::DerefMut for FeeEstimator { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn FeeEstimator_free(this_ptr: FeeEstimator) { } diff --git a/lightning-c-bindings/src/lightning/chain/chainmonitor.rs b/lightning-c-bindings/src/lightning/chain/chainmonitor.rs index 4bdccab4..a70ceb01 100644 --- a/lightning-c-bindings/src/lightning/chain/chainmonitor.rs +++ b/lightning-c-bindings/src/lightning/chain/chainmonitor.rs @@ -23,6 +23,7 @@ //! servicing [`ChannelMonitor`] updates from the client. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -30,6 +31,18 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; +mod update_origin { + +use alloc::str::FromStr; +use alloc::string::String; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +} use lightning::chain::chainmonitor::MonitorUpdateId as nativeMonitorUpdateIdImport; pub(crate) type nativeMonitorUpdateId = nativeMonitorUpdateIdImport; @@ -122,23 +135,58 @@ pub extern "C" fn MonitorUpdateId_eq(a: &MonitorUpdateId, b: &MonitorUpdateId) - /// `Persist` defines behavior for persisting channel monitors: this could mean /// writing once to disk, and/or uploading to one or more backup services. /// -/// Each method can return three possible values: -/// * If persistence (including any relevant `fsync()` calls) happens immediately, the -/// implementation should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal -/// channel operation should continue. -/// * If persistence happens asynchronously, implementations should first ensure the -/// [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return -/// [`ChannelMonitorUpdateStatus::InProgress`] while the update continues in the background. -/// Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be called with -/// the corresponding [`MonitorUpdateId`]. +/// Persistence can happen in one of two ways - synchronously completing before the trait method +/// calls return or asynchronously in the background. +/// +/// # For those implementing synchronous persistence +/// +/// * If persistence completes fully (including any relevant `fsync()` calls), the implementation +/// should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal channel operation +/// should continue. +/// +/// * If persistence fails for some reason, implementations should consider returning +/// [`ChannelMonitorUpdateStatus::InProgress`] and retry all pending persistence operations in +/// the background with [`ChainMonitor::list_pending_monitor_updates`] and +/// [`ChainMonitor::get_monitor`]. +/// +/// Once a full [`ChannelMonitor`] has been persisted, all pending updates for that channel can +/// be marked as complete via [`ChainMonitor::channel_monitor_updated`]. /// -/// Note that unlike the direct [`chain::Watch`] interface, -/// [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs. +/// If at some point no further progress can be made towards persisting the pending updates, the +/// node should simply shut down. /// -/// * If persistence fails for some reason, implementations should return -/// [`ChannelMonitorUpdateStatus::PermanentFailure`], in which case the channel will likely be -/// closed without broadcasting the latest state. See -/// [`ChannelMonitorUpdateStatus::PermanentFailure`] for more details. +/// * If the persistence has failed and cannot be retried further (e.g. because of an outage), +/// [`ChannelMonitorUpdateStatus::UnrecoverableError`] can be used, though this will result in +/// an immediate panic and future operations in LDK generally failing. +/// +/// # For those implementing asynchronous persistence +/// +/// All calls should generally spawn a background task and immediately return +/// [`ChannelMonitorUpdateStatus::InProgress`]. Once the update completes, +/// [`ChainMonitor::channel_monitor_updated`] should be called with the corresponding +/// [`MonitorUpdateId`]. +/// +/// Note that unlike the direct [`chain::Watch`] interface, +/// [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs. +/// +/// If at some point no further progress can be made towards persisting a pending update, the node +/// should simply shut down. Until then, the background task should either loop indefinitely, or +/// persistence should be regularly retried with [`ChainMonitor::list_pending_monitor_updates`] +/// and [`ChainMonitor::get_monitor`] (note that if a full monitor is persisted all pending +/// monitor updates may be marked completed). +/// +/// # Using remote watchtowers +/// +/// Watchtowers may be updated as a part of an implementation of this trait, utilizing the async +/// update process described above while the watchtower is being updated. The following methods are +/// provided for bulding transactions for a watchtower: +/// [`ChannelMonitor::initial_counterparty_commitment_tx`], +/// [`ChannelMonitor::counterparty_commitment_txs_from_update`], +/// [`ChannelMonitor::sign_to_local_justice_tx`], [`TrustedCommitmentTransaction::revokeable_output_index`], +/// [`TrustedCommitmentTransaction::build_to_local_justice_tx`]. +/// +/// [`TrustedCommitmentTransaction::revokeable_output_index`]: crate::ln::chan_utils::TrustedCommitmentTransaction::revokeable_output_index +/// [`TrustedCommitmentTransaction::build_to_local_justice_tx`]: crate::ln::chan_utils::TrustedCommitmentTransaction::build_to_local_justice_tx #[repr(C)] pub struct Persist { /// An opaque pointer which is passed to your function implementations as an argument. @@ -167,8 +215,8 @@ pub struct Persist { /// updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more /// details. /// - /// During blockchain synchronization operations, this may be called with no - /// [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted. + /// During blockchain synchronization operations, and in some rare cases, this may be called with + /// no [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted. /// Note that after the full [`ChannelMonitor`] is persisted any previous /// [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be /// applied to the persisted [`ChannelMonitor`] as they were already applied. @@ -202,8 +250,7 @@ pub struct Persist { } unsafe impl Send for Persist {} unsafe impl Sync for Persist {} -#[no_mangle] -pub(crate) extern "C" fn Persist_clone_fields(orig: &Persist) -> Persist { +pub(crate) fn Persist_clone_fields(orig: &Persist) -> Persist { Persist { this_arg: orig.this_arg, persist_new_channel: Clone::clone(&orig.persist_new_channel), @@ -233,6 +280,11 @@ impl core::ops::Deref for Persist { self } } +impl core::ops::DerefMut for Persist { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn Persist_free(this_ptr: Persist) { } @@ -545,9 +597,9 @@ extern "C" fn ChainMonitor_Confirm_best_block_updated(this_arg: *const c_void, h >::best_block_updated(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height) } #[must_use] -extern "C" fn ChainMonitor_Confirm_get_relevant_txids(this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_TxidCOption_BlockHashZZZ { +extern "C" fn ChainMonitor_Confirm_get_relevant_txids(this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ { let mut ret = >::get_relevant_txids(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, ); - 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 = if orig_ret_0_1.is_none() { crate::c_types::derived::COption_BlockHashZ::None } else { crate::c_types::derived::COption_BlockHashZ::Some( { crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.unwrap().into_inner() } }) }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1).into(); local_ret_0 }); }; + 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 = if orig_ret_0_1.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.unwrap().into_inner() } }) }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1).into(); local_ret_0 }); }; local_ret.into() } @@ -575,9 +627,10 @@ pub extern "C" fn ChainMonitor_as_Watch(this_arg: &ChainMonitor) -> crate::light } #[must_use] -extern "C" fn ChainMonitor_Watch_watch_channel(this_arg: *const c_void, mut funding_txo: crate::lightning::chain::transaction::OutPoint, mut monitor: crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::ChannelMonitorUpdateStatus { +extern "C" fn ChainMonitor_Watch_watch_channel(this_arg: *const c_void, mut funding_txo: crate::lightning::chain::transaction::OutPoint, mut monitor: crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_ChannelMonitorUpdateStatusNoneZ { let mut ret = >::watch_channel(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, *unsafe { Box::from_raw(funding_txo.take_inner()) }, *unsafe { Box::from_raw(monitor.take_inner()) }); - crate::lightning::chain::ChannelMonitorUpdateStatus::native_into(ret) + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::ChannelMonitorUpdateStatus::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret } #[must_use] extern "C" fn ChainMonitor_Watch_update_channel(this_arg: *const c_void, mut funding_txo: crate::lightning::chain::transaction::OutPoint, update: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::lightning::chain::ChannelMonitorUpdateStatus { diff --git a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs index 276fcda7..c15e5bb5 100644 --- a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs +++ b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs @@ -20,6 +20,7 @@ //! ChannelMonitors to get out of the HSM and onto monitoring devices. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -187,7 +188,7 @@ pub enum MonitorEvent { HTLCEvent( crate::lightning::chain::channelmonitor::HTLCUpdate), /// A monitor event that the Channel's commitment transaction was confirmed. - CommitmentTxConfirmed( + HolderForceClosed( crate::lightning::chain::transaction::OutPoint), /// Indicates a [`ChannelMonitor`] update has completed. See /// [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used. @@ -203,12 +204,6 @@ pub enum MonitorEvent { /// same [`ChannelMonitor`] have been applied and persisted. monitor_update_id: u64, }, - /// Indicates a [`ChannelMonitor`] update has failed. See - /// [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used. - /// - /// [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure - UpdateFailed( - crate::lightning::chain::transaction::OutPoint), } use lightning::chain::channelmonitor::MonitorEvent as MonitorEventImport; pub(crate) type nativeMonitorEvent = MonitorEventImport; @@ -223,9 +218,9 @@ impl MonitorEvent { *unsafe { Box::from_raw(a_nonref.take_inner()) }, ) }, - MonitorEvent::CommitmentTxConfirmed (ref a, ) => { + MonitorEvent::HolderForceClosed (ref a, ) => { let mut a_nonref = Clone::clone(a); - nativeMonitorEvent::CommitmentTxConfirmed ( + nativeMonitorEvent::HolderForceClosed ( *unsafe { Box::from_raw(a_nonref.take_inner()) }, ) }, @@ -237,12 +232,6 @@ impl MonitorEvent { monitor_update_id: monitor_update_id_nonref, } }, - MonitorEvent::UpdateFailed (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeMonitorEvent::UpdateFailed ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, } } #[allow(unused)] @@ -253,8 +242,8 @@ impl MonitorEvent { *unsafe { Box::from_raw(a.take_inner()) }, ) }, - MonitorEvent::CommitmentTxConfirmed (mut a, ) => { - nativeMonitorEvent::CommitmentTxConfirmed ( + MonitorEvent::HolderForceClosed (mut a, ) => { + nativeMonitorEvent::HolderForceClosed ( *unsafe { Box::from_raw(a.take_inner()) }, ) }, @@ -264,11 +253,6 @@ impl MonitorEvent { monitor_update_id: monitor_update_id, } }, - MonitorEvent::UpdateFailed (mut a, ) => { - nativeMonitorEvent::UpdateFailed ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, } } #[allow(unused)] @@ -280,9 +264,9 @@ impl MonitorEvent { crate::lightning::chain::channelmonitor::HTLCUpdate { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, ) }, - nativeMonitorEvent::CommitmentTxConfirmed (ref a, ) => { + nativeMonitorEvent::HolderForceClosed (ref a, ) => { let mut a_nonref = Clone::clone(a); - MonitorEvent::CommitmentTxConfirmed ( + MonitorEvent::HolderForceClosed ( crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, ) }, @@ -294,12 +278,6 @@ impl MonitorEvent { monitor_update_id: monitor_update_id_nonref, } }, - nativeMonitorEvent::UpdateFailed (ref a, ) => { - let mut a_nonref = Clone::clone(a); - MonitorEvent::UpdateFailed ( - crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, } } #[allow(unused)] @@ -310,8 +288,8 @@ impl MonitorEvent { crate::lightning::chain::channelmonitor::HTLCUpdate { inner: ObjOps::heap_alloc(a), is_owned: true }, ) }, - nativeMonitorEvent::CommitmentTxConfirmed (mut a, ) => { - MonitorEvent::CommitmentTxConfirmed ( + nativeMonitorEvent::HolderForceClosed (mut a, ) => { + MonitorEvent::HolderForceClosed ( crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a), is_owned: true }, ) }, @@ -321,11 +299,6 @@ impl MonitorEvent { monitor_update_id: monitor_update_id, } }, - nativeMonitorEvent::UpdateFailed (mut a, ) => { - MonitorEvent::UpdateFailed ( - crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, } } } @@ -343,9 +316,9 @@ pub extern "C" fn MonitorEvent_htlcevent(a: crate::lightning::chain::channelmoni MonitorEvent::HTLCEvent(a, ) } #[no_mangle] -/// Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent -pub extern "C" fn MonitorEvent_commitment_tx_confirmed(a: crate::lightning::chain::transaction::OutPoint) -> MonitorEvent { - MonitorEvent::CommitmentTxConfirmed(a, ) +/// Utility method to constructs a new HolderForceClosed-variant MonitorEvent +pub extern "C" fn MonitorEvent_holder_force_closed(a: crate::lightning::chain::transaction::OutPoint) -> MonitorEvent { + MonitorEvent::HolderForceClosed(a, ) } #[no_mangle] /// Utility method to constructs a new Completed-variant MonitorEvent @@ -355,11 +328,6 @@ pub extern "C" fn MonitorEvent_completed(funding_txo: crate::lightning::chain::t monitor_update_id, } } -#[no_mangle] -/// Utility method to constructs a new UpdateFailed-variant MonitorEvent -pub extern "C" fn MonitorEvent_update_failed(a: crate::lightning::chain::transaction::OutPoint) -> MonitorEvent { - MonitorEvent::UpdateFailed(a, ) -} /// Checks if two MonitorEvents contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. #[no_mangle] @@ -499,14 +467,14 @@ pub enum Balance { ClaimableOnChannelClose { /// The amount available to claim, in satoshis, excluding the on-chain fees which will be /// required to do so. - claimable_amount_satoshis: u64, + amount_satoshis: u64, }, /// The channel has been closed, and the given balance is ours but awaiting confirmations until /// we consider it spendable. ClaimableAwaitingConfirmations { /// The amount available to claim, in satoshis, possibly excluding the on-chain fees which /// were spent in broadcasting the transaction. - claimable_amount_satoshis: u64, + amount_satoshis: u64, /// The height at which an [`Event::SpendableOutputs`] event will be generated for this /// amount. confirmation_height: u32, @@ -521,7 +489,7 @@ pub enum Balance { ContentiousClaimable { /// The amount available to claim, in satoshis, excluding the on-chain fees which will be /// required to do so. - claimable_amount_satoshis: u64, + amount_satoshis: u64, /// The height at which the counterparty may be able to claim the balance if we have not /// done so. timeout_height: u32, @@ -536,7 +504,7 @@ pub enum Balance { MaybeTimeoutClaimableHTLC { /// The amount potentially available to claim, in satoshis, excluding the on-chain fees /// which will be required to do so. - claimable_amount_satoshis: u64, + amount_satoshis: u64, /// The height at which we will be able to claim the balance if our counterparty has not /// done so. claimable_height: u32, @@ -549,7 +517,7 @@ pub enum Balance { MaybePreimageClaimableHTLC { /// The amount potentially available to claim, in satoshis, excluding the on-chain fees /// which will be required to do so. - claimable_amount_satoshis: u64, + amount_satoshis: u64, /// The height at which our counterparty will be able to claim the balance if we have not /// yet received the preimage and claimed it ourselves. expiry_height: u32, @@ -566,7 +534,7 @@ pub enum Balance { /// /// Note that for outputs from HTLC balances this may be excluding some on-chain fees that /// were already spent. - claimable_amount_satoshis: u64, + amount_satoshis: u64, }, } use lightning::chain::channelmonitor::Balance as BalanceImport; @@ -576,56 +544,56 @@ impl Balance { #[allow(unused)] pub(crate) fn to_native(&self) -> nativeBalance { match self { - Balance::ClaimableOnChannelClose {ref claimable_amount_satoshis, } => { - let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + Balance::ClaimableOnChannelClose {ref amount_satoshis, } => { + let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); nativeBalance::ClaimableOnChannelClose { - claimable_amount_satoshis: claimable_amount_satoshis_nonref, + amount_satoshis: amount_satoshis_nonref, } }, - Balance::ClaimableAwaitingConfirmations {ref claimable_amount_satoshis, ref confirmation_height, } => { - let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + Balance::ClaimableAwaitingConfirmations {ref amount_satoshis, ref confirmation_height, } => { + let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); let mut confirmation_height_nonref = Clone::clone(confirmation_height); nativeBalance::ClaimableAwaitingConfirmations { - claimable_amount_satoshis: claimable_amount_satoshis_nonref, + amount_satoshis: amount_satoshis_nonref, confirmation_height: confirmation_height_nonref, } }, - Balance::ContentiousClaimable {ref claimable_amount_satoshis, ref timeout_height, ref payment_hash, ref payment_preimage, } => { - let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + Balance::ContentiousClaimable {ref amount_satoshis, ref timeout_height, ref payment_hash, ref payment_preimage, } => { + let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); let mut timeout_height_nonref = Clone::clone(timeout_height); let mut payment_hash_nonref = Clone::clone(payment_hash); let mut payment_preimage_nonref = Clone::clone(payment_preimage); nativeBalance::ContentiousClaimable { - claimable_amount_satoshis: claimable_amount_satoshis_nonref, + amount_satoshis: amount_satoshis_nonref, timeout_height: timeout_height_nonref, payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data), payment_preimage: ::lightning::ln::PaymentPreimage(payment_preimage_nonref.data), } }, - Balance::MaybeTimeoutClaimableHTLC {ref claimable_amount_satoshis, ref claimable_height, ref payment_hash, } => { - let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + Balance::MaybeTimeoutClaimableHTLC {ref amount_satoshis, ref claimable_height, ref payment_hash, } => { + let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); let mut claimable_height_nonref = Clone::clone(claimable_height); let mut payment_hash_nonref = Clone::clone(payment_hash); nativeBalance::MaybeTimeoutClaimableHTLC { - claimable_amount_satoshis: claimable_amount_satoshis_nonref, + amount_satoshis: amount_satoshis_nonref, claimable_height: claimable_height_nonref, payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data), } }, - Balance::MaybePreimageClaimableHTLC {ref claimable_amount_satoshis, ref expiry_height, ref payment_hash, } => { - let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + Balance::MaybePreimageClaimableHTLC {ref amount_satoshis, ref expiry_height, ref payment_hash, } => { + let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); let mut expiry_height_nonref = Clone::clone(expiry_height); let mut payment_hash_nonref = Clone::clone(payment_hash); nativeBalance::MaybePreimageClaimableHTLC { - claimable_amount_satoshis: claimable_amount_satoshis_nonref, + amount_satoshis: amount_satoshis_nonref, expiry_height: expiry_height_nonref, payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data), } }, - Balance::CounterpartyRevokedOutputClaimable {ref claimable_amount_satoshis, } => { - let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + Balance::CounterpartyRevokedOutputClaimable {ref amount_satoshis, } => { + let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); nativeBalance::CounterpartyRevokedOutputClaimable { - claimable_amount_satoshis: claimable_amount_satoshis_nonref, + amount_satoshis: amount_satoshis_nonref, } }, } @@ -633,42 +601,42 @@ impl Balance { #[allow(unused)] pub(crate) fn into_native(self) -> nativeBalance { match self { - Balance::ClaimableOnChannelClose {mut claimable_amount_satoshis, } => { + Balance::ClaimableOnChannelClose {mut amount_satoshis, } => { nativeBalance::ClaimableOnChannelClose { - claimable_amount_satoshis: claimable_amount_satoshis, + amount_satoshis: amount_satoshis, } }, - Balance::ClaimableAwaitingConfirmations {mut claimable_amount_satoshis, mut confirmation_height, } => { + Balance::ClaimableAwaitingConfirmations {mut amount_satoshis, mut confirmation_height, } => { nativeBalance::ClaimableAwaitingConfirmations { - claimable_amount_satoshis: claimable_amount_satoshis, + amount_satoshis: amount_satoshis, confirmation_height: confirmation_height, } }, - Balance::ContentiousClaimable {mut claimable_amount_satoshis, mut timeout_height, mut payment_hash, mut payment_preimage, } => { + Balance::ContentiousClaimable {mut amount_satoshis, mut timeout_height, mut payment_hash, mut payment_preimage, } => { nativeBalance::ContentiousClaimable { - claimable_amount_satoshis: claimable_amount_satoshis, + amount_satoshis: amount_satoshis, timeout_height: timeout_height, payment_hash: ::lightning::ln::PaymentHash(payment_hash.data), payment_preimage: ::lightning::ln::PaymentPreimage(payment_preimage.data), } }, - Balance::MaybeTimeoutClaimableHTLC {mut claimable_amount_satoshis, mut claimable_height, mut payment_hash, } => { + Balance::MaybeTimeoutClaimableHTLC {mut amount_satoshis, mut claimable_height, mut payment_hash, } => { nativeBalance::MaybeTimeoutClaimableHTLC { - claimable_amount_satoshis: claimable_amount_satoshis, + amount_satoshis: amount_satoshis, claimable_height: claimable_height, payment_hash: ::lightning::ln::PaymentHash(payment_hash.data), } }, - Balance::MaybePreimageClaimableHTLC {mut claimable_amount_satoshis, mut expiry_height, mut payment_hash, } => { + Balance::MaybePreimageClaimableHTLC {mut amount_satoshis, mut expiry_height, mut payment_hash, } => { nativeBalance::MaybePreimageClaimableHTLC { - claimable_amount_satoshis: claimable_amount_satoshis, + amount_satoshis: amount_satoshis, expiry_height: expiry_height, payment_hash: ::lightning::ln::PaymentHash(payment_hash.data), } }, - Balance::CounterpartyRevokedOutputClaimable {mut claimable_amount_satoshis, } => { + Balance::CounterpartyRevokedOutputClaimable {mut amount_satoshis, } => { nativeBalance::CounterpartyRevokedOutputClaimable { - claimable_amount_satoshis: claimable_amount_satoshis, + amount_satoshis: amount_satoshis, } }, } @@ -676,56 +644,56 @@ impl Balance { #[allow(unused)] pub(crate) fn from_native(native: &nativeBalance) -> Self { match native { - nativeBalance::ClaimableOnChannelClose {ref claimable_amount_satoshis, } => { - let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + nativeBalance::ClaimableOnChannelClose {ref amount_satoshis, } => { + let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); Balance::ClaimableOnChannelClose { - claimable_amount_satoshis: claimable_amount_satoshis_nonref, + amount_satoshis: amount_satoshis_nonref, } }, - nativeBalance::ClaimableAwaitingConfirmations {ref claimable_amount_satoshis, ref confirmation_height, } => { - let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + nativeBalance::ClaimableAwaitingConfirmations {ref amount_satoshis, ref confirmation_height, } => { + let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); let mut confirmation_height_nonref = Clone::clone(confirmation_height); Balance::ClaimableAwaitingConfirmations { - claimable_amount_satoshis: claimable_amount_satoshis_nonref, + amount_satoshis: amount_satoshis_nonref, confirmation_height: confirmation_height_nonref, } }, - nativeBalance::ContentiousClaimable {ref claimable_amount_satoshis, ref timeout_height, ref payment_hash, ref payment_preimage, } => { - let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + nativeBalance::ContentiousClaimable {ref amount_satoshis, ref timeout_height, ref payment_hash, ref payment_preimage, } => { + let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); let mut timeout_height_nonref = Clone::clone(timeout_height); let mut payment_hash_nonref = Clone::clone(payment_hash); let mut payment_preimage_nonref = Clone::clone(payment_preimage); Balance::ContentiousClaimable { - claimable_amount_satoshis: claimable_amount_satoshis_nonref, + amount_satoshis: amount_satoshis_nonref, timeout_height: timeout_height_nonref, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, payment_preimage: crate::c_types::ThirtyTwoBytes { data: payment_preimage_nonref.0 }, } }, - nativeBalance::MaybeTimeoutClaimableHTLC {ref claimable_amount_satoshis, ref claimable_height, ref payment_hash, } => { - let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + nativeBalance::MaybeTimeoutClaimableHTLC {ref amount_satoshis, ref claimable_height, ref payment_hash, } => { + let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); let mut claimable_height_nonref = Clone::clone(claimable_height); let mut payment_hash_nonref = Clone::clone(payment_hash); Balance::MaybeTimeoutClaimableHTLC { - claimable_amount_satoshis: claimable_amount_satoshis_nonref, + amount_satoshis: amount_satoshis_nonref, claimable_height: claimable_height_nonref, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, } }, - nativeBalance::MaybePreimageClaimableHTLC {ref claimable_amount_satoshis, ref expiry_height, ref payment_hash, } => { - let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + nativeBalance::MaybePreimageClaimableHTLC {ref amount_satoshis, ref expiry_height, ref payment_hash, } => { + let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); let mut expiry_height_nonref = Clone::clone(expiry_height); let mut payment_hash_nonref = Clone::clone(payment_hash); Balance::MaybePreimageClaimableHTLC { - claimable_amount_satoshis: claimable_amount_satoshis_nonref, + amount_satoshis: amount_satoshis_nonref, expiry_height: expiry_height_nonref, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, } }, - nativeBalance::CounterpartyRevokedOutputClaimable {ref claimable_amount_satoshis, } => { - let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + nativeBalance::CounterpartyRevokedOutputClaimable {ref amount_satoshis, } => { + let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); Balance::CounterpartyRevokedOutputClaimable { - claimable_amount_satoshis: claimable_amount_satoshis_nonref, + amount_satoshis: amount_satoshis_nonref, } }, } @@ -733,42 +701,42 @@ impl Balance { #[allow(unused)] pub(crate) fn native_into(native: nativeBalance) -> Self { match native { - nativeBalance::ClaimableOnChannelClose {mut claimable_amount_satoshis, } => { + nativeBalance::ClaimableOnChannelClose {mut amount_satoshis, } => { Balance::ClaimableOnChannelClose { - claimable_amount_satoshis: claimable_amount_satoshis, + amount_satoshis: amount_satoshis, } }, - nativeBalance::ClaimableAwaitingConfirmations {mut claimable_amount_satoshis, mut confirmation_height, } => { + nativeBalance::ClaimableAwaitingConfirmations {mut amount_satoshis, mut confirmation_height, } => { Balance::ClaimableAwaitingConfirmations { - claimable_amount_satoshis: claimable_amount_satoshis, + amount_satoshis: amount_satoshis, confirmation_height: confirmation_height, } }, - nativeBalance::ContentiousClaimable {mut claimable_amount_satoshis, mut timeout_height, mut payment_hash, mut payment_preimage, } => { + nativeBalance::ContentiousClaimable {mut amount_satoshis, mut timeout_height, mut payment_hash, mut payment_preimage, } => { Balance::ContentiousClaimable { - claimable_amount_satoshis: claimable_amount_satoshis, + amount_satoshis: amount_satoshis, timeout_height: timeout_height, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, payment_preimage: crate::c_types::ThirtyTwoBytes { data: payment_preimage.0 }, } }, - nativeBalance::MaybeTimeoutClaimableHTLC {mut claimable_amount_satoshis, mut claimable_height, mut payment_hash, } => { + nativeBalance::MaybeTimeoutClaimableHTLC {mut amount_satoshis, mut claimable_height, mut payment_hash, } => { Balance::MaybeTimeoutClaimableHTLC { - claimable_amount_satoshis: claimable_amount_satoshis, + amount_satoshis: amount_satoshis, claimable_height: claimable_height, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, } }, - nativeBalance::MaybePreimageClaimableHTLC {mut claimable_amount_satoshis, mut expiry_height, mut payment_hash, } => { + nativeBalance::MaybePreimageClaimableHTLC {mut amount_satoshis, mut expiry_height, mut payment_hash, } => { Balance::MaybePreimageClaimableHTLC { - claimable_amount_satoshis: claimable_amount_satoshis, + amount_satoshis: amount_satoshis, expiry_height: expiry_height, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, } }, - nativeBalance::CounterpartyRevokedOutputClaimable {mut claimable_amount_satoshis, } => { + nativeBalance::CounterpartyRevokedOutputClaimable {mut amount_satoshis, } => { Balance::CounterpartyRevokedOutputClaimable { - claimable_amount_satoshis: claimable_amount_satoshis, + amount_satoshis: amount_satoshis, } }, } @@ -784,24 +752,24 @@ pub extern "C" fn Balance_clone(orig: &Balance) -> Balance { } #[no_mangle] /// Utility method to constructs a new ClaimableOnChannelClose-variant Balance -pub extern "C" fn Balance_claimable_on_channel_close(claimable_amount_satoshis: u64) -> Balance { +pub extern "C" fn Balance_claimable_on_channel_close(amount_satoshis: u64) -> Balance { Balance::ClaimableOnChannelClose { - claimable_amount_satoshis, + amount_satoshis, } } #[no_mangle] /// Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance -pub extern "C" fn Balance_claimable_awaiting_confirmations(claimable_amount_satoshis: u64, confirmation_height: u32) -> Balance { +pub extern "C" fn Balance_claimable_awaiting_confirmations(amount_satoshis: u64, confirmation_height: u32) -> Balance { Balance::ClaimableAwaitingConfirmations { - claimable_amount_satoshis, + amount_satoshis, confirmation_height, } } #[no_mangle] /// Utility method to constructs a new ContentiousClaimable-variant Balance -pub extern "C" fn Balance_contentious_claimable(claimable_amount_satoshis: u64, timeout_height: u32, payment_hash: crate::c_types::ThirtyTwoBytes, payment_preimage: crate::c_types::ThirtyTwoBytes) -> Balance { +pub extern "C" fn Balance_contentious_claimable(amount_satoshis: u64, timeout_height: u32, payment_hash: crate::c_types::ThirtyTwoBytes, payment_preimage: crate::c_types::ThirtyTwoBytes) -> Balance { Balance::ContentiousClaimable { - claimable_amount_satoshis, + amount_satoshis, timeout_height, payment_hash, payment_preimage, @@ -809,27 +777,27 @@ pub extern "C" fn Balance_contentious_claimable(claimable_amount_satoshis: u64, } #[no_mangle] /// Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance -pub extern "C" fn Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis: u64, claimable_height: u32, payment_hash: crate::c_types::ThirtyTwoBytes) -> Balance { +pub extern "C" fn Balance_maybe_timeout_claimable_htlc(amount_satoshis: u64, claimable_height: u32, payment_hash: crate::c_types::ThirtyTwoBytes) -> Balance { Balance::MaybeTimeoutClaimableHTLC { - claimable_amount_satoshis, + amount_satoshis, claimable_height, payment_hash, } } #[no_mangle] /// Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance -pub extern "C" fn Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis: u64, expiry_height: u32, payment_hash: crate::c_types::ThirtyTwoBytes) -> Balance { +pub extern "C" fn Balance_maybe_preimage_claimable_htlc(amount_satoshis: u64, expiry_height: u32, payment_hash: crate::c_types::ThirtyTwoBytes) -> Balance { Balance::MaybePreimageClaimableHTLC { - claimable_amount_satoshis, + amount_satoshis, expiry_height, payment_hash, } } #[no_mangle] /// Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance -pub extern "C" fn Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis: u64) -> Balance { +pub extern "C" fn Balance_counterparty_revoked_output_claimable(amount_satoshis: u64) -> Balance { Balance::CounterpartyRevokedOutputClaimable { - claimable_amount_satoshis, + amount_satoshis, } } /// Checks if two Balances contain equal inner contents. @@ -912,6 +880,25 @@ impl ChannelMonitor { ret } } +impl Clone for ChannelMonitor { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeChannelMonitor>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ChannelMonitor_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelMonitor)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ChannelMonitor +pub extern "C" fn ChannelMonitor_clone(orig: &ChannelMonitor) -> ChannelMonitor { + orig.clone() +} #[no_mangle] /// Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read pub extern "C" fn ChannelMonitor_write(obj: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_u8Z { @@ -927,7 +914,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: &crate::lightning::chain::channelmonitor::ChannelMonitor, updates: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, broadcaster: &crate::lightning::chain::chaininterface::BroadcasterInterface, mut 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 @@ -945,7 +932,7 @@ pub extern "C" fn ChannelMonitor_get_latest_update_id(this_arg: &crate::lightnin /// 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: &crate::lightning::chain::channelmonitor::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_OutPointCVec_u8ZZ { 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 @@ -955,7 +942,7 @@ pub extern "C" fn ChannelMonitor_get_funding_txo(this_arg: &crate::lightning::ch /// 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: &crate::lightning::chain::channelmonitor::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_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { 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() @@ -997,6 +984,81 @@ pub extern "C" fn ChannelMonitor_process_pending_events(this_arg: &crate::lightn unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.process_pending_events(handler) } +/// Gets the counterparty's initial commitment transaction. The returned commitment +/// transaction is unsigned. This is intended to be called during the initial persistence of +/// the monitor (inside an implementation of [`Persist::persist_new_channel`]), to allow for +/// watchtowers in the persistence pipeline to have enough data to form justice transactions. +/// +/// This is similar to [`Self::counterparty_commitment_txs_from_update`], except +/// that for the initial commitment transaction, we don't have a corresponding update. +/// +/// This will only return `Some` for channel monitors that have been created after upgrading +/// to LDK 0.0.117+. +/// +/// [`Persist::persist_new_channel`]: crate::chain::chainmonitor::Persist::persist_new_channel +/// +/// 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 ChannelMonitor_initial_counterparty_commitment_tx(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::ln::chan_utils::CommitmentTransaction { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.initial_counterparty_commitment_tx(); + let mut local_ret = crate::lightning::ln::chan_utils::CommitmentTransaction { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} + +/// Gets all of the counterparty commitment transactions provided by the given update. This +/// may be empty if the update doesn't include any new counterparty commitments. Returned +/// commitment transactions are unsigned. +/// +/// This is provided so that watchtower clients in the persistence pipeline are able to build +/// justice transactions for each counterparty commitment upon each update. It's intended to be +/// used within an implementation of [`Persist::update_persisted_channel`], which is provided +/// with a monitor and an update. Once revoked, signing a justice transaction can be done using +/// [`Self::sign_to_local_justice_tx`]. +/// +/// It is expected that a watchtower client may use this method to retrieve the latest counterparty +/// commitment transaction(s), and then hold the necessary data until a later update in which +/// the monitor has been updated with the corresponding revocation data, at which point the +/// monitor can sign the justice transaction. +/// +/// This will only return a non-empty list for monitor updates that have been created after +/// upgrading to LDK 0.0.117+. Note that no restriction lies on the monitors themselves, which +/// may have been created prior to upgrading. +/// +/// [`Persist::update_persisted_channel`]: crate::chain::chainmonitor::Persist::update_persisted_channel +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelMonitor_counterparty_commitment_txs_from_update(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, update: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CVec_CommitmentTransactionZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.counterparty_commitment_txs_from_update(update.get_native_ref()); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::chan_utils::CommitmentTransaction { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + +/// Wrapper around [`EcdsaChannelSigner::sign_justice_revoked_output`] to make +/// signing the justice transaction easier for implementors of +/// [`chain::chainmonitor::Persist`]. On success this method returns the provided transaction +/// signing the input at `input_idx`. This method will only produce a valid signature for +/// a transaction spending the `to_local` output of a commitment transaction, i.e. this cannot +/// be used for revoked HTLC outputs. +/// +/// `Value` is the value of the output being spent by the input at `input_idx`, committed +/// in the BIP 143 signature. +/// +/// This method will only succeed if this monitor has received the revocation secret for the +/// provided `commitment_number`. If a commitment number is provided that does not correspond +/// to the commitment transaction being revoked, this will return a signed transaction, but +/// the signature will not be valid. +/// +/// [`EcdsaChannelSigner::sign_justice_revoked_output`]: crate::sign::EcdsaChannelSigner::sign_justice_revoked_output +/// [`Persist`]: crate::chain::chainmonitor::Persist +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelMonitor_sign_to_local_justice_tx(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, mut justice_tx: crate::c_types::Transaction, mut input_idx: usize, mut value: u64, mut commitment_number: u64) -> crate::c_types::derived::CResult_TransactionNoneZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_to_local_justice_tx(justice_tx.into_bitcoin(), input_idx, value, commitment_number); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Transaction::from_bitcoin(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + /// Gets the `node_id` of the counterparty for this channel. /// /// Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some` @@ -1011,21 +1073,20 @@ pub extern "C" fn ChannelMonitor_get_counterparty_node_id(this_arg: &crate::ligh local_ret } -/// Used by ChannelManager deserialization to broadcast the latest holder state if its copy of -/// the Channel was out-of-date. +/// Used by [`ChannelManager`] deserialization to broadcast the latest holder state if its copy +/// of the channel state was out-of-date. /// /// You may also use this to broadcast the latest local commitment transaction, either because -/// a monitor update failed with [`ChannelMonitorUpdateStatus::PermanentFailure`] or because we've -/// fallen behind (i.e. we've received proof that our counterparty side knows a revocation -/// secret we gave them that they shouldn't know). +/// a monitor update failed or because we've fallen behind (i.e. we've received proof that our +/// counterparty side knows a revocation secret we gave them that they shouldn't know). /// /// Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty /// side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't /// close channel with their commitment transaction after a substantial amount of time. Best /// may be to contact the other node operator out-of-band to coordinate other options available -/// to you. In any-case, the choice is up to you. +/// to you. /// -/// [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure +/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager #[must_use] #[no_mangle] 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 { @@ -1106,9 +1167,9 @@ pub extern "C" fn ChannelMonitor_best_block_updated(this_arg: &crate::lightning: /// 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: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_C2Tuple_TxidCOption_BlockHashZZZ { +pub extern "C" fn ChannelMonitor_get_relevant_txids(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ { 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( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = if orig_ret_0_1.is_none() { crate::c_types::derived::COption_BlockHashZ::None } else { crate::c_types::derived::COption_BlockHashZ::Some( { crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.unwrap().into_inner() } }) }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1).into(); local_ret_0 }); }; + 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 = if orig_ret_0_1.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.unwrap().into_inner() } }) }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1).into(); local_ret_0 }); }; local_ret.into() } @@ -1131,6 +1192,32 @@ pub extern "C" fn ChannelMonitor_rebroadcast_pending_claims(this_arg: &crate::li unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.rebroadcast_pending_claims(broadcaster, fee_estimator, logger) } +/// Returns the descriptors for relevant outputs (i.e., those that we can spend) within the +/// transaction if they exist and the transaction has at least [`ANTI_REORG_DELAY`] +/// confirmations. For [`SpendableOutputDescriptor::DelayedPaymentOutput`] descriptors to be +/// returned, the transaction must have at least `max(ANTI_REORG_DELAY, to_self_delay)` +/// confirmations. +/// +/// Descriptors returned by this method are primarily exposed via [`Event::SpendableOutputs`] +/// once they are no longer under reorg risk. This method serves as a way to retrieve these +/// descriptors at a later time, either for historical purposes, or to replay any +/// missed/unhandled descriptors. For the purpose of gathering historical records, if the +/// channel close has fully resolved (i.e., [`ChannelMonitor::get_claimable_balances`] returns +/// an empty set), you can retrieve all spendable outputs by providing all descendant spending +/// transactions starting from the channel's funding transaction and going down three levels. +/// +/// `tx` is a transaction we'll scan the outputs of. Any transaction can be provided. If any +/// outputs which can be spent by us are found, at least one descriptor is returned. +/// +/// `confirmation_height` must be the height of the block in which `tx` was included in. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelMonitor_get_spendable_outputs(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, mut tx: crate::c_types::Transaction, mut confirmation_height: u32) -> crate::c_types::derived::CVec_SpendableOutputDescriptorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_spendable_outputs(&tx.into_bitcoin(), confirmation_height); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::sign::SpendableOutputDescriptor::native_into(item) }); }; + local_ret.into() +} + /// Gets the balances in this channel which are either claimable by us if we were to /// force-close the channel now or which are claimable on-chain (possibly awaiting /// confirmation). @@ -1141,8 +1228,7 @@ pub extern "C" fn ChannelMonitor_rebroadcast_pending_claims(this_arg: &crate::li /// confirmations on the claim transaction. /// /// Note that for `ChannelMonitors` which track a channel which went on-chain with versions of -/// LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted -/// a revoked state. +/// LDK prior to 0.0.111, not all or excess balances may be included. /// /// See [`Balance`] for additional details on the types of claimable balances which /// may be returned here and their meanings. @@ -1155,8 +1241,8 @@ pub extern "C" fn ChannelMonitor_get_claimable_balances(this_arg: &crate::lightn } #[no_mangle] -/// Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write -pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_read(ser: crate::c_types::u8slice, arg_a: &crate::lightning::sign::EntropySource, arg_b: &crate::lightning::sign::SignerProvider) -> crate::c_types::derived::CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { +/// Read a C2Tuple_ThirtyTwoBytesChannelMonitorZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelMonitorZ_write +pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser: crate::c_types::u8slice, arg_a: &crate::lightning::sign::EntropySource, arg_b: &crate::lightning::sign::SignerProvider) -> crate::c_types::derived::CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { let arg_a_conv = arg_a; let arg_b_conv = arg_b; let arg_conv = (arg_a_conv, arg_b_conv); diff --git a/lightning-c-bindings/src/lightning/chain/mod.rs b/lightning-c-bindings/src/lightning/chain/mod.rs index 54dd4ef4..592c6fd2 100644 --- a/lightning-c-bindings/src/lightning/chain/mod.rs +++ b/lightning-c-bindings/src/lightning/chain/mod.rs @@ -9,6 +9,7 @@ //! Structs and traits which allow other parts of rust-lightning to interact with the blockchain. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -23,6 +24,7 @@ pub mod transaction; mod onchaintx { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -34,6 +36,7 @@ use alloc::{vec::Vec, boxed::Box}; mod package { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -183,8 +186,7 @@ pub struct Listen { } unsafe impl Send for Listen {} unsafe impl Sync for Listen {} -#[no_mangle] -pub(crate) extern "C" fn Listen_clone_fields(orig: &Listen) -> Listen { +pub(crate) fn Listen_clone_fields(orig: &Listen) -> Listen { Listen { this_arg: orig.this_arg, filtered_block_connected: Clone::clone(&orig.filtered_block_connected), @@ -219,6 +221,11 @@ impl core::ops::Deref for Listen { self } } +impl core::ops::DerefMut for Listen { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn Listen_free(this_ptr: Listen) { } @@ -320,15 +327,14 @@ pub struct Confirm { /// /// [`transactions_confirmed`]: Self::transactions_confirmed /// [`transaction_unconfirmed`]: Self::transaction_unconfirmed - pub get_relevant_txids: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_TxidCOption_BlockHashZZZ, + pub get_relevant_txids: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ, /// Frees any resources associated with this object given its this_arg pointer. /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, } unsafe impl Send for Confirm {} unsafe impl Sync for Confirm {} -#[no_mangle] -pub(crate) extern "C" fn Confirm_clone_fields(orig: &Confirm) -> Confirm { +pub(crate) fn Confirm_clone_fields(orig: &Confirm) -> Confirm { Confirm { this_arg: orig.this_arg, transactions_confirmed: Clone::clone(&orig.transactions_confirmed), @@ -368,6 +374,11 @@ impl core::ops::Deref for Confirm { self } } +impl core::ops::DerefMut for Confirm { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn Confirm_free(this_ptr: Confirm) { } @@ -379,6 +390,25 @@ impl Drop for Confirm { } } /// An enum representing the status of a channel monitor update persistence. +/// +/// These are generally used as the return value for an implementation of [`Persist`] which is used +/// as the storage layer for a [`ChainMonitor`]. See the docs on [`Persist`] for a high-level +/// explanation of how to handle different cases. +/// +/// While `UnrecoverableError` is provided as a failure variant, it is not truly \"handled\" on the +/// calling side, and generally results in an immediate panic. For those who prefer to avoid +/// panics, `InProgress` can be used and you can retry the update operation in the background or +/// shut down cleanly. +/// +/// Note that channels should generally *not* be force-closed after a persistence failure. +/// Force-closing with the latest [`ChannelMonitorUpdate`] applied may result in a transaction +/// being broadcast which can only be spent by the latest [`ChannelMonitor`]! Thus, if the +/// latest [`ChannelMonitor`] is not durably persisted anywhere and exists only in memory, naively +/// calling [`ChannelManager::force_close_broadcasting_latest_txn`] *may result in loss of funds*! +/// +/// [`Persist`]: chainmonitor::Persist +/// [`ChainMonitor`]: chainmonitor::ChainMonitor +/// [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn #[derive(Clone)] #[must_use] #[repr(C)] @@ -389,17 +419,13 @@ pub enum ChannelMonitorUpdateStatus { /// This includes performing any `fsync()` calls required to ensure the update is guaranteed to /// be available on restart even if the application crashes. Completed, - /// Used to indicate a temporary failure (eg connection to a watchtower or remote backup of - /// our state failed, but is expected to succeed at some point in the future). + /// Indicates that the update will happen asynchronously in the background or that a transient + /// failure occurred which is being retried in the background and will eventually complete. /// - /// Such a failure will \"freeze\" a channel, preventing us from revoking old states or - /// submitting new commitment transactions to the counterparty. Once the update(s) which failed - /// have been successfully applied, a [`MonitorEvent::Completed`] can be used to restore the - /// channel to an operational state. - /// - /// Note that a given [`ChannelManager`] will *never* re-generate a [`ChannelMonitorUpdate`]. - /// If you return this error you must ensure that it is written to disk safely before writing - /// the latest [`ChannelManager`] state, or you should return [`PermanentFailure`] instead. + /// This will \"freeze\" a channel, preventing us from revoking old states or submitting a new + /// commitment transaction to the counterparty. Once the update(s) which are `InProgress` have + /// been completed, a [`MonitorEvent::Completed`] can be used to restore the channel to an + /// operational state. /// /// Even when a channel has been \"frozen\", updates to the [`ChannelMonitor`] can continue to /// occur (e.g. if an inbound HTLC which we forwarded was claimed upstream, resulting in us @@ -409,53 +435,28 @@ pub enum ChannelMonitorUpdateStatus { /// until a [`MonitorEvent::Completed`] is provided, even if you return no error on a later /// monitor update for the same channel. /// - /// For deployments where a copy of ChannelMonitors and other local state are backed up in a - /// remote location (with local copies persisted immediately), it is anticipated that all + /// For deployments where a copy of [`ChannelMonitor`]s and other local state are backed up in + /// a remote location (with local copies persisted immediately), it is anticipated that all /// updates will return [`InProgress`] until the remote copies could be updated. /// - /// [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure + /// Note that while fully asynchronous persistence of [`ChannelMonitor`] data is generally + /// reliable, this feature is considered beta, and a handful of edge-cases remain. Until the + /// remaining cases are fixed, in rare cases, *using this feature may lead to funds loss*. + /// /// [`InProgress`]: ChannelMonitorUpdateStatus::InProgress - /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager InProgress, - /// Used to indicate no further channel monitor updates will be allowed (likely a disk failure - /// or a remote copy of this [`ChannelMonitor`] is no longer reachable and thus not updatable). - /// - /// When this is returned, [`ChannelManager`] will force-close the channel but *not* broadcast - /// our current commitment transaction. This avoids a dangerous case where a local disk failure - /// (e.g. the Linux-default remounting of the disk as read-only) causes [`PermanentFailure`]s - /// for all monitor updates. If we were to broadcast our latest commitment transaction and then - /// restart, we could end up reading a previous [`ChannelMonitor`] and [`ChannelManager`], - /// revoking our now-broadcasted state before seeing it confirm and losing all our funds. - /// - /// Note that this is somewhat of a tradeoff - if the disk is really gone and we may have lost - /// the data permanently, we really should broadcast immediately. If the data can be recovered - /// with manual intervention, we'd rather close the channel, rejecting future updates to it, - /// and broadcast the latest state only if we have HTLCs to claim which are timing out (which - /// we do as long as blocks are connected). - /// - /// In order to broadcast the latest local commitment transaction, you'll need to call - /// [`ChannelMonitor::get_latest_holder_commitment_txn`] and broadcast the resulting - /// transactions once you've safely ensured no further channel updates can be generated by your - /// [`ChannelManager`]. + /// Indicates that an update has failed and will not complete at any point in the future. /// - /// Note that at least one final [`ChannelMonitorUpdate`] may still be provided, which must - /// still be processed by a running [`ChannelMonitor`]. This final update will mark the - /// [`ChannelMonitor`] as finalized, ensuring no further updates (e.g. revocation of the latest - /// commitment transaction) are allowed. + /// Currently returning this variant will cause LDK to immediately panic to encourage immediate + /// shutdown. In the future this may be updated to disconnect peers and refuse to continue + /// normal operation without a panic. /// - /// Note that even if you return a [`PermanentFailure`] due to unavailability of secondary - /// [`ChannelMonitor`] copies, you should still make an attempt to store the update where - /// possible to ensure you can claim HTLC outputs on the latest commitment transaction - /// broadcasted later. + /// Applications which wish to perform an orderly shutdown after failure should consider + /// returning [`InProgress`] instead and simply shut down without ever marking the update + /// complete. /// - /// In case of distributed watchtowers deployment, the new version must be written to disk, as - /// state may have been stored but rejected due to a block forcing a commitment broadcast. This - /// storage is used to claim outputs of rejected state confirmed onchain by another watchtower, - /// lagging behind on block processing. - /// - /// [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure - /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - PermanentFailure, + /// [`InProgress`]: ChannelMonitorUpdateStatus::InProgress + UnrecoverableError, } use lightning::chain::ChannelMonitorUpdateStatus as ChannelMonitorUpdateStatusImport; pub(crate) type nativeChannelMonitorUpdateStatus = ChannelMonitorUpdateStatusImport; @@ -466,7 +467,7 @@ impl ChannelMonitorUpdateStatus { match self { ChannelMonitorUpdateStatus::Completed => nativeChannelMonitorUpdateStatus::Completed, ChannelMonitorUpdateStatus::InProgress => nativeChannelMonitorUpdateStatus::InProgress, - ChannelMonitorUpdateStatus::PermanentFailure => nativeChannelMonitorUpdateStatus::PermanentFailure, + ChannelMonitorUpdateStatus::UnrecoverableError => nativeChannelMonitorUpdateStatus::UnrecoverableError, } } #[allow(unused)] @@ -474,7 +475,7 @@ impl ChannelMonitorUpdateStatus { match self { ChannelMonitorUpdateStatus::Completed => nativeChannelMonitorUpdateStatus::Completed, ChannelMonitorUpdateStatus::InProgress => nativeChannelMonitorUpdateStatus::InProgress, - ChannelMonitorUpdateStatus::PermanentFailure => nativeChannelMonitorUpdateStatus::PermanentFailure, + ChannelMonitorUpdateStatus::UnrecoverableError => nativeChannelMonitorUpdateStatus::UnrecoverableError, } } #[allow(unused)] @@ -482,7 +483,7 @@ impl ChannelMonitorUpdateStatus { match native { nativeChannelMonitorUpdateStatus::Completed => ChannelMonitorUpdateStatus::Completed, nativeChannelMonitorUpdateStatus::InProgress => ChannelMonitorUpdateStatus::InProgress, - nativeChannelMonitorUpdateStatus::PermanentFailure => ChannelMonitorUpdateStatus::PermanentFailure, + nativeChannelMonitorUpdateStatus::UnrecoverableError => ChannelMonitorUpdateStatus::UnrecoverableError, } } #[allow(unused)] @@ -490,7 +491,7 @@ impl ChannelMonitorUpdateStatus { match native { nativeChannelMonitorUpdateStatus::Completed => ChannelMonitorUpdateStatus::Completed, nativeChannelMonitorUpdateStatus::InProgress => ChannelMonitorUpdateStatus::InProgress, - nativeChannelMonitorUpdateStatus::PermanentFailure => ChannelMonitorUpdateStatus::PermanentFailure, + nativeChannelMonitorUpdateStatus::UnrecoverableError => ChannelMonitorUpdateStatus::UnrecoverableError, } } } @@ -508,9 +509,9 @@ pub extern "C" fn ChannelMonitorUpdateStatus_completed() -> ChannelMonitorUpdate pub extern "C" fn ChannelMonitorUpdateStatus_in_progress() -> ChannelMonitorUpdateStatus { ChannelMonitorUpdateStatus::InProgress} #[no_mangle] -/// Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateStatus -pub extern "C" fn ChannelMonitorUpdateStatus_permanent_failure() -> ChannelMonitorUpdateStatus { - ChannelMonitorUpdateStatus::PermanentFailure} +/// Utility method to constructs a new UnrecoverableError-variant ChannelMonitorUpdateStatus +pub extern "C" fn ChannelMonitorUpdateStatus_unrecoverable_error() -> ChannelMonitorUpdateStatus { + ChannelMonitorUpdateStatus::UnrecoverableError} /// Checks if two ChannelMonitorUpdateStatuss contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. #[no_mangle] @@ -521,21 +522,12 @@ pub extern "C" fn ChannelMonitorUpdateStatus_eq(a: &ChannelMonitorUpdateStatus, /// blocks are connected and disconnected. /// /// Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are -/// responsible for maintaining a set of monitors such that they can be updated accordingly as -/// channel state changes and HTLCs are resolved. See method documentation for specific -/// requirements. -/// -/// Implementations **must** ensure that updates are successfully applied and persisted upon method -/// completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down -/// without taking any further action such as persisting the current state. -/// -/// If an implementation maintains multiple instances of a channel's monitor (e.g., by storing -/// backup copies), then it must ensure that updates are applied across all instances. Otherwise, it -/// could result in a revoked transaction being broadcast, allowing the counterparty to claim all -/// funds in the channel. See [`ChannelMonitorUpdateStatus`] for more details about how to handle -/// multiple instances. +/// responsible for maintaining a set of monitors such that they can be updated as channel state +/// changes. On each update, *all copies* of a [`ChannelMonitor`] must be updated and the update +/// persisted to disk to ensure that the latest [`ChannelMonitor`] state can be reloaded if the +/// application crashes. /// -/// [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure +/// See method documentation and [`ChannelMonitorUpdateStatus`] for specific requirements. #[repr(C)] pub struct Watch { /// An opaque pointer which is passed to your function implementations as an argument. @@ -547,19 +539,31 @@ pub struct Watch { /// with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means /// calling [`block_connected`] and [`block_disconnected`] on the monitor. /// - /// Note: this interface MUST error with [`ChannelMonitorUpdateStatus::PermanentFailure`] if - /// the given `funding_txo` has previously been registered via `watch_channel`. + /// A return of `Err(())` indicates that the channel should immediately be force-closed without + /// broadcasting the funding transaction. + /// + /// If the given `funding_txo` has previously been registered via `watch_channel`, `Err(())` + /// must be returned. /// /// [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch /// [`block_connected`]: channelmonitor::ChannelMonitor::block_connected /// [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected - pub watch_channel: extern "C" fn (this_arg: *const c_void, funding_txo: crate::lightning::chain::transaction::OutPoint, monitor: crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::ChannelMonitorUpdateStatus, + pub watch_channel: extern "C" fn (this_arg: *const c_void, funding_txo: crate::lightning::chain::transaction::OutPoint, monitor: crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_ChannelMonitorUpdateStatusNoneZ, /// Updates a channel identified by `funding_txo` by applying `update` to its monitor. /// - /// Implementations must call [`update_monitor`] with the given update. See - /// [`ChannelMonitorUpdateStatus`] for invariants around returning an error. + /// Implementations must call [`ChannelMonitor::update_monitor`] with the given update. This + /// may fail (returning an `Err(())`), in which case this should return + /// [`ChannelMonitorUpdateStatus::InProgress`] (and the update should never complete). This + /// generally implies the channel has been closed (either by the funding outpoint being spent + /// on-chain or the [`ChannelMonitor`] having decided to do so and broadcasted a transaction), + /// and the [`ChannelManager`] state will be updated once it sees the funding spend on-chain. + /// + /// In general, persistence failures should be retried after returning + /// [`ChannelMonitorUpdateStatus::InProgress`] and eventually complete. If a failure truly + /// cannot be retried, the node should shut down immediately after returning + /// [`ChannelMonitorUpdateStatus::UnrecoverableError`], see its documentation for more info. /// - /// [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor + /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager pub update_channel: extern "C" fn (this_arg: *const c_void, funding_txo: crate::lightning::chain::transaction::OutPoint, update: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::lightning::chain::ChannelMonitorUpdateStatus, /// Returns any monitor events since the last call. Subsequent calls must only return new /// events. @@ -577,8 +581,7 @@ pub struct Watch { } unsafe impl Send for Watch {} unsafe impl Sync for Watch {} -#[no_mangle] -pub(crate) extern "C" fn Watch_clone_fields(orig: &Watch) -> Watch { +pub(crate) fn Watch_clone_fields(orig: &Watch) -> Watch { Watch { this_arg: orig.this_arg, watch_channel: Clone::clone(&orig.watch_channel), @@ -590,9 +593,10 @@ pub(crate) extern "C" fn Watch_clone_fields(orig: &Watch) -> Watch { use lightning::chain::Watch as rustWatch; impl rustWatch for Watch { - fn watch_channel(&self, mut funding_txo: lightning::chain::transaction::OutPoint, mut monitor: lightning::chain::channelmonitor::ChannelMonitor) -> lightning::chain::ChannelMonitorUpdateStatus { + fn watch_channel(&self, mut funding_txo: lightning::chain::transaction::OutPoint, mut monitor: lightning::chain::channelmonitor::ChannelMonitor) -> Result { let mut ret = (self.watch_channel)(self.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(funding_txo), is_owned: true }, crate::lightning::chain::channelmonitor::ChannelMonitor { inner: ObjOps::heap_alloc(monitor), is_owned: true }); - ret.into_native() + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_native() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret } fn update_channel(&self, mut funding_txo: lightning::chain::transaction::OutPoint, mut update: &lightning::chain::channelmonitor::ChannelMonitorUpdate) -> lightning::chain::ChannelMonitorUpdateStatus { let mut ret = (self.update_channel)(self.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(funding_txo), is_owned: true }, &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((update as *const lightning::chain::channelmonitor::ChannelMonitorUpdate<>) as *mut _) }, is_owned: false }); @@ -613,6 +617,11 @@ impl core::ops::Deref for Watch { self } } +impl core::ops::DerefMut for Watch { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn Watch_free(this_ptr: Watch) { } @@ -664,8 +673,7 @@ pub struct Filter { } unsafe impl Send for Filter {} unsafe impl Sync for Filter {} -#[no_mangle] -pub(crate) extern "C" fn Filter_clone_fields(orig: &Filter) -> Filter { +pub(crate) fn Filter_clone_fields(orig: &Filter) -> Filter { Filter { this_arg: orig.this_arg, register_tx: Clone::clone(&orig.register_tx), @@ -692,6 +700,11 @@ impl core::ops::Deref for Filter { self } } +impl core::ops::DerefMut for Filter { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn Filter_free(this_ptr: Filter) { } @@ -765,14 +778,14 @@ impl WatchedOutput { } /// First block where the transaction output may have been spent. #[no_mangle] -pub extern "C" fn WatchedOutput_get_block_hash(this_ptr: &WatchedOutput) -> crate::c_types::derived::COption_BlockHashZ { +pub extern "C" fn WatchedOutput_get_block_hash(this_ptr: &WatchedOutput) -> crate::c_types::derived::COption_ThirtyTwoBytesZ { let mut inner_val = &mut this_ptr.get_native_mut_ref().block_hash; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_BlockHashZ::None } else { crate::c_types::derived::COption_BlockHashZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: (*inner_val.as_ref().unwrap()).clone().into_inner() } }) }; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: (*inner_val.as_ref().unwrap()).clone().into_inner() } }) }; local_inner_val } /// First block where the transaction output may have been spent. #[no_mangle] -pub extern "C" fn WatchedOutput_set_block_hash(this_ptr: &mut WatchedOutput, mut val: crate::c_types::derived::COption_BlockHashZ) { +pub extern "C" fn WatchedOutput_set_block_hash(this_ptr: &mut WatchedOutput, mut val: crate::c_types::derived::COption_ThirtyTwoBytesZ) { let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::bitcoin::hash_types::BlockHash::from_slice(&{ val_opt.take() }.data[..]).unwrap() }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.block_hash = local_val; } @@ -801,7 +814,7 @@ pub extern "C" fn WatchedOutput_set_script_pubkey(this_ptr: &mut WatchedOutput, /// Constructs a new WatchedOutput given each field #[must_use] #[no_mangle] -pub extern "C" fn WatchedOutput_new(mut block_hash_arg: crate::c_types::derived::COption_BlockHashZ, mut outpoint_arg: crate::lightning::chain::transaction::OutPoint, mut script_pubkey_arg: crate::c_types::derived::CVec_u8Z) -> WatchedOutput { +pub extern "C" fn WatchedOutput_new(mut block_hash_arg: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut outpoint_arg: crate::lightning::chain::transaction::OutPoint, mut script_pubkey_arg: crate::c_types::derived::CVec_u8Z) -> WatchedOutput { let mut local_block_hash_arg = { /*block_hash_arg*/ let block_hash_arg_opt = block_hash_arg; if block_hash_arg_opt.is_none() { None } else { Some({ { ::bitcoin::hash_types::BlockHash::from_slice(&{ block_hash_arg_opt.take() }.data[..]).unwrap() }})} }; WatchedOutput { inner: ObjOps::heap_alloc(nativeWatchedOutput { block_hash: local_block_hash_arg, diff --git a/lightning-c-bindings/src/lightning/chain/transaction.rs b/lightning-c-bindings/src/lightning/chain/transaction.rs index 520180a3..81b8ee16 100644 --- a/lightning-c-bindings/src/lightning/chain/transaction.rs +++ b/lightning-c-bindings/src/lightning/chain/transaction.rs @@ -9,6 +9,7 @@ //! Types describing on-chain transactions. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -144,7 +145,7 @@ pub extern "C" fn OutPoint_hash(o: &OutPoint) -> u64 { #[no_mangle] 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 } + crate::c_types::ThirtyTwoBytes { data: ret.0 } } #[no_mangle] diff --git a/lightning-c-bindings/src/lightning/events/bump_transaction.rs b/lightning-c-bindings/src/lightning/events/bump_transaction.rs index 0ff12a5b..22a6f475 100644 --- a/lightning-c-bindings/src/lightning/events/bump_transaction.rs +++ b/lightning-c-bindings/src/lightning/events/bump_transaction.rs @@ -11,6 +11,7 @@ //! [`Event`]: crate::events::Event use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -146,6 +147,22 @@ pub extern "C" fn ChannelDerivationParameters_eq(a: &ChannelDerivationParameters if a.inner.is_null() || b.inner.is_null() { return false; } if a.get_native_ref() == b.get_native_ref() { true } else { false } } +#[no_mangle] +/// Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read +pub extern "C" fn ChannelDerivationParameters_write(obj: &crate::lightning::events::bump_transaction::ChannelDerivationParameters) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn ChannelDerivationParameters_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelDerivationParameters) }) +} +#[no_mangle] +/// Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write +pub extern "C" fn ChannelDerivationParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelDerivationParametersDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::events::bump_transaction::ChannelDerivationParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} use lightning::events::bump_transaction::AnchorDescriptor as nativeAnchorDescriptorImport; pub(crate) type nativeAnchorDescriptor = nativeAnchorDescriptorImport; @@ -288,7 +305,7 @@ pub extern "C" fn AnchorDescriptor_witness_script(this_arg: &crate::lightning::e /// transaction. #[must_use] #[no_mangle] -pub extern "C" fn AnchorDescriptor_tx_input_witness(this_arg: &crate::lightning::events::bump_transaction::AnchorDescriptor, mut signature: crate::c_types::Signature) -> crate::c_types::Witness { +pub extern "C" fn AnchorDescriptor_tx_input_witness(this_arg: &crate::lightning::events::bump_transaction::AnchorDescriptor, mut signature: crate::c_types::ECDSASignature) -> crate::c_types::Witness { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.tx_input_witness(&signature.into_rust()); crate::c_types::Witness::from_bitcoin(&ret) } @@ -407,27 +424,27 @@ pub extern "C" fn HTLCDescriptor_set_htlc(this_ptr: &mut HTLCDescriptor, mut val /// The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be /// taken. #[no_mangle] -pub extern "C" fn HTLCDescriptor_get_preimage(this_ptr: &HTLCDescriptor) -> crate::c_types::derived::COption_PaymentPreimageZ { +pub extern "C" fn HTLCDescriptor_get_preimage(this_ptr: &HTLCDescriptor) -> crate::c_types::derived::COption_ThirtyTwoBytesZ { let mut inner_val = &mut this_ptr.get_native_mut_ref().preimage; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_PaymentPreimageZ::None } else { crate::c_types::derived::COption_PaymentPreimageZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: (*inner_val.as_ref().unwrap()).clone().0 } }) }; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: (*inner_val.as_ref().unwrap()).clone().0 } }) }; local_inner_val } /// The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be /// taken. #[no_mangle] -pub extern "C" fn HTLCDescriptor_set_preimage(this_ptr: &mut HTLCDescriptor, mut val: crate::c_types::derived::COption_PaymentPreimageZ) { +pub extern "C" fn HTLCDescriptor_set_preimage(this_ptr: &mut HTLCDescriptor, mut val: crate::c_types::derived::COption_ThirtyTwoBytesZ) { let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::lightning::ln::PaymentPreimage({ val_opt.take() }.data) }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.preimage = local_val; } /// The counterparty's signature required to spend the HTLC output. #[no_mangle] -pub extern "C" fn HTLCDescriptor_get_counterparty_sig(this_ptr: &HTLCDescriptor) -> crate::c_types::Signature { +pub extern "C" fn HTLCDescriptor_get_counterparty_sig(this_ptr: &HTLCDescriptor) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty_sig; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// The counterparty's signature required to spend the HTLC output. #[no_mangle] -pub extern "C" fn HTLCDescriptor_set_counterparty_sig(this_ptr: &mut HTLCDescriptor, mut val: crate::c_types::Signature) { +pub extern "C" fn HTLCDescriptor_set_counterparty_sig(this_ptr: &mut HTLCDescriptor, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.counterparty_sig = val.into_rust(); } impl Clone for HTLCDescriptor { @@ -458,6 +475,22 @@ pub extern "C" fn HTLCDescriptor_eq(a: &HTLCDescriptor, b: &HTLCDescriptor) -> b if a.inner.is_null() || b.inner.is_null() { return false; } if a.get_native_ref() == b.get_native_ref() { true } else { false } } +#[no_mangle] +/// Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_read +pub extern "C" fn HTLCDescriptor_write(obj: &crate::lightning::events::bump_transaction::HTLCDescriptor) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn HTLCDescriptor_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeHTLCDescriptor) }) +} +#[no_mangle] +/// Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_write +pub extern "C" fn HTLCDescriptor_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_HTLCDescriptorDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::events::bump_transaction::HTLCDescriptor { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} /// Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint /// being spent by the HTLC input in the HTLC transaction. #[must_use] @@ -506,7 +539,7 @@ pub extern "C" fn HTLCDescriptor_witness_script(this_arg: &crate::lightning::eve /// transaction. #[must_use] #[no_mangle] -pub extern "C" fn HTLCDescriptor_tx_input_witness(this_arg: &crate::lightning::events::bump_transaction::HTLCDescriptor, mut signature: crate::c_types::Signature, mut witness_script: crate::c_types::u8slice) -> crate::c_types::Witness { +pub extern "C" fn HTLCDescriptor_tx_input_witness(this_arg: &crate::lightning::events::bump_transaction::HTLCDescriptor, mut signature: crate::c_types::ECDSASignature, mut witness_script: crate::c_types::u8slice) -> crate::c_types::Witness { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.tx_input_witness(&signature.into_rust(), &::bitcoin::blockdata::script::Script::from(Vec::from(witness_script.to_slice()))); crate::c_types::Witness::from_bitcoin(&ret) } @@ -1239,8 +1272,7 @@ pub struct CoinSelectionSource { } unsafe impl Send for CoinSelectionSource {} unsafe impl Sync for CoinSelectionSource {} -#[no_mangle] -pub(crate) extern "C" fn CoinSelectionSource_clone_fields(orig: &CoinSelectionSource) -> CoinSelectionSource { +pub(crate) fn CoinSelectionSource_clone_fields(orig: &CoinSelectionSource) -> CoinSelectionSource { CoinSelectionSource { this_arg: orig.this_arg, select_confirmed_utxos: Clone::clone(&orig.select_confirmed_utxos), @@ -1273,6 +1305,11 @@ impl core::ops::Deref for CoinSelectionSource { self } } +impl core::ops::DerefMut for CoinSelectionSource { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn CoinSelectionSource_free(this_ptr: CoinSelectionSource) { } @@ -1294,7 +1331,7 @@ pub struct WalletSource { pub list_confirmed_utxos: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CResult_CVec_UtxoZNoneZ, /// Returns a script to use for change above dust resulting from a successful coin selection /// attempt. - pub get_change_script: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CResult_ScriptNoneZ, + pub get_change_script: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CResult_CVec_u8ZNoneZ, /// Signs and provides the full [`TxIn::script_sig`] and [`TxIn::witness`] for all inputs within /// the transaction known to the wallet (i.e., any provided via /// [`WalletSource::list_confirmed_utxos`]). @@ -1305,8 +1342,7 @@ pub struct WalletSource { } unsafe impl Send for WalletSource {} unsafe impl Sync for WalletSource {} -#[no_mangle] -pub(crate) extern "C" fn WalletSource_clone_fields(orig: &WalletSource) -> WalletSource { +pub(crate) fn WalletSource_clone_fields(orig: &WalletSource) -> WalletSource { WalletSource { this_arg: orig.this_arg, list_confirmed_utxos: Clone::clone(&orig.list_confirmed_utxos), @@ -1343,6 +1379,11 @@ impl core::ops::Deref for WalletSource { self } } +impl core::ops::DerefMut for WalletSource { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn WalletSource_free(this_ptr: WalletSource) { } diff --git a/lightning-c-bindings/src/lightning/events/mod.rs b/lightning-c-bindings/src/lightning/events/mod.rs index cfef8ae2..7a85b836 100644 --- a/lightning-c-bindings/src/lightning/events/mod.rs +++ b/lightning-c-bindings/src/lightning/events/mod.rs @@ -14,6 +14,7 @@ //! few other things. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -36,7 +37,7 @@ pub enum PaymentPurpose { /// /// [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment /// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds - payment_preimage: crate::c_types::derived::COption_PaymentPreimageZ, + payment_preimage: crate::c_types::derived::COption_ThirtyTwoBytesZ, /// The \"payment secret\". This authenticates the sender to the recipient, preventing a /// number of deanonymization attacks during the routing process. /// It is provided here for your reference, however its accuracy is enforced directly by @@ -100,7 +101,7 @@ impl PaymentPurpose { match native { nativePaymentPurpose::InvoicePayment {ref payment_preimage, ref payment_secret, } => { let mut payment_preimage_nonref = Clone::clone(payment_preimage); - let mut local_payment_preimage_nonref = if payment_preimage_nonref.is_none() { crate::c_types::derived::COption_PaymentPreimageZ::None } else { crate::c_types::derived::COption_PaymentPreimageZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_preimage_nonref.unwrap().0 } }) }; + let mut local_payment_preimage_nonref = if payment_preimage_nonref.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_preimage_nonref.unwrap().0 } }) }; let mut payment_secret_nonref = Clone::clone(payment_secret); PaymentPurpose::InvoicePayment { payment_preimage: local_payment_preimage_nonref, @@ -119,7 +120,7 @@ impl PaymentPurpose { pub(crate) fn native_into(native: nativePaymentPurpose) -> Self { match native { nativePaymentPurpose::InvoicePayment {mut payment_preimage, mut payment_secret, } => { - let mut local_payment_preimage = if payment_preimage.is_none() { crate::c_types::derived::COption_PaymentPreimageZ::None } else { crate::c_types::derived::COption_PaymentPreimageZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_preimage.unwrap().0 } }) }; + let mut local_payment_preimage = if payment_preimage.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_preimage.unwrap().0 } }) }; PaymentPurpose::InvoicePayment { payment_preimage: local_payment_preimage, payment_secret: crate::c_types::ThirtyTwoBytes { data: payment_secret.0 }, @@ -143,7 +144,7 @@ pub extern "C" fn PaymentPurpose_clone(orig: &PaymentPurpose) -> PaymentPurpose } #[no_mangle] /// Utility method to constructs a new InvoicePayment-variant PaymentPurpose -pub extern "C" fn PaymentPurpose_invoice_payment(payment_preimage: crate::c_types::derived::COption_PaymentPreimageZ, payment_secret: crate::c_types::ThirtyTwoBytes) -> PaymentPurpose { +pub extern "C" fn PaymentPurpose_invoice_payment(payment_preimage: crate::c_types::derived::COption_ThirtyTwoBytesZ, payment_secret: crate::c_types::ThirtyTwoBytes) -> PaymentPurpose { PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, @@ -172,6 +173,180 @@ pub extern "C" fn PaymentPurpose_read(ser: crate::c_types::u8slice) -> crate::c_ let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::events::PaymentPurpose::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_res } + +use lightning::events::ClaimedHTLC as nativeClaimedHTLCImport; +pub(crate) type nativeClaimedHTLC = nativeClaimedHTLCImport; + +/// Information about an HTLC that is part of a payment that can be claimed. +#[must_use] +#[repr(C)] +pub struct ClaimedHTLC { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, inner must be non-null, however in places where + /// the Rust equivalent takes an Option, it may be set to null to indicate None. + pub inner: *mut nativeClaimedHTLC, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for ClaimedHTLC { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeClaimedHTLC>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ClaimedHTLC, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ClaimedHTLC_free(this_obj: ClaimedHTLC) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ClaimedHTLC_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeClaimedHTLC) }; +} +#[allow(unused)] +impl ClaimedHTLC { + pub(crate) fn get_native_ref(&self) -> &'static nativeClaimedHTLC { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeClaimedHTLC { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeClaimedHTLC { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// The `channel_id` of the channel over which the HTLC was received. +#[no_mangle] +pub extern "C" fn ClaimedHTLC_get_channel_id(this_ptr: &ClaimedHTLC) -> *const [u8; 32] { + let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + &inner_val.0 +} +/// The `channel_id` of the channel over which the HTLC was received. +#[no_mangle] +pub extern "C" fn ClaimedHTLC_set_channel_id(this_ptr: &mut ClaimedHTLC, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); +} +/// The `user_channel_id` of the channel over which the HTLC was received. This is the value +/// passed in to [`ChannelManager::create_channel`] for outbound channels, or to +/// [`ChannelManager::accept_inbound_channel`] for inbound channels if +/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise +/// `user_channel_id` will be randomized for an inbound channel. +/// +/// This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This +/// should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but +/// was not actually claimed until after upgrading.) +/// +/// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel +/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel +/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels +#[no_mangle] +pub extern "C" fn ClaimedHTLC_get_user_channel_id(this_ptr: &ClaimedHTLC) -> crate::c_types::U128 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().user_channel_id; + inner_val.into() +} +/// The `user_channel_id` of the channel over which the HTLC was received. This is the value +/// passed in to [`ChannelManager::create_channel`] for outbound channels, or to +/// [`ChannelManager::accept_inbound_channel`] for inbound channels if +/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise +/// `user_channel_id` will be randomized for an inbound channel. +/// +/// This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This +/// should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but +/// was not actually claimed until after upgrading.) +/// +/// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel +/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel +/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels +#[no_mangle] +pub extern "C" fn ClaimedHTLC_set_user_channel_id(this_ptr: &mut ClaimedHTLC, mut val: crate::c_types::U128) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.user_channel_id = val.into(); +} +/// The block height at which this HTLC expires. +#[no_mangle] +pub extern "C" fn ClaimedHTLC_get_cltv_expiry(this_ptr: &ClaimedHTLC) -> u32 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry; + *inner_val +} +/// The block height at which this HTLC expires. +#[no_mangle] +pub extern "C" fn ClaimedHTLC_set_cltv_expiry(this_ptr: &mut ClaimedHTLC, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry = val; +} +/// The amount (in msats) of this part of an MPP. +#[no_mangle] +pub extern "C" fn ClaimedHTLC_get_value_msat(this_ptr: &ClaimedHTLC) -> u64 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().value_msat; + *inner_val +} +/// The amount (in msats) of this part of an MPP. +#[no_mangle] +pub extern "C" fn ClaimedHTLC_set_value_msat(this_ptr: &mut ClaimedHTLC, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.value_msat = val; +} +/// Constructs a new ClaimedHTLC given each field +#[must_use] +#[no_mangle] +pub extern "C" fn ClaimedHTLC_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut user_channel_id_arg: crate::c_types::U128, mut cltv_expiry_arg: u32, mut value_msat_arg: u64) -> ClaimedHTLC { + ClaimedHTLC { inner: ObjOps::heap_alloc(nativeClaimedHTLC { + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), + user_channel_id: user_channel_id_arg.into(), + cltv_expiry: cltv_expiry_arg, + value_msat: value_msat_arg, + }), is_owned: true } +} +impl Clone for ClaimedHTLC { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeClaimedHTLC>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ClaimedHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeClaimedHTLC)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ClaimedHTLC +pub extern "C" fn ClaimedHTLC_clone(orig: &ClaimedHTLC) -> ClaimedHTLC { + orig.clone() +} +/// Checks if two ClaimedHTLCs contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +/// Two objects with NULL inner values will be considered "equal" here. +#[no_mangle] +pub extern "C" fn ClaimedHTLC_eq(a: &ClaimedHTLC, b: &ClaimedHTLC) -> bool { + if a.inner == b.inner { return true; } + if a.inner.is_null() || b.inner.is_null() { return false; } + if a.get_native_ref() == b.get_native_ref() { true } else { false } +} +#[no_mangle] +/// Serialize the ClaimedHTLC object into a byte array which can be read by ClaimedHTLC_read +pub extern "C" fn ClaimedHTLC_write(obj: &crate::lightning::events::ClaimedHTLC) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn ClaimedHTLC_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeClaimedHTLC) }) +} +#[no_mangle] +/// Read a ClaimedHTLC from a byte array, created by ClaimedHTLC_write +pub extern "C" fn ClaimedHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClaimedHTLCDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::events::ClaimedHTLC { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} /// When the payment path failure took place and extra details about it. [`PathFailure::OnPath`] may /// contain a [`NetworkUpdate`] that needs to be applied to the [`NetworkGraph`]. /// @@ -367,6 +542,9 @@ pub enum ClosureReason { /// The counterparty requested a cooperative close of a channel that had not been funded yet. /// The channel has been immediately closed. CounterpartyCoopClosedUnfundedChannel, + /// Another channel in the same funding batch closed before the funding transaction + /// was ready to be broadcast. + FundingBatchClosure, } use lightning::events::ClosureReason as ClosureReasonImport; pub(crate) type nativeClosureReason = ClosureReasonImport; @@ -394,6 +572,7 @@ impl ClosureReason { ClosureReason::DisconnectedPeer => nativeClosureReason::DisconnectedPeer, ClosureReason::OutdatedChannelManager => nativeClosureReason::OutdatedChannelManager, ClosureReason::CounterpartyCoopClosedUnfundedChannel => nativeClosureReason::CounterpartyCoopClosedUnfundedChannel, + ClosureReason::FundingBatchClosure => nativeClosureReason::FundingBatchClosure, } } #[allow(unused)] @@ -416,6 +595,7 @@ impl ClosureReason { ClosureReason::DisconnectedPeer => nativeClosureReason::DisconnectedPeer, ClosureReason::OutdatedChannelManager => nativeClosureReason::OutdatedChannelManager, ClosureReason::CounterpartyCoopClosedUnfundedChannel => nativeClosureReason::CounterpartyCoopClosedUnfundedChannel, + ClosureReason::FundingBatchClosure => nativeClosureReason::FundingBatchClosure, } } #[allow(unused)] @@ -440,6 +620,7 @@ impl ClosureReason { nativeClosureReason::DisconnectedPeer => ClosureReason::DisconnectedPeer, nativeClosureReason::OutdatedChannelManager => ClosureReason::OutdatedChannelManager, nativeClosureReason::CounterpartyCoopClosedUnfundedChannel => ClosureReason::CounterpartyCoopClosedUnfundedChannel, + nativeClosureReason::FundingBatchClosure => ClosureReason::FundingBatchClosure, } } #[allow(unused)] @@ -462,6 +643,7 @@ impl ClosureReason { nativeClosureReason::DisconnectedPeer => ClosureReason::DisconnectedPeer, nativeClosureReason::OutdatedChannelManager => ClosureReason::OutdatedChannelManager, nativeClosureReason::CounterpartyCoopClosedUnfundedChannel => ClosureReason::CounterpartyCoopClosedUnfundedChannel, + nativeClosureReason::FundingBatchClosure => ClosureReason::FundingBatchClosure, } } } @@ -515,6 +697,10 @@ pub extern "C" fn ClosureReason_outdated_channel_manager() -> ClosureReason { /// Utility method to constructs a new CounterpartyCoopClosedUnfundedChannel-variant ClosureReason pub extern "C" fn ClosureReason_counterparty_coop_closed_unfunded_channel() -> ClosureReason { ClosureReason::CounterpartyCoopClosedUnfundedChannel} +#[no_mangle] +/// Utility method to constructs a new FundingBatchClosure-variant ClosureReason +pub extern "C" fn ClosureReason_funding_batch_closure() -> ClosureReason { + ClosureReason::FundingBatchClosure} /// Checks if two ClosureReasons contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. #[no_mangle] @@ -589,7 +775,7 @@ impl HTLCDestination { let mut channel_id_nonref = Clone::clone(channel_id); nativeHTLCDestination::NextHopChannel { node_id: local_node_id_nonref, - channel_id: channel_id_nonref.data, + channel_id: ::lightning::ln::ChannelId(channel_id_nonref.data), } }, HTLCDestination::UnknownNextHop {ref requested_forward_scid, } => { @@ -619,7 +805,7 @@ impl HTLCDestination { let mut local_node_id = if node_id.is_null() { None } else { Some( { node_id.into_rust() }) }; nativeHTLCDestination::NextHopChannel { node_id: local_node_id, - channel_id: channel_id.data, + channel_id: ::lightning::ln::ChannelId(channel_id.data), } }, HTLCDestination::UnknownNextHop {mut requested_forward_scid, } => { @@ -648,7 +834,7 @@ impl HTLCDestination { let mut channel_id_nonref = Clone::clone(channel_id); HTLCDestination::NextHopChannel { node_id: local_node_id_nonref, - channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref }, + channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref.0 }, } }, nativeHTLCDestination::UnknownNextHop {ref requested_forward_scid, } => { @@ -678,7 +864,7 @@ impl HTLCDestination { let mut local_node_id = if node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(node_id.unwrap())) } }; HTLCDestination::NextHopChannel { node_id: local_node_id, - channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id }, + channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id.0 }, } }, nativeHTLCDestination::UnknownNextHop {mut requested_forward_scid, } => { @@ -911,11 +1097,15 @@ pub enum Event { channel_value_satoshis: u64, /// The script which should be used in the transaction output. output_script: crate::c_types::derived::CVec_u8Z, - /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a - /// random value for an inbound channel. This may be zero for objects serialized with LDK - /// versions prior to 0.0.113. + /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + /// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + /// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + /// `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + /// serialized with LDK versions prior to 0.0.113. /// /// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + /// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels user_channel_id: crate::c_types::U128, }, /// Indicates that we've been offered a payment and it needs to be claimed via calling @@ -924,9 +1114,19 @@ pub enum Event { /// Note that if the preimage is not known, you should call /// [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`] /// to free up resources for this HTLC and avoid network congestion. - /// If you fail to call either [`ChannelManager::claim_funds`], [`ChannelManager::fail_htlc_backwards`], - /// or [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will be - /// automatically failed. + /// + /// If [`Event::PaymentClaimable::onion_fields`] is `Some`, and includes custom TLVs with even type + /// numbers, you should use [`ChannelManager::fail_htlc_backwards_with_reason`] with + /// [`FailureCode::InvalidOnionPayload`] if you fail to understand and handle the contents, or + /// [`ChannelManager::claim_funds_with_known_custom_tlvs`] upon successful handling. + /// If you don't intend to check for custom TLVs, you can simply use + /// [`ChannelManager::claim_funds`], which will automatically fail back even custom TLVs. + /// + /// If you fail to call [`ChannelManager::claim_funds`], + /// [`ChannelManager::claim_funds_with_known_custom_tlvs`], + /// [`ChannelManager::fail_htlc_backwards`], or + /// [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will + /// be automatically failed. /// /// # Note /// LDK will not stop an inbound payment from being paid multiple times, so multiple @@ -938,6 +1138,8 @@ pub enum Event { /// This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier. /// /// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + /// [`ChannelManager::claim_funds_with_known_custom_tlvs`]: crate::ln::channelmanager::ChannelManager::claim_funds_with_known_custom_tlvs + /// [`FailureCode::InvalidOnionPayload`]: crate::ln::channelmanager::FailureCode::InvalidOnionPayload /// [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards /// [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason PaymentClaimable { @@ -983,11 +1185,9 @@ pub enum Event { /// payment is to pay an invoice or to send a spontaneous payment. purpose: crate::lightning::events::PaymentPurpose, /// The `channel_id` indicating over which channel we received the payment. - /// - /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - via_channel_id: crate::c_types::ThirtyTwoBytes, + via_channel_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, /// The `user_channel_id` indicating over which channel we received the payment. - via_user_channel_id: crate::c_types::derived::COption_u128Z, + via_user_channel_id: crate::c_types::derived::COption_U128Z, /// The block height at which this payment will be failed back and will no longer be /// eligible for claiming. /// @@ -1030,6 +1230,12 @@ pub enum Event { /// The purpose of the claimed payment, i.e. whether the payment was for an invoice or a /// spontaneous payment. purpose: crate::lightning::events::PaymentPurpose, + /// The HTLCs that comprise the claimed payment. This will be empty for events serialized prior + /// to LDK version 0.0.117. + htlcs: crate::c_types::derived::CVec_ClaimedHTLCZ, + /// The sender-intended sum total of all the MPP parts. This will be `None` for events + /// serialized prior to LDK version 0.0.117. + sender_intended_total_msat: crate::c_types::derived::COption_u64Z, }, /// Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target /// and we got back the payment preimage for it). @@ -1040,7 +1246,7 @@ pub enum Event { /// The `payment_id` passed to [`ChannelManager::send_payment`]. /// /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - payment_id: crate::c_types::derived::COption_PaymentIdZ, + payment_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, /// The preimage to the hash given to ChannelManager::send_payment. /// Note that this serves as a payment receipt, if you wish to have such a thing, you must /// store it somehow! @@ -1067,6 +1273,11 @@ pub enum Event { /// payment is no longer retryable, due either to the [`Retry`] provided or /// [`ChannelManager::abandon_payment`] having been called for the corresponding payment. /// + /// In exceedingly rare cases, it is possible that an [`Event::PaymentFailed`] is generated for + /// a payment after an [`Event::PaymentSent`] event for this same payment has already been + /// received and processed. In this case, the [`Event::PaymentFailed`] event MUST be ignored, + /// and the payment MUST be treated as having succeeded. + /// /// [`Retry`]: crate::ln::channelmanager::Retry /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment PaymentFailed { @@ -1096,7 +1307,7 @@ pub enum Event { /// This will be `Some` for all payments which completed on LDK 0.0.104 or later. /// /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - payment_hash: crate::c_types::derived::COption_PaymentHashZ, + payment_hash: crate::c_types::derived::COption_ThirtyTwoBytesZ, /// The payment path that was successful. /// /// May contain a closed channel if the HTLC sent along the path was fulfilled on chain. @@ -1119,7 +1330,7 @@ pub enum Event { /// /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment - payment_id: crate::c_types::derived::COption_PaymentIdZ, + payment_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, /// The hash that was given to [`ChannelManager::send_payment`]. /// /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment @@ -1229,20 +1440,20 @@ pub enum Event { SpendableOutputs { /// The outputs which you should store as spendable by you. outputs: crate::c_types::derived::CVec_SpendableOutputDescriptorZ, + /// The `channel_id` indicating which channel the spendable outputs belong to. + /// + /// This will always be `Some` for events generated by LDK versions 0.0.117 and above. + channel_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, }, /// This event is generated when a payment has been successfully forwarded through us and a /// forwarding fee earned. PaymentForwarded { /// The incoming channel between the previous node and us. This is only `None` for events /// generated or serialized by versions prior to 0.0.107. - /// - /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - prev_channel_id: crate::c_types::ThirtyTwoBytes, + prev_channel_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, /// The outgoing channel between the next node and us. This is only `None` for events /// generated or serialized by versions prior to 0.0.107. - /// - /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - next_channel_id: crate::c_types::ThirtyTwoBytes, + next_channel_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, /// The fee, in milli-satoshis, which was earned as a result of the payment. /// /// Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC @@ -1286,9 +1497,7 @@ pub enum Event { /// The `temporary_channel_id` this channel used to be known by during channel establishment. /// /// Will be `None` for channels created prior to LDK version 0.0.115. - /// - /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - former_temporary_channel_id: crate::c_types::ThirtyTwoBytes, + former_temporary_channel_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, /// The `node_id` of the channel counterparty. counterparty_node_id: crate::c_types::PublicKey, /// The outpoint of the channel's funding transaction. @@ -1317,6 +1526,13 @@ pub enum Event { }, /// Used to indicate that a previously opened channel with the given `channel_id` is in the /// process of closure. + /// + /// Note that this event is only triggered for accepted channels: if the + /// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true and the channel is + /// rejected, no `ChannelClosed` event will be sent. + /// + /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + /// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels ChannelClosed { /// The `channel_id` of the channel which has been closed. Note that on-chain transactions /// resolving the channel are likely still awaiting confirmation. @@ -1334,9 +1550,21 @@ pub enum Event { user_channel_id: crate::c_types::U128, /// The reason the channel was closed. reason: crate::lightning::events::ClosureReason, + /// Counterparty in the closed channel. + /// + /// This field will be `None` for objects serialized prior to LDK 0.0.117. + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + counterparty_node_id: crate::c_types::PublicKey, + /// Channel capacity of the closing channel (sats). + /// + /// This field will be `None` for objects serialized prior to LDK 0.0.117. + channel_capacity_sats: crate::c_types::derived::COption_u64Z, }, /// Used to indicate to the user that they can abandon the funding transaction and recycle the /// inputs for another purpose. + /// + /// This event is not guaranteed to be generated for channels that are closed due to a restart. DiscardFunding { /// The channel_id of the channel which has been closed. channel_id: crate::c_types::ThirtyTwoBytes, @@ -1345,8 +1573,9 @@ pub enum Event { }, /// Indicates a request to open a new channel by a peer. /// - /// To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the - /// request, call [`ChannelManager::force_close_without_broadcasting_txn`]. + /// To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the request, + /// call [`ChannelManager::force_close_without_broadcasting_txn`]. Note that a ['ChannelClosed`] + /// event will _not_ be triggered if the channel is rejected. /// /// The event is only triggered when a new open channel request is received and the /// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. @@ -1438,7 +1667,7 @@ impl Event { let mut output_script_nonref = Clone::clone(output_script); let mut user_channel_id_nonref = Clone::clone(user_channel_id); nativeEvent::FundingGenerationReady { - temporary_channel_id: temporary_channel_id_nonref.data, + temporary_channel_id: ::lightning::ln::ChannelId(temporary_channel_id_nonref.data), counterparty_node_id: counterparty_node_id_nonref.into_rust(), channel_value_satoshis: channel_value_satoshis_nonref, output_script: ::bitcoin::blockdata::script::Script::from(output_script_nonref.into_rust()), @@ -1455,7 +1684,7 @@ impl Event { let mut counterparty_skimmed_fee_msat_nonref = Clone::clone(counterparty_skimmed_fee_msat); let mut purpose_nonref = Clone::clone(purpose); let mut via_channel_id_nonref = Clone::clone(via_channel_id); - let mut local_via_channel_id_nonref = if via_channel_id_nonref.data == [0; 32] { None } else { Some( { via_channel_id_nonref.data }) }; + let mut local_via_channel_id_nonref = { /*via_channel_id_nonref*/ let via_channel_id_nonref_opt = via_channel_id_nonref; if via_channel_id_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::ChannelId({ via_channel_id_nonref_opt.take() }.data) }})} }; let mut via_user_channel_id_nonref = Clone::clone(via_user_channel_id); let mut local_via_user_channel_id_nonref = { /*via_user_channel_id_nonref*/ let via_user_channel_id_nonref_opt = via_user_channel_id_nonref; if via_user_channel_id_nonref_opt.is_none() { None } else { Some({ { { via_user_channel_id_nonref_opt.take() }.into() }})} }; let mut claim_deadline_nonref = Clone::clone(claim_deadline); @@ -1472,17 +1701,23 @@ impl Event { claim_deadline: local_claim_deadline_nonref, } }, - Event::PaymentClaimed {ref receiver_node_id, ref payment_hash, ref amount_msat, ref purpose, } => { + Event::PaymentClaimed {ref receiver_node_id, ref payment_hash, ref amount_msat, ref purpose, ref htlcs, ref sender_intended_total_msat, } => { let mut receiver_node_id_nonref = Clone::clone(receiver_node_id); let mut local_receiver_node_id_nonref = if receiver_node_id_nonref.is_null() { None } else { Some( { receiver_node_id_nonref.into_rust() }) }; let mut payment_hash_nonref = Clone::clone(payment_hash); let mut amount_msat_nonref = Clone::clone(amount_msat); let mut purpose_nonref = Clone::clone(purpose); + let mut htlcs_nonref = Clone::clone(htlcs); + let mut local_htlcs_nonref = Vec::new(); for mut item in htlcs_nonref.into_rust().drain(..) { local_htlcs_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut sender_intended_total_msat_nonref = Clone::clone(sender_intended_total_msat); + let mut local_sender_intended_total_msat_nonref = if sender_intended_total_msat_nonref.is_some() { Some( { sender_intended_total_msat_nonref.take() }) } else { None }; nativeEvent::PaymentClaimed { receiver_node_id: local_receiver_node_id_nonref, payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data), amount_msat: amount_msat_nonref, purpose: purpose_nonref.into_native(), + htlcs: local_htlcs_nonref, + sender_intended_total_msat: local_sender_intended_total_msat_nonref, } }, Event::PaymentSent {ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat, } => { @@ -1582,18 +1817,21 @@ impl Event { expected_outbound_amount_msat: expected_outbound_amount_msat_nonref, } }, - Event::SpendableOutputs {ref outputs, } => { + Event::SpendableOutputs {ref outputs, ref channel_id, } => { let mut outputs_nonref = Clone::clone(outputs); let mut local_outputs_nonref = Vec::new(); for mut item in outputs_nonref.into_rust().drain(..) { local_outputs_nonref.push( { item.into_native() }); }; + let mut channel_id_nonref = Clone::clone(channel_id); + let mut local_channel_id_nonref = { /*channel_id_nonref*/ let channel_id_nonref_opt = channel_id_nonref; if channel_id_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::ChannelId({ channel_id_nonref_opt.take() }.data) }})} }; nativeEvent::SpendableOutputs { outputs: local_outputs_nonref, + channel_id: local_channel_id_nonref, } }, Event::PaymentForwarded {ref prev_channel_id, ref next_channel_id, ref fee_earned_msat, ref claim_from_onchain_tx, ref outbound_amount_forwarded_msat, } => { let mut prev_channel_id_nonref = Clone::clone(prev_channel_id); - let mut local_prev_channel_id_nonref = if prev_channel_id_nonref.data == [0; 32] { None } else { Some( { prev_channel_id_nonref.data }) }; + let mut local_prev_channel_id_nonref = { /*prev_channel_id_nonref*/ let prev_channel_id_nonref_opt = prev_channel_id_nonref; if prev_channel_id_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::ChannelId({ prev_channel_id_nonref_opt.take() }.data) }})} }; let mut next_channel_id_nonref = Clone::clone(next_channel_id); - let mut local_next_channel_id_nonref = if next_channel_id_nonref.data == [0; 32] { None } else { Some( { next_channel_id_nonref.data }) }; + let mut local_next_channel_id_nonref = { /*next_channel_id_nonref*/ let next_channel_id_nonref_opt = next_channel_id_nonref; if next_channel_id_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::ChannelId({ next_channel_id_nonref_opt.take() }.data) }})} }; let mut fee_earned_msat_nonref = Clone::clone(fee_earned_msat); let mut local_fee_earned_msat_nonref = if fee_earned_msat_nonref.is_some() { Some( { fee_earned_msat_nonref.take() }) } else { None }; let mut claim_from_onchain_tx_nonref = Clone::clone(claim_from_onchain_tx); @@ -1611,11 +1849,11 @@ impl Event { let mut channel_id_nonref = Clone::clone(channel_id); let mut user_channel_id_nonref = Clone::clone(user_channel_id); let mut former_temporary_channel_id_nonref = Clone::clone(former_temporary_channel_id); - let mut local_former_temporary_channel_id_nonref = if former_temporary_channel_id_nonref.data == [0; 32] { None } else { Some( { former_temporary_channel_id_nonref.data }) }; + let mut local_former_temporary_channel_id_nonref = { /*former_temporary_channel_id_nonref*/ let former_temporary_channel_id_nonref_opt = former_temporary_channel_id_nonref; if former_temporary_channel_id_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::ChannelId({ former_temporary_channel_id_nonref_opt.take() }.data) }})} }; let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); let mut funding_txo_nonref = Clone::clone(funding_txo); nativeEvent::ChannelPending { - channel_id: channel_id_nonref.data, + channel_id: ::lightning::ln::ChannelId(channel_id_nonref.data), user_channel_id: user_channel_id_nonref.into(), former_temporary_channel_id: local_former_temporary_channel_id_nonref, counterparty_node_id: counterparty_node_id_nonref.into_rust(), @@ -1628,27 +1866,33 @@ impl Event { let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); let mut channel_type_nonref = Clone::clone(channel_type); nativeEvent::ChannelReady { - channel_id: channel_id_nonref.data, + channel_id: ::lightning::ln::ChannelId(channel_id_nonref.data), user_channel_id: user_channel_id_nonref.into(), counterparty_node_id: counterparty_node_id_nonref.into_rust(), channel_type: *unsafe { Box::from_raw(channel_type_nonref.take_inner()) }, } }, - Event::ChannelClosed {ref channel_id, ref user_channel_id, ref reason, } => { + Event::ChannelClosed {ref channel_id, ref user_channel_id, ref reason, ref counterparty_node_id, ref channel_capacity_sats, } => { let mut channel_id_nonref = Clone::clone(channel_id); let mut user_channel_id_nonref = Clone::clone(user_channel_id); let mut reason_nonref = Clone::clone(reason); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut local_counterparty_node_id_nonref = if counterparty_node_id_nonref.is_null() { None } else { Some( { counterparty_node_id_nonref.into_rust() }) }; + let mut channel_capacity_sats_nonref = Clone::clone(channel_capacity_sats); + let mut local_channel_capacity_sats_nonref = if channel_capacity_sats_nonref.is_some() { Some( { channel_capacity_sats_nonref.take() }) } else { None }; nativeEvent::ChannelClosed { - channel_id: channel_id_nonref.data, + channel_id: ::lightning::ln::ChannelId(channel_id_nonref.data), user_channel_id: user_channel_id_nonref.into(), reason: reason_nonref.into_native(), + counterparty_node_id: local_counterparty_node_id_nonref, + channel_capacity_sats: local_channel_capacity_sats_nonref, } }, Event::DiscardFunding {ref channel_id, ref transaction, } => { let mut channel_id_nonref = Clone::clone(channel_id); let mut transaction_nonref = Clone::clone(transaction); nativeEvent::DiscardFunding { - channel_id: channel_id_nonref.data, + channel_id: ::lightning::ln::ChannelId(channel_id_nonref.data), transaction: transaction_nonref.into_bitcoin(), } }, @@ -1659,7 +1903,7 @@ impl Event { let mut push_msat_nonref = Clone::clone(push_msat); let mut channel_type_nonref = Clone::clone(channel_type); nativeEvent::OpenChannelRequest { - temporary_channel_id: temporary_channel_id_nonref.data, + temporary_channel_id: ::lightning::ln::ChannelId(temporary_channel_id_nonref.data), counterparty_node_id: counterparty_node_id_nonref.into_rust(), funding_satoshis: funding_satoshis_nonref, push_msat: push_msat_nonref, @@ -1670,7 +1914,7 @@ impl Event { let mut prev_channel_id_nonref = Clone::clone(prev_channel_id); let mut failed_next_destination_nonref = Clone::clone(failed_next_destination); nativeEvent::HTLCHandlingFailed { - prev_channel_id: prev_channel_id_nonref.data, + prev_channel_id: ::lightning::ln::ChannelId(prev_channel_id_nonref.data), failed_next_destination: failed_next_destination_nonref.into_native(), } }, @@ -1687,7 +1931,7 @@ impl Event { match self { Event::FundingGenerationReady {mut temporary_channel_id, mut counterparty_node_id, mut channel_value_satoshis, mut output_script, mut user_channel_id, } => { nativeEvent::FundingGenerationReady { - temporary_channel_id: temporary_channel_id.data, + temporary_channel_id: ::lightning::ln::ChannelId(temporary_channel_id.data), counterparty_node_id: counterparty_node_id.into_rust(), channel_value_satoshis: channel_value_satoshis, output_script: ::bitcoin::blockdata::script::Script::from(output_script.into_rust()), @@ -1697,7 +1941,7 @@ impl Event { Event::PaymentClaimable {mut receiver_node_id, mut payment_hash, mut onion_fields, mut amount_msat, mut counterparty_skimmed_fee_msat, mut purpose, mut via_channel_id, mut via_user_channel_id, mut claim_deadline, } => { let mut local_receiver_node_id = if receiver_node_id.is_null() { None } else { Some( { receiver_node_id.into_rust() }) }; let mut local_onion_fields = if onion_fields.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(onion_fields.take_inner()) } }) }; - let mut local_via_channel_id = if via_channel_id.data == [0; 32] { None } else { Some( { via_channel_id.data }) }; + let mut local_via_channel_id = { /*via_channel_id*/ let via_channel_id_opt = via_channel_id; if via_channel_id_opt.is_none() { None } else { Some({ { ::lightning::ln::ChannelId({ via_channel_id_opt.take() }.data) }})} }; let mut local_via_user_channel_id = { /*via_user_channel_id*/ let via_user_channel_id_opt = via_user_channel_id; if via_user_channel_id_opt.is_none() { None } else { Some({ { { via_user_channel_id_opt.take() }.into() }})} }; let mut local_claim_deadline = if claim_deadline.is_some() { Some( { claim_deadline.take() }) } else { None }; nativeEvent::PaymentClaimable { @@ -1712,13 +1956,17 @@ impl Event { claim_deadline: local_claim_deadline, } }, - Event::PaymentClaimed {mut receiver_node_id, mut payment_hash, mut amount_msat, mut purpose, } => { + Event::PaymentClaimed {mut receiver_node_id, mut payment_hash, mut amount_msat, mut purpose, mut htlcs, mut sender_intended_total_msat, } => { let mut local_receiver_node_id = if receiver_node_id.is_null() { None } else { Some( { receiver_node_id.into_rust() }) }; + let mut local_htlcs = Vec::new(); for mut item in htlcs.into_rust().drain(..) { local_htlcs.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_sender_intended_total_msat = if sender_intended_total_msat.is_some() { Some( { sender_intended_total_msat.take() }) } else { None }; nativeEvent::PaymentClaimed { receiver_node_id: local_receiver_node_id, payment_hash: ::lightning::ln::PaymentHash(payment_hash.data), amount_msat: amount_msat, purpose: purpose.into_native(), + htlcs: local_htlcs, + sender_intended_total_msat: local_sender_intended_total_msat, } }, Event::PaymentSent {mut payment_id, mut payment_preimage, mut payment_hash, mut fee_paid_msat, } => { @@ -1789,15 +2037,17 @@ impl Event { expected_outbound_amount_msat: expected_outbound_amount_msat, } }, - Event::SpendableOutputs {mut outputs, } => { + Event::SpendableOutputs {mut outputs, mut channel_id, } => { let mut local_outputs = Vec::new(); for mut item in outputs.into_rust().drain(..) { local_outputs.push( { item.into_native() }); }; + let mut local_channel_id = { /*channel_id*/ let channel_id_opt = channel_id; if channel_id_opt.is_none() { None } else { Some({ { ::lightning::ln::ChannelId({ channel_id_opt.take() }.data) }})} }; nativeEvent::SpendableOutputs { outputs: local_outputs, + channel_id: local_channel_id, } }, Event::PaymentForwarded {mut prev_channel_id, mut next_channel_id, mut fee_earned_msat, mut claim_from_onchain_tx, mut outbound_amount_forwarded_msat, } => { - let mut local_prev_channel_id = if prev_channel_id.data == [0; 32] { None } else { Some( { prev_channel_id.data }) }; - let mut local_next_channel_id = if next_channel_id.data == [0; 32] { None } else { Some( { next_channel_id.data }) }; + let mut local_prev_channel_id = { /*prev_channel_id*/ let prev_channel_id_opt = prev_channel_id; if prev_channel_id_opt.is_none() { None } else { Some({ { ::lightning::ln::ChannelId({ prev_channel_id_opt.take() }.data) }})} }; + let mut local_next_channel_id = { /*next_channel_id*/ let next_channel_id_opt = next_channel_id; if next_channel_id_opt.is_none() { None } else { Some({ { ::lightning::ln::ChannelId({ next_channel_id_opt.take() }.data) }})} }; let mut local_fee_earned_msat = if fee_earned_msat.is_some() { Some( { fee_earned_msat.take() }) } else { None }; let mut local_outbound_amount_forwarded_msat = if outbound_amount_forwarded_msat.is_some() { Some( { outbound_amount_forwarded_msat.take() }) } else { None }; nativeEvent::PaymentForwarded { @@ -1809,9 +2059,9 @@ impl Event { } }, Event::ChannelPending {mut channel_id, mut user_channel_id, mut former_temporary_channel_id, mut counterparty_node_id, mut funding_txo, } => { - let mut local_former_temporary_channel_id = if former_temporary_channel_id.data == [0; 32] { None } else { Some( { former_temporary_channel_id.data }) }; + let mut local_former_temporary_channel_id = { /*former_temporary_channel_id*/ let former_temporary_channel_id_opt = former_temporary_channel_id; if former_temporary_channel_id_opt.is_none() { None } else { Some({ { ::lightning::ln::ChannelId({ former_temporary_channel_id_opt.take() }.data) }})} }; nativeEvent::ChannelPending { - channel_id: channel_id.data, + channel_id: ::lightning::ln::ChannelId(channel_id.data), user_channel_id: user_channel_id.into(), former_temporary_channel_id: local_former_temporary_channel_id, counterparty_node_id: counterparty_node_id.into_rust(), @@ -1820,28 +2070,32 @@ impl Event { }, Event::ChannelReady {mut channel_id, mut user_channel_id, mut counterparty_node_id, mut channel_type, } => { nativeEvent::ChannelReady { - channel_id: channel_id.data, + channel_id: ::lightning::ln::ChannelId(channel_id.data), user_channel_id: user_channel_id.into(), counterparty_node_id: counterparty_node_id.into_rust(), channel_type: *unsafe { Box::from_raw(channel_type.take_inner()) }, } }, - Event::ChannelClosed {mut channel_id, mut user_channel_id, mut reason, } => { + Event::ChannelClosed {mut channel_id, mut user_channel_id, mut reason, mut counterparty_node_id, mut channel_capacity_sats, } => { + let mut local_counterparty_node_id = if counterparty_node_id.is_null() { None } else { Some( { counterparty_node_id.into_rust() }) }; + let mut local_channel_capacity_sats = if channel_capacity_sats.is_some() { Some( { channel_capacity_sats.take() }) } else { None }; nativeEvent::ChannelClosed { - channel_id: channel_id.data, + channel_id: ::lightning::ln::ChannelId(channel_id.data), user_channel_id: user_channel_id.into(), reason: reason.into_native(), + counterparty_node_id: local_counterparty_node_id, + channel_capacity_sats: local_channel_capacity_sats, } }, Event::DiscardFunding {mut channel_id, mut transaction, } => { nativeEvent::DiscardFunding { - channel_id: channel_id.data, + channel_id: ::lightning::ln::ChannelId(channel_id.data), transaction: transaction.into_bitcoin(), } }, Event::OpenChannelRequest {mut temporary_channel_id, mut counterparty_node_id, mut funding_satoshis, mut push_msat, mut channel_type, } => { nativeEvent::OpenChannelRequest { - temporary_channel_id: temporary_channel_id.data, + temporary_channel_id: ::lightning::ln::ChannelId(temporary_channel_id.data), counterparty_node_id: counterparty_node_id.into_rust(), funding_satoshis: funding_satoshis, push_msat: push_msat, @@ -1850,7 +2104,7 @@ impl Event { }, Event::HTLCHandlingFailed {mut prev_channel_id, mut failed_next_destination, } => { nativeEvent::HTLCHandlingFailed { - prev_channel_id: prev_channel_id.data, + prev_channel_id: ::lightning::ln::ChannelId(prev_channel_id.data), failed_next_destination: failed_next_destination.into_native(), } }, @@ -1871,7 +2125,7 @@ impl Event { let mut output_script_nonref = Clone::clone(output_script); let mut user_channel_id_nonref = Clone::clone(user_channel_id); Event::FundingGenerationReady { - temporary_channel_id: crate::c_types::ThirtyTwoBytes { data: temporary_channel_id_nonref }, + temporary_channel_id: crate::c_types::ThirtyTwoBytes { data: temporary_channel_id_nonref.0 }, counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), channel_value_satoshis: channel_value_satoshis_nonref, output_script: output_script_nonref.into_bytes().into(), @@ -1888,9 +2142,9 @@ impl Event { let mut counterparty_skimmed_fee_msat_nonref = Clone::clone(counterparty_skimmed_fee_msat); let mut purpose_nonref = Clone::clone(purpose); let mut via_channel_id_nonref = Clone::clone(via_channel_id); - let mut local_via_channel_id_nonref = if via_channel_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (via_channel_id_nonref.unwrap()) } } }; + let mut local_via_channel_id_nonref = if via_channel_id_nonref.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: via_channel_id_nonref.unwrap().0 } }) }; let mut via_user_channel_id_nonref = Clone::clone(via_user_channel_id); - let mut local_via_user_channel_id_nonref = if via_user_channel_id_nonref.is_none() { crate::c_types::derived::COption_u128Z::None } else { crate::c_types::derived::COption_u128Z::Some( { via_user_channel_id_nonref.unwrap().into() }) }; + let mut local_via_user_channel_id_nonref = if via_user_channel_id_nonref.is_none() { crate::c_types::derived::COption_U128Z::None } else { crate::c_types::derived::COption_U128Z::Some( { via_user_channel_id_nonref.unwrap().into() }) }; let mut claim_deadline_nonref = Clone::clone(claim_deadline); let mut local_claim_deadline_nonref = if claim_deadline_nonref.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { claim_deadline_nonref.unwrap() }) }; Event::PaymentClaimable { @@ -1905,22 +2159,28 @@ impl Event { claim_deadline: local_claim_deadline_nonref, } }, - nativeEvent::PaymentClaimed {ref receiver_node_id, ref payment_hash, ref amount_msat, ref purpose, } => { + nativeEvent::PaymentClaimed {ref receiver_node_id, ref payment_hash, ref amount_msat, ref purpose, ref htlcs, ref sender_intended_total_msat, } => { let mut receiver_node_id_nonref = Clone::clone(receiver_node_id); let mut local_receiver_node_id_nonref = if receiver_node_id_nonref.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(receiver_node_id_nonref.unwrap())) } }; let mut payment_hash_nonref = Clone::clone(payment_hash); let mut amount_msat_nonref = Clone::clone(amount_msat); let mut purpose_nonref = Clone::clone(purpose); + let mut htlcs_nonref = Clone::clone(htlcs); + let mut local_htlcs_nonref = Vec::new(); for mut item in htlcs_nonref.drain(..) { local_htlcs_nonref.push( { crate::lightning::events::ClaimedHTLC { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + let mut sender_intended_total_msat_nonref = Clone::clone(sender_intended_total_msat); + let mut local_sender_intended_total_msat_nonref = if sender_intended_total_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { sender_intended_total_msat_nonref.unwrap() }) }; Event::PaymentClaimed { receiver_node_id: local_receiver_node_id_nonref, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, amount_msat: amount_msat_nonref, purpose: crate::lightning::events::PaymentPurpose::native_into(purpose_nonref), + htlcs: local_htlcs_nonref.into(), + sender_intended_total_msat: local_sender_intended_total_msat_nonref, } }, nativeEvent::PaymentSent {ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat, } => { let mut payment_id_nonref = Clone::clone(payment_id); - let mut local_payment_id_nonref = if payment_id_nonref.is_none() { crate::c_types::derived::COption_PaymentIdZ::None } else { crate::c_types::derived::COption_PaymentIdZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.unwrap().0 } }) }; + let mut local_payment_id_nonref = if payment_id_nonref.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.unwrap().0 } }) }; let mut payment_preimage_nonref = Clone::clone(payment_preimage); let mut payment_hash_nonref = Clone::clone(payment_hash); let mut fee_paid_msat_nonref = Clone::clone(fee_paid_msat); @@ -1946,7 +2206,7 @@ impl Event { nativeEvent::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, } => { let mut payment_id_nonref = Clone::clone(payment_id); let mut payment_hash_nonref = Clone::clone(payment_hash); - let mut local_payment_hash_nonref = if payment_hash_nonref.is_none() { crate::c_types::derived::COption_PaymentHashZ::None } else { crate::c_types::derived::COption_PaymentHashZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.unwrap().0 } }) }; + let mut local_payment_hash_nonref = if payment_hash_nonref.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.unwrap().0 } }) }; let mut path_nonref = Clone::clone(path); Event::PaymentPathSuccessful { payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, @@ -1956,7 +2216,7 @@ impl Event { }, nativeEvent::PaymentPathFailed {ref payment_id, ref payment_hash, ref payment_failed_permanently, ref failure, ref path, ref short_channel_id, } => { let mut payment_id_nonref = Clone::clone(payment_id); - let mut local_payment_id_nonref = if payment_id_nonref.is_none() { crate::c_types::derived::COption_PaymentIdZ::None } else { crate::c_types::derived::COption_PaymentIdZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.unwrap().0 } }) }; + let mut local_payment_id_nonref = if payment_id_nonref.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.unwrap().0 } }) }; let mut payment_hash_nonref = Clone::clone(payment_hash); let mut payment_failed_permanently_nonref = Clone::clone(payment_failed_permanently); let mut failure_nonref = Clone::clone(failure); @@ -2015,18 +2275,21 @@ impl Event { expected_outbound_amount_msat: expected_outbound_amount_msat_nonref, } }, - nativeEvent::SpendableOutputs {ref outputs, } => { + nativeEvent::SpendableOutputs {ref outputs, ref channel_id, } => { let mut outputs_nonref = Clone::clone(outputs); let mut local_outputs_nonref = Vec::new(); for mut item in outputs_nonref.drain(..) { local_outputs_nonref.push( { crate::lightning::sign::SpendableOutputDescriptor::native_into(item) }); }; + let mut channel_id_nonref = Clone::clone(channel_id); + let mut local_channel_id_nonref = if channel_id_nonref.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: channel_id_nonref.unwrap().0 } }) }; Event::SpendableOutputs { outputs: local_outputs_nonref.into(), + channel_id: local_channel_id_nonref, } }, nativeEvent::PaymentForwarded {ref prev_channel_id, ref next_channel_id, ref fee_earned_msat, ref claim_from_onchain_tx, ref outbound_amount_forwarded_msat, } => { let mut prev_channel_id_nonref = Clone::clone(prev_channel_id); - let mut local_prev_channel_id_nonref = if prev_channel_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (prev_channel_id_nonref.unwrap()) } } }; + let mut local_prev_channel_id_nonref = if prev_channel_id_nonref.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: prev_channel_id_nonref.unwrap().0 } }) }; let mut next_channel_id_nonref = Clone::clone(next_channel_id); - let mut local_next_channel_id_nonref = if next_channel_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (next_channel_id_nonref.unwrap()) } } }; + let mut local_next_channel_id_nonref = if next_channel_id_nonref.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: next_channel_id_nonref.unwrap().0 } }) }; let mut fee_earned_msat_nonref = Clone::clone(fee_earned_msat); let mut local_fee_earned_msat_nonref = if fee_earned_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { fee_earned_msat_nonref.unwrap() }) }; let mut claim_from_onchain_tx_nonref = Clone::clone(claim_from_onchain_tx); @@ -2044,11 +2307,11 @@ impl Event { let mut channel_id_nonref = Clone::clone(channel_id); let mut user_channel_id_nonref = Clone::clone(user_channel_id); let mut former_temporary_channel_id_nonref = Clone::clone(former_temporary_channel_id); - let mut local_former_temporary_channel_id_nonref = if former_temporary_channel_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (former_temporary_channel_id_nonref.unwrap()) } } }; + let mut local_former_temporary_channel_id_nonref = if former_temporary_channel_id_nonref.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: former_temporary_channel_id_nonref.unwrap().0 } }) }; let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); let mut funding_txo_nonref = Clone::clone(funding_txo); Event::ChannelPending { - channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref }, + channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref.0 }, user_channel_id: user_channel_id_nonref.into(), former_temporary_channel_id: local_former_temporary_channel_id_nonref, counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), @@ -2061,27 +2324,33 @@ impl Event { let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); let mut channel_type_nonref = Clone::clone(channel_type); Event::ChannelReady { - channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref }, + channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref.0 }, user_channel_id: user_channel_id_nonref.into(), counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), channel_type: crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(channel_type_nonref), is_owned: true }, } }, - nativeEvent::ChannelClosed {ref channel_id, ref user_channel_id, ref reason, } => { + nativeEvent::ChannelClosed {ref channel_id, ref user_channel_id, ref reason, ref counterparty_node_id, ref channel_capacity_sats, } => { let mut channel_id_nonref = Clone::clone(channel_id); let mut user_channel_id_nonref = Clone::clone(user_channel_id); let mut reason_nonref = Clone::clone(reason); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut local_counterparty_node_id_nonref = if counterparty_node_id_nonref.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(counterparty_node_id_nonref.unwrap())) } }; + let mut channel_capacity_sats_nonref = Clone::clone(channel_capacity_sats); + let mut local_channel_capacity_sats_nonref = if channel_capacity_sats_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { channel_capacity_sats_nonref.unwrap() }) }; Event::ChannelClosed { - channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref }, + channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref.0 }, user_channel_id: user_channel_id_nonref.into(), reason: crate::lightning::events::ClosureReason::native_into(reason_nonref), + counterparty_node_id: local_counterparty_node_id_nonref, + channel_capacity_sats: local_channel_capacity_sats_nonref, } }, nativeEvent::DiscardFunding {ref channel_id, ref transaction, } => { let mut channel_id_nonref = Clone::clone(channel_id); let mut transaction_nonref = Clone::clone(transaction); Event::DiscardFunding { - channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref }, + channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref.0 }, transaction: crate::c_types::Transaction::from_bitcoin(&transaction_nonref), } }, @@ -2092,7 +2361,7 @@ impl Event { let mut push_msat_nonref = Clone::clone(push_msat); let mut channel_type_nonref = Clone::clone(channel_type); Event::OpenChannelRequest { - temporary_channel_id: crate::c_types::ThirtyTwoBytes { data: temporary_channel_id_nonref }, + temporary_channel_id: crate::c_types::ThirtyTwoBytes { data: temporary_channel_id_nonref.0 }, counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), funding_satoshis: funding_satoshis_nonref, push_msat: push_msat_nonref, @@ -2103,7 +2372,7 @@ impl Event { let mut prev_channel_id_nonref = Clone::clone(prev_channel_id); let mut failed_next_destination_nonref = Clone::clone(failed_next_destination); Event::HTLCHandlingFailed { - prev_channel_id: crate::c_types::ThirtyTwoBytes { data: prev_channel_id_nonref }, + prev_channel_id: crate::c_types::ThirtyTwoBytes { data: prev_channel_id_nonref.0 }, failed_next_destination: crate::lightning::events::HTLCDestination::native_into(failed_next_destination_nonref), } }, @@ -2120,7 +2389,7 @@ impl Event { match native { nativeEvent::FundingGenerationReady {mut temporary_channel_id, mut counterparty_node_id, mut channel_value_satoshis, mut output_script, mut user_channel_id, } => { Event::FundingGenerationReady { - temporary_channel_id: crate::c_types::ThirtyTwoBytes { data: temporary_channel_id }, + temporary_channel_id: crate::c_types::ThirtyTwoBytes { data: temporary_channel_id.0 }, counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), channel_value_satoshis: channel_value_satoshis, output_script: output_script.into_bytes().into(), @@ -2130,8 +2399,8 @@ impl Event { nativeEvent::PaymentClaimable {mut receiver_node_id, mut payment_hash, mut onion_fields, mut amount_msat, mut counterparty_skimmed_fee_msat, mut purpose, mut via_channel_id, mut via_user_channel_id, mut claim_deadline, } => { let mut local_receiver_node_id = if receiver_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(receiver_node_id.unwrap())) } }; let mut local_onion_fields = crate::lightning::ln::outbound_payment::RecipientOnionFields { inner: if onion_fields.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((onion_fields.unwrap())) } }, is_owned: true }; - let mut local_via_channel_id = if via_channel_id.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (via_channel_id.unwrap()) } } }; - let mut local_via_user_channel_id = if via_user_channel_id.is_none() { crate::c_types::derived::COption_u128Z::None } else { crate::c_types::derived::COption_u128Z::Some( { via_user_channel_id.unwrap().into() }) }; + let mut local_via_channel_id = if via_channel_id.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: via_channel_id.unwrap().0 } }) }; + let mut local_via_user_channel_id = if via_user_channel_id.is_none() { crate::c_types::derived::COption_U128Z::None } else { crate::c_types::derived::COption_U128Z::Some( { via_user_channel_id.unwrap().into() }) }; let mut local_claim_deadline = if claim_deadline.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { claim_deadline.unwrap() }) }; Event::PaymentClaimable { receiver_node_id: local_receiver_node_id, @@ -2145,17 +2414,21 @@ impl Event { claim_deadline: local_claim_deadline, } }, - nativeEvent::PaymentClaimed {mut receiver_node_id, mut payment_hash, mut amount_msat, mut purpose, } => { + nativeEvent::PaymentClaimed {mut receiver_node_id, mut payment_hash, mut amount_msat, mut purpose, mut htlcs, mut sender_intended_total_msat, } => { let mut local_receiver_node_id = if receiver_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(receiver_node_id.unwrap())) } }; + let mut local_htlcs = Vec::new(); for mut item in htlcs.drain(..) { local_htlcs.push( { crate::lightning::events::ClaimedHTLC { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + let mut local_sender_intended_total_msat = if sender_intended_total_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { sender_intended_total_msat.unwrap() }) }; Event::PaymentClaimed { receiver_node_id: local_receiver_node_id, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, amount_msat: amount_msat, purpose: crate::lightning::events::PaymentPurpose::native_into(purpose), + htlcs: local_htlcs.into(), + sender_intended_total_msat: local_sender_intended_total_msat, } }, nativeEvent::PaymentSent {mut payment_id, mut payment_preimage, mut payment_hash, mut fee_paid_msat, } => { - let mut local_payment_id = if payment_id.is_none() { crate::c_types::derived::COption_PaymentIdZ::None } else { crate::c_types::derived::COption_PaymentIdZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id.unwrap().0 } }) }; + let mut local_payment_id = if payment_id.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id.unwrap().0 } }) }; let mut local_fee_paid_msat = if fee_paid_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { fee_paid_msat.unwrap() }) }; Event::PaymentSent { payment_id: local_payment_id, @@ -2173,7 +2446,7 @@ impl Event { } }, nativeEvent::PaymentPathSuccessful {mut payment_id, mut payment_hash, mut path, } => { - let mut local_payment_hash = if payment_hash.is_none() { crate::c_types::derived::COption_PaymentHashZ::None } else { crate::c_types::derived::COption_PaymentHashZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_hash.unwrap().0 } }) }; + let mut local_payment_hash = if payment_hash.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_hash.unwrap().0 } }) }; Event::PaymentPathSuccessful { payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 }, payment_hash: local_payment_hash, @@ -2181,7 +2454,7 @@ impl Event { } }, nativeEvent::PaymentPathFailed {mut payment_id, mut payment_hash, mut payment_failed_permanently, mut failure, mut path, mut short_channel_id, } => { - let mut local_payment_id = if payment_id.is_none() { crate::c_types::derived::COption_PaymentIdZ::None } else { crate::c_types::derived::COption_PaymentIdZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id.unwrap().0 } }) }; + let mut local_payment_id = if payment_id.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id.unwrap().0 } }) }; let mut local_short_channel_id = if short_channel_id.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { short_channel_id.unwrap() }) }; Event::PaymentPathFailed { payment_id: local_payment_id, @@ -2222,15 +2495,17 @@ impl Event { expected_outbound_amount_msat: expected_outbound_amount_msat, } }, - nativeEvent::SpendableOutputs {mut outputs, } => { + nativeEvent::SpendableOutputs {mut outputs, mut channel_id, } => { let mut local_outputs = Vec::new(); for mut item in outputs.drain(..) { local_outputs.push( { crate::lightning::sign::SpendableOutputDescriptor::native_into(item) }); }; + let mut local_channel_id = if channel_id.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: channel_id.unwrap().0 } }) }; Event::SpendableOutputs { outputs: local_outputs.into(), + channel_id: local_channel_id, } }, nativeEvent::PaymentForwarded {mut prev_channel_id, mut next_channel_id, mut fee_earned_msat, mut claim_from_onchain_tx, mut outbound_amount_forwarded_msat, } => { - let mut local_prev_channel_id = if prev_channel_id.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (prev_channel_id.unwrap()) } } }; - let mut local_next_channel_id = if next_channel_id.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (next_channel_id.unwrap()) } } }; + let mut local_prev_channel_id = if prev_channel_id.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: prev_channel_id.unwrap().0 } }) }; + let mut local_next_channel_id = if next_channel_id.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: next_channel_id.unwrap().0 } }) }; let mut local_fee_earned_msat = if fee_earned_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { fee_earned_msat.unwrap() }) }; let mut local_outbound_amount_forwarded_msat = if outbound_amount_forwarded_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { outbound_amount_forwarded_msat.unwrap() }) }; Event::PaymentForwarded { @@ -2242,9 +2517,9 @@ impl Event { } }, nativeEvent::ChannelPending {mut channel_id, mut user_channel_id, mut former_temporary_channel_id, mut counterparty_node_id, mut funding_txo, } => { - let mut local_former_temporary_channel_id = if former_temporary_channel_id.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (former_temporary_channel_id.unwrap()) } } }; + let mut local_former_temporary_channel_id = if former_temporary_channel_id.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: former_temporary_channel_id.unwrap().0 } }) }; Event::ChannelPending { - channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id }, + channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id.0 }, user_channel_id: user_channel_id.into(), former_temporary_channel_id: local_former_temporary_channel_id, counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), @@ -2253,28 +2528,32 @@ impl Event { }, nativeEvent::ChannelReady {mut channel_id, mut user_channel_id, mut counterparty_node_id, mut channel_type, } => { Event::ChannelReady { - channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id }, + channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id.0 }, user_channel_id: user_channel_id.into(), counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), channel_type: crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(channel_type), is_owned: true }, } }, - nativeEvent::ChannelClosed {mut channel_id, mut user_channel_id, mut reason, } => { + nativeEvent::ChannelClosed {mut channel_id, mut user_channel_id, mut reason, mut counterparty_node_id, mut channel_capacity_sats, } => { + let mut local_counterparty_node_id = if counterparty_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(counterparty_node_id.unwrap())) } }; + let mut local_channel_capacity_sats = if channel_capacity_sats.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { channel_capacity_sats.unwrap() }) }; Event::ChannelClosed { - channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id }, + channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id.0 }, user_channel_id: user_channel_id.into(), reason: crate::lightning::events::ClosureReason::native_into(reason), + counterparty_node_id: local_counterparty_node_id, + channel_capacity_sats: local_channel_capacity_sats, } }, nativeEvent::DiscardFunding {mut channel_id, mut transaction, } => { Event::DiscardFunding { - channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id }, + channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id.0 }, transaction: crate::c_types::Transaction::from_bitcoin(&transaction), } }, nativeEvent::OpenChannelRequest {mut temporary_channel_id, mut counterparty_node_id, mut funding_satoshis, mut push_msat, mut channel_type, } => { Event::OpenChannelRequest { - temporary_channel_id: crate::c_types::ThirtyTwoBytes { data: temporary_channel_id }, + temporary_channel_id: crate::c_types::ThirtyTwoBytes { data: temporary_channel_id.0 }, counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), funding_satoshis: funding_satoshis, push_msat: push_msat, @@ -2283,7 +2562,7 @@ impl Event { }, nativeEvent::HTLCHandlingFailed {mut prev_channel_id, mut failed_next_destination, } => { Event::HTLCHandlingFailed { - prev_channel_id: crate::c_types::ThirtyTwoBytes { data: prev_channel_id }, + prev_channel_id: crate::c_types::ThirtyTwoBytes { data: prev_channel_id.0 }, failed_next_destination: crate::lightning::events::HTLCDestination::native_into(failed_next_destination), } }, @@ -2316,7 +2595,7 @@ pub extern "C" fn Event_funding_generation_ready(temporary_channel_id: crate::c_ } #[no_mangle] /// Utility method to constructs a new PaymentClaimable-variant Event -pub extern "C" fn Event_payment_claimable(receiver_node_id: crate::c_types::PublicKey, payment_hash: crate::c_types::ThirtyTwoBytes, onion_fields: crate::lightning::ln::outbound_payment::RecipientOnionFields, amount_msat: u64, counterparty_skimmed_fee_msat: u64, purpose: crate::lightning::events::PaymentPurpose, via_channel_id: crate::c_types::ThirtyTwoBytes, via_user_channel_id: crate::c_types::derived::COption_u128Z, claim_deadline: crate::c_types::derived::COption_u32Z) -> Event { +pub extern "C" fn Event_payment_claimable(receiver_node_id: crate::c_types::PublicKey, payment_hash: crate::c_types::ThirtyTwoBytes, onion_fields: crate::lightning::ln::outbound_payment::RecipientOnionFields, amount_msat: u64, counterparty_skimmed_fee_msat: u64, purpose: crate::lightning::events::PaymentPurpose, via_channel_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, via_user_channel_id: crate::c_types::derived::COption_U128Z, claim_deadline: crate::c_types::derived::COption_u32Z) -> Event { Event::PaymentClaimable { receiver_node_id, payment_hash, @@ -2331,17 +2610,19 @@ pub extern "C" fn Event_payment_claimable(receiver_node_id: crate::c_types::Publ } #[no_mangle] /// Utility method to constructs a new PaymentClaimed-variant Event -pub extern "C" fn Event_payment_claimed(receiver_node_id: crate::c_types::PublicKey, payment_hash: crate::c_types::ThirtyTwoBytes, amount_msat: u64, purpose: crate::lightning::events::PaymentPurpose) -> Event { +pub extern "C" fn Event_payment_claimed(receiver_node_id: crate::c_types::PublicKey, payment_hash: crate::c_types::ThirtyTwoBytes, amount_msat: u64, purpose: crate::lightning::events::PaymentPurpose, htlcs: crate::c_types::derived::CVec_ClaimedHTLCZ, sender_intended_total_msat: crate::c_types::derived::COption_u64Z) -> Event { Event::PaymentClaimed { receiver_node_id, payment_hash, amount_msat, purpose, + htlcs, + sender_intended_total_msat, } } #[no_mangle] /// Utility method to constructs a new PaymentSent-variant Event -pub extern "C" fn Event_payment_sent(payment_id: crate::c_types::derived::COption_PaymentIdZ, payment_preimage: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes, fee_paid_msat: crate::c_types::derived::COption_u64Z) -> Event { +pub extern "C" fn Event_payment_sent(payment_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, payment_preimage: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes, fee_paid_msat: crate::c_types::derived::COption_u64Z) -> Event { Event::PaymentSent { payment_id, payment_preimage, @@ -2360,7 +2641,7 @@ pub extern "C" fn Event_payment_failed(payment_id: crate::c_types::ThirtyTwoByte } #[no_mangle] /// Utility method to constructs a new PaymentPathSuccessful-variant Event -pub extern "C" fn Event_payment_path_successful(payment_id: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::derived::COption_PaymentHashZ, path: crate::lightning::routing::router::Path) -> Event { +pub extern "C" fn Event_payment_path_successful(payment_id: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::derived::COption_ThirtyTwoBytesZ, path: crate::lightning::routing::router::Path) -> Event { Event::PaymentPathSuccessful { payment_id, payment_hash, @@ -2369,7 +2650,7 @@ pub extern "C" fn Event_payment_path_successful(payment_id: crate::c_types::Thir } #[no_mangle] /// Utility method to constructs a new PaymentPathFailed-variant Event -pub extern "C" fn Event_payment_path_failed(payment_id: crate::c_types::derived::COption_PaymentIdZ, payment_hash: crate::c_types::ThirtyTwoBytes, payment_failed_permanently: bool, failure: crate::lightning::events::PathFailure, path: crate::lightning::routing::router::Path, short_channel_id: crate::c_types::derived::COption_u64Z) -> Event { +pub extern "C" fn Event_payment_path_failed(payment_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, payment_hash: crate::c_types::ThirtyTwoBytes, payment_failed_permanently: bool, failure: crate::lightning::events::PathFailure, path: crate::lightning::routing::router::Path, short_channel_id: crate::c_types::derived::COption_u64Z) -> Event { Event::PaymentPathFailed { payment_id, payment_hash, @@ -2418,14 +2699,15 @@ pub extern "C" fn Event_htlcintercepted(intercept_id: crate::c_types::ThirtyTwoB } #[no_mangle] /// Utility method to constructs a new SpendableOutputs-variant Event -pub extern "C" fn Event_spendable_outputs(outputs: crate::c_types::derived::CVec_SpendableOutputDescriptorZ) -> Event { +pub extern "C" fn Event_spendable_outputs(outputs: crate::c_types::derived::CVec_SpendableOutputDescriptorZ, channel_id: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> Event { Event::SpendableOutputs { outputs, + channel_id, } } #[no_mangle] /// Utility method to constructs a new PaymentForwarded-variant Event -pub extern "C" fn Event_payment_forwarded(prev_channel_id: crate::c_types::ThirtyTwoBytes, next_channel_id: crate::c_types::ThirtyTwoBytes, fee_earned_msat: crate::c_types::derived::COption_u64Z, claim_from_onchain_tx: bool, outbound_amount_forwarded_msat: crate::c_types::derived::COption_u64Z) -> Event { +pub extern "C" fn Event_payment_forwarded(prev_channel_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, next_channel_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, fee_earned_msat: crate::c_types::derived::COption_u64Z, claim_from_onchain_tx: bool, outbound_amount_forwarded_msat: crate::c_types::derived::COption_u64Z) -> Event { Event::PaymentForwarded { prev_channel_id, next_channel_id, @@ -2436,7 +2718,7 @@ pub extern "C" fn Event_payment_forwarded(prev_channel_id: crate::c_types::Thirt } #[no_mangle] /// Utility method to constructs a new ChannelPending-variant Event -pub extern "C" fn Event_channel_pending(channel_id: crate::c_types::ThirtyTwoBytes, user_channel_id: crate::c_types::U128, former_temporary_channel_id: crate::c_types::ThirtyTwoBytes, counterparty_node_id: crate::c_types::PublicKey, funding_txo: crate::lightning::chain::transaction::OutPoint) -> Event { +pub extern "C" fn Event_channel_pending(channel_id: crate::c_types::ThirtyTwoBytes, user_channel_id: crate::c_types::U128, former_temporary_channel_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, counterparty_node_id: crate::c_types::PublicKey, funding_txo: crate::lightning::chain::transaction::OutPoint) -> Event { Event::ChannelPending { channel_id, user_channel_id, @@ -2457,11 +2739,13 @@ pub extern "C" fn Event_channel_ready(channel_id: crate::c_types::ThirtyTwoBytes } #[no_mangle] /// Utility method to constructs a new ChannelClosed-variant Event -pub extern "C" fn Event_channel_closed(channel_id: crate::c_types::ThirtyTwoBytes, user_channel_id: crate::c_types::U128, reason: crate::lightning::events::ClosureReason) -> Event { +pub extern "C" fn Event_channel_closed(channel_id: crate::c_types::ThirtyTwoBytes, user_channel_id: crate::c_types::U128, reason: crate::lightning::events::ClosureReason, counterparty_node_id: crate::c_types::PublicKey, channel_capacity_sats: crate::c_types::derived::COption_u64Z) -> Event { Event::ChannelClosed { channel_id, user_channel_id, reason, + counterparty_node_id, + channel_capacity_sats, } } #[no_mangle] @@ -2628,7 +2912,7 @@ pub enum MessageSendEvent { /// The node_id of the node which should receive this message node_id: crate::c_types::PublicKey, /// The message which should be sent. - msg: crate::lightning::ln::msgs::TxAddInput, + msg: crate::lightning::ln::msgs::TxAbort, }, /// Used to indicate that a channel_ready message should be sent to the peer with the given node_id. SendChannelReady { @@ -3347,7 +3631,7 @@ impl MessageSendEvent { let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendTxAbort { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::TxAddInput { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + msg: crate::lightning::ln::msgs::TxAbort { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendChannelReady {ref node_id, ref msg, } => { @@ -3577,7 +3861,7 @@ impl MessageSendEvent { nativeMessageSendEvent::SendTxAbort {mut node_id, mut msg, } => { MessageSendEvent::SendTxAbort { node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::TxAddInput { inner: ObjOps::heap_alloc(msg), is_owned: true }, + msg: crate::lightning::ln::msgs::TxAbort { inner: ObjOps::heap_alloc(msg), is_owned: true }, } }, nativeMessageSendEvent::SendChannelReady {mut node_id, mut msg, } => { @@ -3807,7 +4091,7 @@ pub extern "C" fn MessageSendEvent_send_tx_ack_rbf(node_id: crate::c_types::Publ } #[no_mangle] /// Utility method to constructs a new SendTxAbort-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_tx_abort(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxAddInput) -> MessageSendEvent { +pub extern "C" fn MessageSendEvent_send_tx_abort(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxAbort) -> MessageSendEvent { MessageSendEvent::SendTxAbort { node_id, msg, @@ -3963,8 +4247,7 @@ pub struct MessageSendEventsProvider { } unsafe impl Send for MessageSendEventsProvider {} unsafe impl Sync for MessageSendEventsProvider {} -#[no_mangle] -pub(crate) extern "C" fn MessageSendEventsProvider_clone_fields(orig: &MessageSendEventsProvider) -> MessageSendEventsProvider { +pub(crate) fn MessageSendEventsProvider_clone_fields(orig: &MessageSendEventsProvider) -> MessageSendEventsProvider { MessageSendEventsProvider { this_arg: orig.this_arg, get_and_clear_pending_msg_events: Clone::clone(&orig.get_and_clear_pending_msg_events), @@ -3989,6 +4272,11 @@ impl core::ops::Deref for MessageSendEventsProvider { self } } +impl core::ops::DerefMut for MessageSendEventsProvider { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn MessageSendEventsProvider_free(this_ptr: MessageSendEventsProvider) { } @@ -4015,8 +4303,7 @@ pub struct OnionMessageProvider { } unsafe impl Send for OnionMessageProvider {} unsafe impl Sync for OnionMessageProvider {} -#[no_mangle] -pub(crate) extern "C" fn OnionMessageProvider_clone_fields(orig: &OnionMessageProvider) -> OnionMessageProvider { +pub(crate) fn OnionMessageProvider_clone_fields(orig: &OnionMessageProvider) -> OnionMessageProvider { OnionMessageProvider { this_arg: orig.this_arg, next_onion_message_for_peer: Clone::clone(&orig.next_onion_message_for_peer), @@ -4041,6 +4328,11 @@ impl core::ops::Deref for OnionMessageProvider { self } } +impl core::ops::DerefMut for OnionMessageProvider { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn OnionMessageProvider_free(this_ptr: OnionMessageProvider) { } @@ -4102,8 +4394,7 @@ pub struct EventsProvider { } unsafe impl Send for EventsProvider {} unsafe impl Sync for EventsProvider {} -#[no_mangle] -pub(crate) extern "C" fn EventsProvider_clone_fields(orig: &EventsProvider) -> EventsProvider { +pub(crate) fn EventsProvider_clone_fields(orig: &EventsProvider) -> EventsProvider { EventsProvider { this_arg: orig.this_arg, process_pending_events: Clone::clone(&orig.process_pending_events), @@ -4142,8 +4433,7 @@ pub struct EventHandler { } unsafe impl Send for EventHandler {} unsafe impl Sync for EventHandler {} -#[no_mangle] -pub(crate) extern "C" fn EventHandler_clone_fields(orig: &EventHandler) -> EventHandler { +pub(crate) fn EventHandler_clone_fields(orig: &EventHandler) -> EventHandler { EventHandler { this_arg: orig.this_arg, handle_event: Clone::clone(&orig.handle_event), @@ -4166,6 +4456,11 @@ impl core::ops::Deref for EventHandler { self } } +impl core::ops::DerefMut for EventHandler { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn EventHandler_free(this_ptr: EventHandler) { } diff --git a/lightning-c-bindings/src/lightning/ln/chan_utils.rs b/lightning-c-bindings/src/lightning/ln/chan_utils.rs index b6a68d66..15f1135e 100644 --- a/lightning-c-bindings/src/lightning/ln/chan_utils.rs +++ b/lightning-c-bindings/src/lightning/ln/chan_utils.rs @@ -10,6 +10,7 @@ //! largely of interest for those implementing the traits on [`crate::sign`] by hand. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -684,6 +685,16 @@ pub(crate) extern "C" fn ChannelPublicKeys_clone_void(this_ptr: *const c_void) - pub extern "C" fn ChannelPublicKeys_clone(orig: &ChannelPublicKeys) -> ChannelPublicKeys { orig.clone() } +/// Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys. +#[no_mangle] +pub extern "C" fn ChannelPublicKeys_hash(o: &ChannelPublicKeys) -> u64 { + if o.inner.is_null() { return 0; } + // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core + #[allow(deprecated)] + let mut hasher = core::hash::SipHasher::new(); + core::hash::Hash::hash(o.get_native_ref(), &mut hasher); + core::hash::Hasher::finish(&hasher) +} /// Checks if two ChannelPublicKeyss contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. /// Two objects with NULL inner values will be considered "equal" here. @@ -740,6 +751,14 @@ pub extern "C" fn get_revokeable_redeemscript(mut revocation_key: crate::c_types ret.into_bytes().into() } +/// Returns the script for the counterparty's output on a holder's commitment transaction based on +/// the channel type. +#[no_mangle] +pub extern "C" fn get_counterparty_payment_script(channel_type_features: &crate::lightning::ln::features::ChannelTypeFeatures, mut payment_key: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z { + let mut ret = lightning::ln::chan_utils::get_counterparty_payment_script(channel_type_features.get_native_ref(), &payment_key.into_rust()); + ret.into_bytes().into() +} + use lightning::ln::chan_utils::HTLCOutputInCommitment as nativeHTLCOutputInCommitmentImport; pub(crate) type nativeHTLCOutputInCommitment = nativeHTLCOutputInCommitmentImport; @@ -948,7 +967,7 @@ pub extern "C" fn build_htlc_transaction(commitment_txid: *const [u8; 32], mut f /// Returns the witness required to satisfy and spend a HTLC input. #[no_mangle] -pub extern "C" fn build_htlc_input_witness(mut local_sig: crate::c_types::Signature, mut remote_sig: crate::c_types::Signature, mut preimage: crate::c_types::derived::COption_PaymentPreimageZ, mut redeem_script: crate::c_types::u8slice, channel_type_features: &crate::lightning::ln::features::ChannelTypeFeatures) -> crate::c_types::Witness { +pub extern "C" fn build_htlc_input_witness(mut local_sig: crate::c_types::ECDSASignature, mut remote_sig: crate::c_types::ECDSASignature, mut preimage: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut redeem_script: crate::c_types::u8slice, channel_type_features: &crate::lightning::ln::features::ChannelTypeFeatures) -> crate::c_types::Witness { let mut local_preimage = { /*preimage*/ let preimage_opt = preimage; if preimage_opt.is_none() { None } else { Some({ { ::lightning::ln::PaymentPreimage({ preimage_opt.take() }.data) }})} }; let mut ret = lightning::ln::chan_utils::build_htlc_input_witness(&local_sig.into_rust(), &remote_sig.into_rust(), &local_preimage, &::bitcoin::blockdata::script::Script::from(Vec::from(redeem_script.to_slice())), channel_type_features.get_native_ref()); crate::c_types::Witness::from_bitcoin(&ret) @@ -975,7 +994,7 @@ pub extern "C" fn get_anchor_redeemscript(mut funding_pubkey: crate::c_types::Pu /// Returns the witness required to satisfy and spend an anchor input. #[no_mangle] -pub extern "C" fn build_anchor_input_witness(mut funding_key: crate::c_types::PublicKey, mut funding_sig: crate::c_types::Signature) -> crate::c_types::Witness { +pub extern "C" fn build_anchor_input_witness(mut funding_key: crate::c_types::PublicKey, mut funding_sig: crate::c_types::ECDSASignature) -> crate::c_types::Witness { let mut ret = lightning::ln::chan_utils::build_anchor_input_witness(&funding_key.into_rust(), &funding_sig.into_rust()); crate::c_types::Witness::from_bitcoin(&ret) } @@ -1120,6 +1139,9 @@ pub extern "C" fn ChannelTransactionParameters_set_channel_type_features(this_pt unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_type_features = *unsafe { Box::from_raw(val.take_inner()) }; } /// Constructs a new ChannelTransactionParameters given each field +/// +/// Note that counterparty_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None +/// Note that funding_outpoint_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] pub extern "C" fn ChannelTransactionParameters_new(mut holder_pubkeys_arg: crate::lightning::ln::chan_utils::ChannelPublicKeys, mut holder_selected_contest_delay_arg: u16, mut is_outbound_from_holder_arg: bool, mut counterparty_parameters_arg: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, mut funding_outpoint_arg: crate::lightning::chain::transaction::OutPoint, mut channel_type_features_arg: crate::lightning::ln::features::ChannelTypeFeatures) -> ChannelTransactionParameters { @@ -1153,6 +1175,16 @@ pub(crate) extern "C" fn ChannelTransactionParameters_clone_void(this_ptr: *cons pub extern "C" fn ChannelTransactionParameters_clone(orig: &ChannelTransactionParameters) -> ChannelTransactionParameters { orig.clone() } +/// Generates a non-cryptographic 64-bit hash of the ChannelTransactionParameters. +#[no_mangle] +pub extern "C" fn ChannelTransactionParameters_hash(o: &ChannelTransactionParameters) -> u64 { + if o.inner.is_null() { return 0; } + // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core + #[allow(deprecated)] + let mut hasher = core::hash::SipHasher::new(); + core::hash::Hash::hash(o.get_native_ref(), &mut hasher); + core::hash::Hasher::finish(&hasher) +} /// Checks if two ChannelTransactionParameterss contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. /// Two objects with NULL inner values will be considered "equal" here. @@ -1263,6 +1295,16 @@ pub(crate) extern "C" fn CounterpartyChannelTransactionParameters_clone_void(thi pub extern "C" fn CounterpartyChannelTransactionParameters_clone(orig: &CounterpartyChannelTransactionParameters) -> CounterpartyChannelTransactionParameters { orig.clone() } +/// Generates a non-cryptographic 64-bit hash of the CounterpartyChannelTransactionParameters. +#[no_mangle] +pub extern "C" fn CounterpartyChannelTransactionParameters_hash(o: &CounterpartyChannelTransactionParameters) -> u64 { + if o.inner.is_null() { return 0; } + // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core + #[allow(deprecated)] + let mut hasher = core::hash::SipHasher::new(); + core::hash::Hash::hash(o.get_native_ref(), &mut hasher); + core::hash::Hasher::finish(&hasher) +} /// Checks if two CounterpartyChannelTransactionParameterss contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. /// Two objects with NULL inner values will be considered "equal" here. @@ -1496,27 +1538,27 @@ impl HolderCommitmentTransaction { } /// Our counterparty's signature for the transaction #[no_mangle] -pub extern "C" fn HolderCommitmentTransaction_get_counterparty_sig(this_ptr: &HolderCommitmentTransaction) -> crate::c_types::Signature { +pub extern "C" fn HolderCommitmentTransaction_get_counterparty_sig(this_ptr: &HolderCommitmentTransaction) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty_sig; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// Our counterparty's signature for the transaction #[no_mangle] -pub extern "C" fn HolderCommitmentTransaction_set_counterparty_sig(this_ptr: &mut HolderCommitmentTransaction, mut val: crate::c_types::Signature) { +pub extern "C" fn HolderCommitmentTransaction_set_counterparty_sig(this_ptr: &mut HolderCommitmentTransaction, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.counterparty_sig = val.into_rust(); } /// All non-dust counterparty HTLC signatures, in the order they appear in the transaction /// /// Returns a copy of the field. #[no_mangle] -pub extern "C" fn HolderCommitmentTransaction_get_counterparty_htlc_sigs(this_ptr: &HolderCommitmentTransaction) -> crate::c_types::derived::CVec_SignatureZ { +pub extern "C" fn HolderCommitmentTransaction_get_counterparty_htlc_sigs(this_ptr: &HolderCommitmentTransaction) -> crate::c_types::derived::CVec_ECDSASignatureZ { let mut inner_val = this_ptr.get_native_mut_ref().counterparty_htlc_sigs.clone(); - let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { crate::c_types::Signature::from_rust(&item) }); }; + let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { crate::c_types::ECDSASignature::from_rust(&item) }); }; local_inner_val.into() } /// All non-dust counterparty HTLC signatures, in the order they appear in the transaction #[no_mangle] -pub extern "C" fn HolderCommitmentTransaction_set_counterparty_htlc_sigs(this_ptr: &mut HolderCommitmentTransaction, mut val: crate::c_types::derived::CVec_SignatureZ) { +pub extern "C" fn HolderCommitmentTransaction_set_counterparty_htlc_sigs(this_ptr: &mut HolderCommitmentTransaction, mut val: crate::c_types::derived::CVec_ECDSASignatureZ) { let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_rust() }); }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.counterparty_htlc_sigs = local_val; } @@ -1559,7 +1601,7 @@ 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) -> crate::lightning::ln::chan_utils::HolderCommitmentTransaction { +pub extern "C" fn HolderCommitmentTransaction_new(mut commitment_tx: crate::lightning::ln::chan_utils::CommitmentTransaction, mut counterparty_sig: crate::c_types::ECDSASignature, mut counterparty_htlc_sigs: crate::c_types::derived::CVec_ECDSASignatureZ, 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()); crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: ObjOps::heap_alloc(ret), is_owned: true } @@ -1701,17 +1743,17 @@ pub extern "C" fn BuiltCommitmentTransaction_get_sighash_all(this_arg: &crate::l /// Signs the counterparty's commitment transaction. #[must_use] #[no_mangle] -pub extern "C" fn BuiltCommitmentTransaction_sign_counterparty_commitment(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 { +pub extern "C" fn BuiltCommitmentTransaction_sign_counterparty_commitment(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::ECDSASignature { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_counterparty_commitment(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis, secp256k1::global::SECP256K1); - crate::c_types::Signature::from_rust(&ret) + crate::c_types::ECDSASignature::from_rust(&ret) } /// Signs the holder commitment transaction because we are about to broadcast it. #[must_use] #[no_mangle] -pub extern "C" fn BuiltCommitmentTransaction_sign_holder_commitment(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, entropy_source: &crate::lightning::sign::EntropySource) -> crate::c_types::Signature { +pub extern "C" fn BuiltCommitmentTransaction_sign_holder_commitment(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, entropy_source: &crate::lightning::sign::EntropySource) -> crate::c_types::ECDSASignature { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_holder_commitment(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis, entropy_source, secp256k1::global::SECP256K1); - crate::c_types::Signature::from_rust(&ret) + crate::c_types::ECDSASignature::from_rust(&ret) } @@ -1952,9 +1994,9 @@ pub extern "C" fn TrustedClosingTransaction_get_sighash_all(this_arg: &crate::li /// because we are about to broadcast a holder transaction. #[must_use] #[no_mangle] -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 { +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::ECDSASignature { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *funding_key}[..]).unwrap(), &::bitcoin::blockdata::script::Script::from(Vec::from(funding_redeemscript.to_slice())), channel_value_satoshis, secp256k1::global::SECP256K1); - crate::c_types::Signature::from_rust(&ret) + crate::c_types::ECDSASignature::from_rust(&ret) } @@ -2203,9 +2245,45 @@ pub extern "C" fn TrustedCommitmentTransaction_channel_type_features(this_arg: & /// This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All. #[must_use] #[no_mangle] -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, entropy_source: &crate::lightning::sign::EntropySource) -> 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, entropy_source: &crate::lightning::sign::EntropySource) -> crate::c_types::derived::CResult_CVec_ECDSASignatureZNoneZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_htlc_sigs(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *htlc_base_key}[..]).unwrap(), channel_parameters.get_native_ref(), entropy_source, secp256k1::global::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() }; + 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::ECDSASignature::from_rust(&item) }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Returns the index of the revokeable output, i.e. the `to_local` output sending funds to +/// the broadcaster, in the built transaction, if any exists. +/// +/// There are two cases where this may return `None`: +/// - The balance of the revokeable output is below the dust limit (only found on commitments +/// early in the channel's lifetime, i.e. before the channel reserve is met). +/// - This commitment was created before LDK 0.0.117. In this case, the +/// commitment transaction previously didn't contain enough information to locate the +/// revokeable output. +#[must_use] +#[no_mangle] +pub extern "C" fn TrustedCommitmentTransaction_revokeable_output_index(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> crate::c_types::derived::COption_usizeZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.revokeable_output_index(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_usizeZ::None } else { crate::c_types::derived::COption_usizeZ::Some( { ret.unwrap() }) }; + local_ret +} + +/// Helper method to build an unsigned justice transaction spending the revokeable +/// `to_local` output to a destination script. Fee estimation accounts for the expected +/// revocation witness data that will be added when signed. +/// +/// This method will error if the given fee rate results in a fee greater than the value +/// of the output being spent, or if there exists no revokeable `to_local` output on this +/// commitment transaction. See [`Self::revokeable_output_index`] for more details. +/// +/// The built transaction will allow fee bumping with RBF, and this method takes +/// `feerate_per_kw` as an input such that multiple copies of a justice transaction at different +/// fee rates may be built. +#[must_use] +#[no_mangle] +pub extern "C" fn TrustedCommitmentTransaction_build_to_local_justice_tx(this_arg: &crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, mut feerate_per_kw: u64, mut destination_script: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_TransactionNoneZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.build_to_local_justice_tx(feerate_per_kw, ::bitcoin::blockdata::script::Script::from(destination_script.into_rust())); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Transaction::from_bitcoin(&o) }).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 051661db..54ec0d58 100644 --- a/lightning-c-bindings/src/lightning/ln/channelmanager.rs +++ b/lightning-c-bindings/src/lightning/ln/channelmanager.rs @@ -17,6 +17,7 @@ //! imply it needs to fail HTLCs/payments/channels it manages). use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -43,6 +44,13 @@ pub enum FailureCode { /// Using this failure code in [`ChannelManager::fail_htlc_backwards_with_reason`] is /// equivalent to calling [`ChannelManager::fail_htlc_backwards`]. IncorrectOrUnknownPaymentDetails, + /// We failed to process the payload after the onion was decrypted. You may wish to + /// use this when receiving custom HTLC TLVs with even type numbers that you don't recognize. + /// + /// If available, the tuple data may include the type number and byte offset in the + /// decrypted byte stream where the failure occurred. + InvalidOnionPayload( + crate::c_types::derived::COption_C2Tuple_u64u16ZZ), } use lightning::ln::channelmanager::FailureCode as FailureCodeImport; pub(crate) type nativeFailureCode = FailureCodeImport; @@ -54,6 +62,13 @@ impl FailureCode { FailureCode::TemporaryNodeFailure => nativeFailureCode::TemporaryNodeFailure, FailureCode::RequiredNodeFeatureMissing => nativeFailureCode::RequiredNodeFeatureMissing, FailureCode::IncorrectOrUnknownPaymentDetails => nativeFailureCode::IncorrectOrUnknownPaymentDetails, + FailureCode::InvalidOnionPayload (ref a, ) => { + let mut a_nonref = Clone::clone(a); + let mut local_a_nonref = if a_nonref.is_some() { Some( { let (mut orig_a_nonref_0_0, mut orig_a_nonref_0_1) = a_nonref.take().to_rust(); let mut local_a_nonref_0 = (orig_a_nonref_0_0, orig_a_nonref_0_1); local_a_nonref_0 }) } else { None }; + nativeFailureCode::InvalidOnionPayload ( + local_a_nonref, + ) + }, } } #[allow(unused)] @@ -62,6 +77,12 @@ impl FailureCode { FailureCode::TemporaryNodeFailure => nativeFailureCode::TemporaryNodeFailure, FailureCode::RequiredNodeFeatureMissing => nativeFailureCode::RequiredNodeFeatureMissing, FailureCode::IncorrectOrUnknownPaymentDetails => nativeFailureCode::IncorrectOrUnknownPaymentDetails, + FailureCode::InvalidOnionPayload (mut a, ) => { + let mut local_a = if a.is_some() { Some( { let (mut orig_a_0_0, mut orig_a_0_1) = a.take().to_rust(); let mut local_a_0 = (orig_a_0_0, orig_a_0_1); local_a_0 }) } else { None }; + nativeFailureCode::InvalidOnionPayload ( + local_a, + ) + }, } } #[allow(unused)] @@ -70,6 +91,13 @@ impl FailureCode { nativeFailureCode::TemporaryNodeFailure => FailureCode::TemporaryNodeFailure, nativeFailureCode::RequiredNodeFeatureMissing => FailureCode::RequiredNodeFeatureMissing, nativeFailureCode::IncorrectOrUnknownPaymentDetails => FailureCode::IncorrectOrUnknownPaymentDetails, + nativeFailureCode::InvalidOnionPayload (ref a, ) => { + let mut a_nonref = Clone::clone(a); + let mut local_a_nonref = if a_nonref.is_none() { crate::c_types::derived::COption_C2Tuple_u64u16ZZ::None } else { crate::c_types::derived::COption_C2Tuple_u64u16ZZ::Some( { let (mut orig_a_nonref_0_0, mut orig_a_nonref_0_1) = (a_nonref.unwrap()); let mut local_a_nonref_0 = (orig_a_nonref_0_0, orig_a_nonref_0_1).into(); local_a_nonref_0 }) }; + FailureCode::InvalidOnionPayload ( + local_a_nonref, + ) + }, } } #[allow(unused)] @@ -78,9 +106,18 @@ impl FailureCode { nativeFailureCode::TemporaryNodeFailure => FailureCode::TemporaryNodeFailure, nativeFailureCode::RequiredNodeFeatureMissing => FailureCode::RequiredNodeFeatureMissing, nativeFailureCode::IncorrectOrUnknownPaymentDetails => FailureCode::IncorrectOrUnknownPaymentDetails, + nativeFailureCode::InvalidOnionPayload (mut a, ) => { + let mut local_a = if a.is_none() { crate::c_types::derived::COption_C2Tuple_u64u16ZZ::None } else { crate::c_types::derived::COption_C2Tuple_u64u16ZZ::Some( { let (mut orig_a_0_0, mut orig_a_0_1) = (a.unwrap()); let mut local_a_0 = (orig_a_0_0, orig_a_0_1).into(); local_a_0 }) }; + FailureCode::InvalidOnionPayload ( + local_a, + ) + }, } } } +/// Frees any resources used by the FailureCode +#[no_mangle] +pub extern "C" fn FailureCode_free(this_ptr: FailureCode) { } /// Creates a copy of the FailureCode #[no_mangle] pub extern "C" fn FailureCode_clone(orig: &FailureCode) -> FailureCode { @@ -98,6 +135,11 @@ pub extern "C" fn FailureCode_required_node_feature_missing() -> FailureCode { /// Utility method to constructs a new IncorrectOrUnknownPaymentDetails-variant FailureCode pub extern "C" fn FailureCode_incorrect_or_unknown_payment_details() -> FailureCode { FailureCode::IncorrectOrUnknownPaymentDetails} +#[no_mangle] +/// Utility method to constructs a new InvalidOnionPayload-variant FailureCode +pub extern "C" fn FailureCode_invalid_onion_payload(a: crate::c_types::derived::COption_C2Tuple_u64u16ZZ) -> FailureCode { + FailureCode::InvalidOnionPayload(a, ) +} use lightning::ln::channelmanager::ChannelManager as nativeChannelManagerImport; pub(crate) type nativeChannelManager = nativeChannelManagerImport; @@ -114,12 +156,14 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport ChannelCounterparty { @@ -693,7 +739,7 @@ impl ChannelDetails { #[no_mangle] pub extern "C" fn ChannelDetails_get_channel_id(this_ptr: &ChannelDetails) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel's ID (prior to funding transaction generation, this is a random 32 bytes, /// thereafter this is the txid of the funding transaction xor the funding transaction output). @@ -701,7 +747,7 @@ pub extern "C" fn ChannelDetails_get_channel_id(this_ptr: &ChannelDetails) -> *c /// lifetime of the channel. #[no_mangle] pub extern "C" fn ChannelDetails_set_channel_id(this_ptr: &mut ChannelDetails, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// Parameters which apply to our counterparty. See individual fields for more information. #[no_mangle] @@ -897,17 +943,29 @@ pub extern "C" fn ChannelDetails_set_unspendable_punishment_reserve(this_ptr: &m let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.unspendable_punishment_reserve = local_val; } -/// The `user_channel_id` passed in to create_channel, or a random value if the channel was -/// inbound. This may be zero for inbound channels serialized with LDK versions prior to -/// 0.0.113. +/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound +/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if +/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise +/// `user_channel_id` will be randomized for an inbound channel. This may be zero for objects +/// serialized with LDK versions prior to 0.0.113. +/// +/// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel +/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel +/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels #[no_mangle] pub extern "C" fn ChannelDetails_get_user_channel_id(this_ptr: &ChannelDetails) -> crate::c_types::U128 { let mut inner_val = &mut this_ptr.get_native_mut_ref().user_channel_id; inner_val.into() } -/// The `user_channel_id` passed in to create_channel, or a random value if the channel was -/// inbound. This may be zero for inbound channels serialized with LDK versions prior to -/// 0.0.113. +/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound +/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if +/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise +/// `user_channel_id` will be randomized for an inbound channel. This may be zero for objects +/// serialized with LDK versions prior to 0.0.113. +/// +/// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel +/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel +/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels #[no_mangle] pub extern "C" fn ChannelDetails_set_user_channel_id(this_ptr: &mut ChannelDetails, mut val: crate::c_types::U128) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.user_channel_id = val.into(); @@ -1260,6 +1318,10 @@ pub extern "C" fn ChannelDetails_set_config(this_ptr: &mut ChannelDetails, mut v unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.config = local_val; } /// Constructs a new ChannelDetails given each field +/// +/// Note that funding_txo_arg (or a relevant inner pointer) may be NULL or all-0s to represent None +/// Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None +/// Note that config_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut counterparty_arg: crate::lightning::ln::channelmanager::ChannelCounterparty, mut funding_txo_arg: crate::lightning::chain::transaction::OutPoint, mut channel_type_arg: crate::lightning::ln::features::ChannelTypeFeatures, mut short_channel_id_arg: crate::c_types::derived::COption_u64Z, mut outbound_scid_alias_arg: crate::c_types::derived::COption_u64Z, mut inbound_scid_alias_arg: crate::c_types::derived::COption_u64Z, mut channel_value_satoshis_arg: u64, mut unspendable_punishment_reserve_arg: crate::c_types::derived::COption_u64Z, mut user_channel_id_arg: crate::c_types::U128, mut feerate_sat_per_1000_weight_arg: crate::c_types::derived::COption_u32Z, mut balance_msat_arg: u64, mut outbound_capacity_msat_arg: u64, mut next_outbound_htlc_limit_msat_arg: u64, mut next_outbound_htlc_minimum_msat_arg: u64, mut inbound_capacity_msat_arg: u64, mut confirmations_required_arg: crate::c_types::derived::COption_u32Z, mut confirmations_arg: crate::c_types::derived::COption_u32Z, mut force_close_spend_delay_arg: crate::c_types::derived::COption_u16Z, mut is_outbound_arg: bool, mut is_channel_ready_arg: bool, mut channel_shutdown_state_arg: crate::c_types::derived::COption_ChannelShutdownStateZ, mut is_usable_arg: bool, mut is_public_arg: bool, mut inbound_htlc_minimum_msat_arg: crate::c_types::derived::COption_u64Z, mut inbound_htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z, mut config_arg: crate::lightning::util::config::ChannelConfig) -> ChannelDetails { @@ -1278,7 +1340,7 @@ pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::c_types::ThirtyT let mut local_inbound_htlc_maximum_msat_arg = if inbound_htlc_maximum_msat_arg.is_some() { Some( { inbound_htlc_maximum_msat_arg.take() }) } else { None }; let mut local_config_arg = if config_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(config_arg.take_inner()) } }) }; ChannelDetails { inner: ObjOps::heap_alloc(nativeChannelDetails { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), counterparty: *unsafe { Box::from_raw(counterparty_arg.take_inner()) }, funding_txo: local_funding_txo_arg, channel_type: local_channel_type_arg, @@ -1459,8 +1521,17 @@ pub extern "C" fn ChannelShutdownState_eq(a: &ChannelShutdownState, b: &ChannelS #[must_use] #[repr(C)] pub enum RecentPaymentDetails { + /// When an invoice was requested and thus a payment has not yet been sent. + AwaitingInvoice { + /// A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify + /// a payment and ensure idempotency in LDK. + payment_id: crate::c_types::ThirtyTwoBytes, + }, /// When a payment is still being sent and awaiting successful delivery. Pending { + /// A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify + /// a payment and ensure idempotency in LDK. + payment_id: crate::c_types::ThirtyTwoBytes, /// Hash of the payment that is currently being sent but has yet to be fulfilled or /// abandoned. payment_hash: crate::c_types::ThirtyTwoBytes, @@ -1472,14 +1543,20 @@ pub enum RecentPaymentDetails { /// been resolved. Upon receiving [`Event::PaymentSent`], we delay for a few minutes before the /// payment is removed from tracking. Fulfilled { + /// A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify + /// a payment and ensure idempotency in LDK. + payment_id: crate::c_types::ThirtyTwoBytes, /// Hash of the payment that was claimed. `None` for serializations of [`ChannelManager`] /// made before LDK version 0.0.104. - payment_hash: crate::c_types::derived::COption_PaymentHashZ, + payment_hash: crate::c_types::derived::COption_ThirtyTwoBytesZ, }, /// After a payment's retries are exhausted per the provided [`Retry`], or it is explicitly /// abandoned via [`ChannelManager::abandon_payment`], it is marked as abandoned until all /// pending HTLCs for this payment resolve and an [`Event::PaymentFailed`] is generated. Abandoned { + /// A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify + /// a payment and ensure idempotency in LDK. + payment_id: crate::c_types::ThirtyTwoBytes, /// Hash of the payment that we have given up trying to send. payment_hash: crate::c_types::ThirtyTwoBytes, }, @@ -1491,24 +1568,36 @@ impl RecentPaymentDetails { #[allow(unused)] pub(crate) fn to_native(&self) -> nativeRecentPaymentDetails { match self { - RecentPaymentDetails::Pending {ref payment_hash, ref total_msat, } => { + RecentPaymentDetails::AwaitingInvoice {ref payment_id, } => { + let mut payment_id_nonref = Clone::clone(payment_id); + nativeRecentPaymentDetails::AwaitingInvoice { + payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), + } + }, + RecentPaymentDetails::Pending {ref payment_id, ref payment_hash, ref total_msat, } => { + let mut payment_id_nonref = Clone::clone(payment_id); let mut payment_hash_nonref = Clone::clone(payment_hash); let mut total_msat_nonref = Clone::clone(total_msat); nativeRecentPaymentDetails::Pending { + payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data), total_msat: total_msat_nonref, } }, - RecentPaymentDetails::Fulfilled {ref payment_hash, } => { + RecentPaymentDetails::Fulfilled {ref payment_id, ref payment_hash, } => { + let mut payment_id_nonref = Clone::clone(payment_id); let mut payment_hash_nonref = Clone::clone(payment_hash); let mut local_payment_hash_nonref = { /*payment_hash_nonref*/ let payment_hash_nonref_opt = payment_hash_nonref; if payment_hash_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::PaymentHash({ payment_hash_nonref_opt.take() }.data) }})} }; nativeRecentPaymentDetails::Fulfilled { + payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), payment_hash: local_payment_hash_nonref, } }, - RecentPaymentDetails::Abandoned {ref payment_hash, } => { + RecentPaymentDetails::Abandoned {ref payment_id, ref payment_hash, } => { + let mut payment_id_nonref = Clone::clone(payment_id); let mut payment_hash_nonref = Clone::clone(payment_hash); nativeRecentPaymentDetails::Abandoned { + payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data), } }, @@ -1517,20 +1606,28 @@ impl RecentPaymentDetails { #[allow(unused)] pub(crate) fn into_native(self) -> nativeRecentPaymentDetails { match self { - RecentPaymentDetails::Pending {mut payment_hash, mut total_msat, } => { + RecentPaymentDetails::AwaitingInvoice {mut payment_id, } => { + nativeRecentPaymentDetails::AwaitingInvoice { + payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), + } + }, + RecentPaymentDetails::Pending {mut payment_id, mut payment_hash, mut total_msat, } => { nativeRecentPaymentDetails::Pending { + payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), payment_hash: ::lightning::ln::PaymentHash(payment_hash.data), total_msat: total_msat, } }, - RecentPaymentDetails::Fulfilled {mut payment_hash, } => { + RecentPaymentDetails::Fulfilled {mut payment_id, mut payment_hash, } => { let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::ln::PaymentHash({ payment_hash_opt.take() }.data) }})} }; nativeRecentPaymentDetails::Fulfilled { + payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), payment_hash: local_payment_hash, } }, - RecentPaymentDetails::Abandoned {mut payment_hash, } => { + RecentPaymentDetails::Abandoned {mut payment_id, mut payment_hash, } => { nativeRecentPaymentDetails::Abandoned { + payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), payment_hash: ::lightning::ln::PaymentHash(payment_hash.data), } }, @@ -1539,24 +1636,36 @@ impl RecentPaymentDetails { #[allow(unused)] pub(crate) fn from_native(native: &nativeRecentPaymentDetails) -> Self { match native { - nativeRecentPaymentDetails::Pending {ref payment_hash, ref total_msat, } => { + nativeRecentPaymentDetails::AwaitingInvoice {ref payment_id, } => { + let mut payment_id_nonref = Clone::clone(payment_id); + RecentPaymentDetails::AwaitingInvoice { + payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, + } + }, + nativeRecentPaymentDetails::Pending {ref payment_id, ref payment_hash, ref total_msat, } => { + let mut payment_id_nonref = Clone::clone(payment_id); let mut payment_hash_nonref = Clone::clone(payment_hash); let mut total_msat_nonref = Clone::clone(total_msat); RecentPaymentDetails::Pending { + payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, total_msat: total_msat_nonref, } }, - nativeRecentPaymentDetails::Fulfilled {ref payment_hash, } => { + nativeRecentPaymentDetails::Fulfilled {ref payment_id, ref payment_hash, } => { + let mut payment_id_nonref = Clone::clone(payment_id); let mut payment_hash_nonref = Clone::clone(payment_hash); - let mut local_payment_hash_nonref = if payment_hash_nonref.is_none() { crate::c_types::derived::COption_PaymentHashZ::None } else { crate::c_types::derived::COption_PaymentHashZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.unwrap().0 } }) }; + let mut local_payment_hash_nonref = if payment_hash_nonref.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.unwrap().0 } }) }; RecentPaymentDetails::Fulfilled { + payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, payment_hash: local_payment_hash_nonref, } }, - nativeRecentPaymentDetails::Abandoned {ref payment_hash, } => { + nativeRecentPaymentDetails::Abandoned {ref payment_id, ref payment_hash, } => { + let mut payment_id_nonref = Clone::clone(payment_id); let mut payment_hash_nonref = Clone::clone(payment_hash); RecentPaymentDetails::Abandoned { + payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, } }, @@ -1565,20 +1674,28 @@ impl RecentPaymentDetails { #[allow(unused)] pub(crate) fn native_into(native: nativeRecentPaymentDetails) -> Self { match native { - nativeRecentPaymentDetails::Pending {mut payment_hash, mut total_msat, } => { + nativeRecentPaymentDetails::AwaitingInvoice {mut payment_id, } => { + RecentPaymentDetails::AwaitingInvoice { + payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 }, + } + }, + nativeRecentPaymentDetails::Pending {mut payment_id, mut payment_hash, mut total_msat, } => { RecentPaymentDetails::Pending { + payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 }, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, total_msat: total_msat, } }, - nativeRecentPaymentDetails::Fulfilled {mut payment_hash, } => { - let mut local_payment_hash = if payment_hash.is_none() { crate::c_types::derived::COption_PaymentHashZ::None } else { crate::c_types::derived::COption_PaymentHashZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_hash.unwrap().0 } }) }; + nativeRecentPaymentDetails::Fulfilled {mut payment_id, mut payment_hash, } => { + let mut local_payment_hash = if payment_hash.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_hash.unwrap().0 } }) }; RecentPaymentDetails::Fulfilled { + payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 }, payment_hash: local_payment_hash, } }, - nativeRecentPaymentDetails::Abandoned {mut payment_hash, } => { + nativeRecentPaymentDetails::Abandoned {mut payment_id, mut payment_hash, } => { RecentPaymentDetails::Abandoned { + payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 }, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, } }, @@ -1594,24 +1711,34 @@ pub extern "C" fn RecentPaymentDetails_clone(orig: &RecentPaymentDetails) -> Rec orig.clone() } #[no_mangle] +/// Utility method to constructs a new AwaitingInvoice-variant RecentPaymentDetails +pub extern "C" fn RecentPaymentDetails_awaiting_invoice(payment_id: crate::c_types::ThirtyTwoBytes) -> RecentPaymentDetails { + RecentPaymentDetails::AwaitingInvoice { + payment_id, + } +} +#[no_mangle] /// Utility method to constructs a new Pending-variant RecentPaymentDetails -pub extern "C" fn RecentPaymentDetails_pending(payment_hash: crate::c_types::ThirtyTwoBytes, total_msat: u64) -> RecentPaymentDetails { +pub extern "C" fn RecentPaymentDetails_pending(payment_id: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes, total_msat: u64) -> RecentPaymentDetails { RecentPaymentDetails::Pending { + payment_id, payment_hash, total_msat, } } #[no_mangle] /// Utility method to constructs a new Fulfilled-variant RecentPaymentDetails -pub extern "C" fn RecentPaymentDetails_fulfilled(payment_hash: crate::c_types::derived::COption_PaymentHashZ) -> RecentPaymentDetails { +pub extern "C" fn RecentPaymentDetails_fulfilled(payment_id: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> RecentPaymentDetails { RecentPaymentDetails::Fulfilled { + payment_id, payment_hash, } } #[no_mangle] /// Utility method to constructs a new Abandoned-variant RecentPaymentDetails -pub extern "C" fn RecentPaymentDetails_abandoned(payment_hash: crate::c_types::ThirtyTwoBytes) -> RecentPaymentDetails { +pub extern "C" fn RecentPaymentDetails_abandoned(payment_id: crate::c_types::ThirtyTwoBytes, payment_hash: crate::c_types::ThirtyTwoBytes) -> RecentPaymentDetails { RecentPaymentDetails::Abandoned { + payment_id, payment_hash, } } @@ -1800,10 +1927,10 @@ pub extern "C" fn ChannelManager_get_current_default_configuration(this_arg: &cr /// 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: &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: crate::c_types::U128, 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: crate::c_types::U128, mut override_config: crate::lightning::util::config::UserConfig) -> crate::c_types::derived::CResult_ThirtyTwoBytesAPIErrorZ { 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.into(), 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() }; + 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 } @@ -1882,7 +2009,7 @@ pub extern "C" fn ChannelManager_list_recent_payments(this_arg: &crate::lightnin #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_close_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.close_channel(unsafe { &*channel_id}, &counterparty_node_id.into_rust()); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.close_channel(&::lightning::ln::ChannelId(unsafe { *channel_id }), &counterparty_node_id.into_rust()); 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 } @@ -1924,7 +2051,7 @@ pub extern "C" fn ChannelManager_close_channel(this_arg: &crate::lightning::ln:: pub extern "C" fn ChannelManager_close_channel_with_feerate_and_script(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, mut target_feerate_sats_per_1000_weight: crate::c_types::derived::COption_u32Z, mut shutdown_script: crate::lightning::ln::script::ShutdownScript) -> crate::c_types::derived::CResult_NoneAPIErrorZ { let mut local_target_feerate_sats_per_1000_weight = if target_feerate_sats_per_1000_weight.is_some() { Some( { target_feerate_sats_per_1000_weight.take() }) } else { None }; let mut local_shutdown_script = if shutdown_script.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(shutdown_script.take_inner()) } }) }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.close_channel_with_feerate_and_script(unsafe { &*channel_id}, &counterparty_node_id.into_rust(), local_target_feerate_sats_per_1000_weight, local_shutdown_script); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.close_channel_with_feerate_and_script(&::lightning::ln::ChannelId(unsafe { *channel_id }), &counterparty_node_id.into_rust(), local_target_feerate_sats_per_1000_weight, local_shutdown_script); 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 } @@ -1936,7 +2063,7 @@ pub extern "C" fn ChannelManager_close_channel_with_feerate_and_script(this_arg: #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_force_close_broadcasting_latest_txn(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.force_close_broadcasting_latest_txn(unsafe { &*channel_id}, &counterparty_node_id.into_rust()); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.force_close_broadcasting_latest_txn(&::lightning::ln::ChannelId(unsafe { *channel_id }), &counterparty_node_id.into_rust()); 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 } @@ -1950,7 +2077,7 @@ pub extern "C" fn ChannelManager_force_close_broadcasting_latest_txn(this_arg: & #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_force_close_without_broadcasting_txn(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.force_close_without_broadcasting_txn(unsafe { &*channel_id}, &counterparty_node_id.into_rust()); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.force_close_without_broadcasting_txn(&::lightning::ln::ChannelId(unsafe { *channel_id }), &counterparty_node_id.into_rust()); 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 } @@ -2005,9 +2132,8 @@ pub extern "C" fn ChannelManager_force_close_all_channels_without_broadcasting_t /// In general, a path may raise: /// * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee, /// node public key) is specified. -/// * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates -/// (including due to previous monitor update failure or new permanent monitor update -/// failure). +/// * [`APIError::ChannelUnavailable`] if the next-hop channel is not available as it has been +/// closed, doesn't exist, or the peer is currently disconnected. /// * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the /// relevant updates. /// @@ -2039,10 +2165,12 @@ pub extern "C" fn ChannelManager_send_payment(this_arg: &crate::lightning::ln::c local_ret } -/// Signals that no further retries for the given payment should occur. Useful if you have a +/// Signals that no further attempts for the given payment should occur. Useful if you have a /// pending outbound payment with retries remaining, but wish to stop retrying the payment before /// retries are exhausted. /// +/// # Event Generation +/// /// If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon /// as there are no remaining pending HTLCs for this payment. /// @@ -2050,11 +2178,10 @@ pub extern "C" fn ChannelManager_send_payment(this_arg: &crate::lightning::ln::c /// wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to /// determine the ultimate status of a payment. /// -/// If an [`Event::PaymentFailed`] event is generated and we restart without this -/// [`ChannelManager`] having been persisted, another [`Event::PaymentFailed`] may be generated. +/// # Restart Behavior /// -/// [`Event::PaymentFailed`]: events::Event::PaymentFailed -/// [`Event::PaymentSent`]: events::Event::PaymentSent +/// If an [`Event::PaymentFailed`] is generated and we restart without first persisting the +/// [`ChannelManager`], another [`Event::PaymentFailed`] may be generated. #[no_mangle] 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)) @@ -2075,7 +2202,7 @@ pub extern "C" fn ChannelManager_abandon_payment(this_arg: &crate::lightning::ln /// [`send_payment`]: Self::send_payment #[must_use] #[no_mangle] -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::derived::COption_PaymentPreimageZ, mut recipient_onion: crate::lightning::ln::outbound_payment::RecipientOnionFields, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentHashPaymentSendFailureZ { +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::derived::COption_ThirtyTwoBytesZ, mut recipient_onion: crate::lightning::ln::outbound_payment::RecipientOnionFields, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_ThirtyTwoBytesPaymentSendFailureZ { let mut local_payment_preimage = { /*payment_preimage*/ let payment_preimage_opt = payment_preimage; if payment_preimage_opt.is_none() { None } else { Some({ { ::lightning::ln::PaymentPreimage({ payment_preimage_opt.take() }.data) }})} }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_spontaneous_payment(route.get_native_ref(), local_payment_preimage, *unsafe { Box::from_raw(recipient_onion.take_inner()) }, ::lightning::ln::channelmanager::PaymentId(payment_id.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::ln::outbound_payment::PaymentSendFailure::native_into(e) }).into() }; @@ -2091,7 +2218,7 @@ pub extern "C" fn ChannelManager_send_spontaneous_payment(this_arg: &crate::ligh /// [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_send_spontaneous_payment_with_retry(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_preimage: crate::c_types::derived::COption_PaymentPreimageZ, mut recipient_onion: crate::lightning::ln::outbound_payment::RecipientOnionFields, mut payment_id: crate::c_types::ThirtyTwoBytes, mut route_params: crate::lightning::routing::router::RouteParameters, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry) -> crate::c_types::derived::CResult_PaymentHashRetryableSendFailureZ { +pub extern "C" fn ChannelManager_send_spontaneous_payment_with_retry(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_preimage: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut recipient_onion: crate::lightning::ln::outbound_payment::RecipientOnionFields, mut payment_id: crate::c_types::ThirtyTwoBytes, mut route_params: crate::lightning::routing::router::RouteParameters, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry) -> crate::c_types::derived::CResult_ThirtyTwoBytesRetryableSendFailureZ { let mut local_payment_preimage = { /*payment_preimage*/ let payment_preimage_opt = payment_preimage; if payment_preimage_opt.is_none() { None } else { Some({ { ::lightning::ln::PaymentPreimage({ payment_preimage_opt.take() }.data) }})} }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_spontaneous_payment_with_retry(local_payment_preimage, *unsafe { Box::from_raw(recipient_onion.take_inner()) }, ::lightning::ln::channelmanager::PaymentId(payment_id.data), *unsafe { Box::from_raw(route_params.take_inner()) }, retry_strategy.into_native()); 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::outbound_payment::RetryableSendFailure::native_into(e) }).into() }; @@ -2103,12 +2230,48 @@ pub extern "C" fn ChannelManager_send_spontaneous_payment_with_retry(this_arg: & /// us to easily discern them from real payments. #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_send_probe(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut path: crate::lightning::routing::router::Path) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { +pub extern "C" fn ChannelManager_send_probe(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut path: crate::lightning::routing::router::Path) -> crate::c_types::derived::CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_probe(*unsafe { Box::from_raw(path.take_inner()) }); 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::outbound_payment::PaymentSendFailure::native_into(e) }).into() }; local_ret } +/// Sends payment probes over all paths of a route that would be used to pay the given +/// amount to the given `node_id`. +/// +/// See [`ChannelManager::send_preflight_probes`] for more information. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_send_spontaneous_preflight_probes(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut node_id: crate::c_types::PublicKey, mut amount_msat: u64, mut final_cltv_expiry_delta: u32, mut liquidity_limit_multiplier: crate::c_types::derived::COption_u64Z) -> crate::c_types::derived::CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + let mut local_liquidity_limit_multiplier = if liquidity_limit_multiplier.is_some() { Some( { liquidity_limit_multiplier.take() }) } else { None }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_spontaneous_preflight_probes(node_id.into_rust(), amount_msat, final_cltv_expiry_delta, local_liquidity_limit_multiplier); + 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.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0_1.0 }).into(); local_ret_0_0 }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::outbound_payment::ProbeSendFailure::native_into(e) }).into() }; + local_ret +} + +/// Sends payment probes over all paths of a route that would be used to pay a route found +/// according to the given [`RouteParameters`]. +/// +/// This may be used to send \"pre-flight\" probes, i.e., to train our scorer before conducting +/// the actual payment. Note this is only useful if there likely is sufficient time for the +/// probe to settle before sending out the actual payment, e.g., when waiting for user +/// confirmation in a wallet UI. +/// +/// Otherwise, there is a chance the probe could take up some liquidity needed to complete the +/// actual payment. Users should therefore be cautious and might avoid sending probes if +/// liquidity is scarce and/or they don't expect the probe to return before they send the +/// payment. To mitigate this issue, channels with available liquidity less than the required +/// amount times the given `liquidity_limit_multiplier` won't be used to send pre-flight +/// probes. If `None` is given as `liquidity_limit_multiplier`, it defaults to `3`. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_send_preflight_probes(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut route_params: crate::lightning::routing::router::RouteParameters, mut liquidity_limit_multiplier: crate::c_types::derived::COption_u64Z) -> crate::c_types::derived::CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + let mut local_liquidity_limit_multiplier = if liquidity_limit_multiplier.is_some() { Some( { liquidity_limit_multiplier.take() }) } else { None }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_preflight_probes(*unsafe { Box::from_raw(route_params.take_inner()) }, local_liquidity_limit_multiplier); + 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.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0_1.0 }).into(); local_ret_0_0 }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::outbound_payment::ProbeSendFailure::native_into(e) }).into() }; + local_ret +} + /// Call this upon creation of a funding transaction for the given channel. /// /// Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs @@ -2142,7 +2305,26 @@ pub extern "C" fn ChannelManager_send_probe(this_arg: &crate::lightning::ln::cha #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_funding_transaction_generated(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, 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}, &counterparty_node_id.into_rust(), funding_transaction.into_bitcoin()); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.funding_transaction_generated(&::lightning::ln::ChannelId(unsafe { *temporary_channel_id }), &counterparty_node_id.into_rust(), 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 +} + +/// Call this upon creation of a batch funding transaction for the given channels. +/// +/// Return values are identical to [`Self::funding_transaction_generated`], respective to +/// each individual channel and transaction output. +/// +/// Do NOT broadcast the funding transaction yourself. This batch funding transcaction +/// will only be broadcast when we have safely received and persisted the counterparty's +/// signature for each channel. +/// +/// If there is an error, all channels in the batch are to be considered closed. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_batch_funding_transaction_generated(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut temporary_channels: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ, mut funding_transaction: crate::c_types::Transaction) -> crate::c_types::derived::CResult_NoneAPIErrorZ { + let mut local_temporary_channels = Vec::new(); for mut item in temporary_channels.into_rust().drain(..) { local_temporary_channels.push( { let (mut orig_temporary_channels_0_0, mut orig_temporary_channels_0_1) = item.to_rust(); let mut local_temporary_channels_0 = (::lightning::ln::ChannelId(orig_temporary_channels_0_0.data), orig_temporary_channels_0_1.into_rust()); local_temporary_channels_0 }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.batch_funding_transaction_generated(&local_temporary_channels.iter().map(|(a, b)| (a, b)).collect::>()[..], 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 } @@ -2172,8 +2354,8 @@ pub extern "C" fn ChannelManager_funding_transaction_generated(this_arg: &crate: #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_update_partial_channel_config(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut counterparty_node_id: crate::c_types::PublicKey, mut channel_ids: crate::c_types::derived::CVec_ThirtyTwoBytesZ, config_update: &crate::lightning::util::config::ChannelConfigUpdate) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut local_channel_ids = Vec::new(); for mut item in channel_ids.into_rust().drain(..) { local_channel_ids.push( { item.data }); }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_partial_channel_config(&counterparty_node_id.into_rust(), &local_channel_ids.iter().map(|a| *a).collect::>()[..], config_update.get_native_ref()); + let mut local_channel_ids = Vec::new(); for mut item in channel_ids.into_rust().drain(..) { local_channel_ids.push( { ::lightning::ln::ChannelId(item.data) }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_partial_channel_config(&counterparty_node_id.into_rust(), local_channel_ids, config_update.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::util::errors::APIError::native_into(e) }).into() }; local_ret } @@ -2203,8 +2385,8 @@ pub extern "C" fn ChannelManager_update_partial_channel_config(this_arg: &crate: #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_update_channel_config(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut counterparty_node_id: crate::c_types::PublicKey, mut channel_ids: crate::c_types::derived::CVec_ThirtyTwoBytesZ, config: &crate::lightning::util::config::ChannelConfig) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut local_channel_ids = Vec::new(); for mut item in channel_ids.into_rust().drain(..) { local_channel_ids.push( { item.data }); }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_config(&counterparty_node_id.into_rust(), &local_channel_ids.iter().map(|a| *a).collect::>()[..], config.get_native_ref()); + let mut local_channel_ids = Vec::new(); for mut item in channel_ids.into_rust().drain(..) { local_channel_ids.push( { ::lightning::ln::ChannelId(item.data) }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.update_channel_config(&counterparty_node_id.into_rust(), local_channel_ids, config.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::util::errors::APIError::native_into(e) }).into() }; local_ret } @@ -2235,7 +2417,7 @@ pub extern "C" fn ChannelManager_update_channel_config(this_arg: &crate::lightni #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_forward_intercepted_htlc(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut intercept_id: crate::c_types::ThirtyTwoBytes, next_hop_channel_id: *const [u8; 32], mut next_node_id: crate::c_types::PublicKey, mut amt_to_forward_msat: u64) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.forward_intercepted_htlc(::lightning::ln::channelmanager::InterceptId(intercept_id.data), unsafe { &*next_hop_channel_id}, next_node_id.into_rust(), amt_to_forward_msat); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.forward_intercepted_htlc(::lightning::ln::channelmanager::InterceptId(intercept_id.data), &::lightning::ln::ChannelId(unsafe { *next_hop_channel_id }), next_node_id.into_rust(), amt_to_forward_msat); 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 } @@ -2326,17 +2508,36 @@ pub extern "C" fn ChannelManager_fail_htlc_backwards_with_reason(this_arg: &crat /// event matches your expectation. If you fail to do so and call this method, you may provide /// the sender \"proof-of-payment\" when they did not fulfill the full expected payment. /// +/// This function will fail the payment if it has custom TLVs with even type numbers, as we +/// will assume they are unknown. If you intend to accept even custom TLVs, you should use +/// [`claim_funds_with_known_custom_tlvs`]. +/// /// [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable /// [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline /// [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed /// [`process_pending_events`]: EventsProvider::process_pending_events /// [`create_inbound_payment`]: Self::create_inbound_payment /// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash +/// [`claim_funds_with_known_custom_tlvs`]: Self::claim_funds_with_known_custom_tlvs #[no_mangle] pub extern "C" fn ChannelManager_claim_funds(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_preimage: crate::c_types::ThirtyTwoBytes) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.claim_funds(::lightning::ln::PaymentPreimage(payment_preimage.data)) } +/// This is a variant of [`claim_funds`] that allows accepting a payment with custom TLVs with +/// even type numbers. +/// +/// # Note +/// +/// You MUST check you've understood all even TLVs before using this to +/// claim, otherwise you may unintentionally agree to some protocol you do not understand. +/// +/// [`claim_funds`]: Self::claim_funds +#[no_mangle] +pub extern "C" fn ChannelManager_claim_funds_with_known_custom_tlvs(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_preimage: crate::c_types::ThirtyTwoBytes) { + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.claim_funds_with_known_custom_tlvs(::lightning::ln::PaymentPreimage(payment_preimage.data)) +} + /// Gets the node_id held by this ChannelManager #[must_use] #[no_mangle] @@ -2364,7 +2565,7 @@ pub extern "C" fn ChannelManager_get_our_node_id(this_arg: &crate::lightning::ln #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, mut user_channel_id: crate::c_types::U128) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel(unsafe { &*temporary_channel_id}, &counterparty_node_id.into_rust(), user_channel_id.into()); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel(&::lightning::ln::ChannelId(unsafe { *temporary_channel_id }), &counterparty_node_id.into_rust(), user_channel_id.into()); 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 } @@ -2390,7 +2591,7 @@ pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &crate::lightn #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, mut user_channel_id: crate::c_types::U128) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel_from_trusted_peer_0conf(unsafe { &*temporary_channel_id}, &counterparty_node_id.into_rust(), user_channel_id.into()); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel_from_trusted_peer_0conf(&::lightning::ln::ChannelId(unsafe { *temporary_channel_id }), &counterparty_node_id.into_rust(), user_channel_id.into()); 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 } @@ -2429,7 +2630,7 @@ pub extern "C" fn ChannelManager_accept_inbound_channel_from_trusted_peer_0conf( /// [`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: &crate::lightning::ln::channelmanager::ChannelManager, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> 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, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None }; let mut local_min_final_cltv_expiry_delta = if min_final_cltv_expiry_delta.is_some() { Some( { min_final_cltv_expiry_delta.take() }) } else { None }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment(local_min_value_msat, invoice_expiry_delta_secs, local_min_final_cltv_expiry_delta); @@ -2485,7 +2686,7 @@ pub extern "C" fn ChannelManager_create_inbound_payment(this_arg: &crate::lightn /// [`PaymentClaimable`]: events::Event::PaymentClaimable #[must_use] #[no_mangle] -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, mut min_final_cltv_expiry: crate::c_types::derived::COption_u16Z) -> 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, mut min_final_cltv_expiry: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_ThirtyTwoBytesNoneZ { let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None }; let mut local_min_final_cltv_expiry = if min_final_cltv_expiry.is_some() { Some( { min_final_cltv_expiry.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, local_min_final_cltv_expiry); @@ -2499,7 +2700,7 @@ pub extern "C" fn ChannelManager_create_inbound_payment_for_hash(this_arg: &crat /// [`create_inbound_payment`]: Self::create_inbound_payment #[must_use] #[no_mangle] -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 { +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_ThirtyTwoBytesAPIErrorZ { 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 @@ -2670,24 +2871,35 @@ extern "C" fn ChannelManager_Confirm_best_block_updated(this_arg: *const c_void, >::best_block_updated(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height) } #[must_use] -extern "C" fn ChannelManager_Confirm_get_relevant_txids(this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_TxidCOption_BlockHashZZZ { +extern "C" fn ChannelManager_Confirm_get_relevant_txids(this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ { let mut ret = >::get_relevant_txids(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ); - 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 = if orig_ret_0_1.is_none() { crate::c_types::derived::COption_BlockHashZ::None } else { crate::c_types::derived::COption_BlockHashZ::Some( { crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.unwrap().into_inner() } }) }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1).into(); local_ret_0 }); }; + 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 = if orig_ret_0_1.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.unwrap().into_inner() } }) }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1).into(); local_ret_0 }); }; local_ret.into() } -/// Gets a [`Future`] that completes when this [`ChannelManager`] needs to be persisted. +/// Gets a [`Future`] that completes when this [`ChannelManager`] may need to be persisted or +/// may have events that need processing. +/// +/// In order to check if this [`ChannelManager`] needs persisting, call +/// [`Self::get_and_clear_needs_persistence`]. /// /// Note that callbacks registered on the [`Future`] MUST NOT call back into this /// [`ChannelManager`] and should instead register actions to be taken later. -/// #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_get_persistable_update_future(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::lightning::util::wakers::Future { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_persistable_update_future(); +pub extern "C" fn ChannelManager_get_event_or_persistence_needed_future(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::lightning::util::wakers::Future { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_event_or_persistence_needed_future(); crate::lightning::util::wakers::Future { inner: ObjOps::heap_alloc(ret), is_owned: true } } +/// Returns true if this [`ChannelManager`] needs to be persisted. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_get_and_clear_needs_persistence(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_and_clear_needs_persistence(); + ret +} + /// Gets the latest best block which was connected either via the [`chain::Listen`] or /// [`chain::Confirm`] interfaces. #[must_use] @@ -2899,9 +3111,9 @@ extern "C" fn ChannelManager_ChannelMessageHandler_provided_init_features(this_a crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } #[must_use] -extern "C" fn ChannelManager_ChannelMessageHandler_get_genesis_hashes(this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ChainHashZZ { +extern "C" fn ChannelManager_ChannelMessageHandler_get_genesis_hashes(this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ { let mut ret = >::get_genesis_hashes(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ); - let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ChainHashZZ::None } else { crate::c_types::derived::COption_CVec_ChainHashZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_ret_0.into() }) }; + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::None } else { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_ret_0.into() }) }; local_ret } @@ -3221,8 +3433,8 @@ pub extern "C" fn ChannelManagerReadArgs_new(mut entropy_source: crate::lightnin } #[no_mangle] -/// Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write -pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_read(ser: crate::c_types::u8slice, arg: crate::lightning::ln::channelmanager::ChannelManagerReadArgs) -> crate::c_types::derived::CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { +/// Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write +pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser: crate::c_types::u8slice, arg: crate::lightning::ln::channelmanager::ChannelManagerReadArgs) -> crate::c_types::derived::CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { let arg_conv = *unsafe { Box::from_raw(arg.take_inner()) }; let res: Result<(bitcoin::hash_types::BlockHash, lightning::ln::channelmanager::ChannelManager), lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_res_0_0, mut orig_res_0_1) = o; let mut local_res_0 = (crate::c_types::ThirtyTwoBytes { data: orig_res_0_0.into_inner() }, crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(orig_res_0_1), is_owned: true }).into(); local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; diff --git a/lightning-c-bindings/src/lightning/ln/features.rs b/lightning-c-bindings/src/lightning/ln/features.rs index cb7453b1..f3f46a74 100644 --- a/lightning-c-bindings/src/lightning/ln/features.rs +++ b/lightning-c-bindings/src/lightning/ln/features.rs @@ -73,6 +73,7 @@ //! [messages]: crate::ln::msgs use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -83,6 +84,7 @@ use alloc::{vec::Vec, boxed::Box}; mod sealed { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -922,6 +924,90 @@ pub extern "C" fn NodeFeatures_requires_shutdown_anysegwit(this_arg: &crate::lig ret } +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_taproot_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_taproot_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_taproot_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_taproot_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_taproot(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_taproot(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_taproot_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_taproot_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_taproot_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_taproot_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_taproot(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_taproot(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_set_taproot_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_taproot_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_set_taproot_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_taproot_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_supports_taproot(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_taproot(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_taproot(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_taproot(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_taproot(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_taproot(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_requires_taproot(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_taproot(); + ret +} + /// Set this feature as optional. #[no_mangle] pub extern "C" fn InitFeatures_set_onion_messages_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) { @@ -2004,6 +2090,36 @@ pub extern "C" fn InitFeatures_requires_unknown_bits(this_arg: &crate::lightning ret } +/// Sets a required feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Required bits are even. If an odd bit is given, then the corresponding even bit will +/// be set instead (i.e., `bit - 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_set_required_feature_bit(this_arg: &mut crate::lightning::ln::features::InitFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_required_feature_bit(bit); + 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 +} + +/// Sets an optional feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be +/// set instead (i.e., `bit + 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_set_optional_feature_bit(this_arg: &mut crate::lightning::ln::features::InitFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_optional_feature_bit(bit); + 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 +} + /// Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined /// by [bLIP 2] or if it is a known `T` feature. /// @@ -2059,6 +2175,36 @@ pub extern "C" fn NodeFeatures_requires_unknown_bits(this_arg: &crate::lightning ret } +/// Sets a required feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Required bits are even. If an odd bit is given, then the corresponding even bit will +/// be set instead (i.e., `bit - 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_set_required_feature_bit(this_arg: &mut crate::lightning::ln::features::NodeFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_required_feature_bit(bit); + 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 +} + +/// Sets an optional feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be +/// set instead (i.e., `bit + 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_set_optional_feature_bit(this_arg: &mut crate::lightning::ln::features::NodeFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_optional_feature_bit(bit); + 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 +} + /// Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined /// by [bLIP 2] or if it is a known `T` feature. /// @@ -2114,6 +2260,36 @@ pub extern "C" fn ChannelFeatures_requires_unknown_bits(this_arg: &crate::lightn ret } +/// Sets a required feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Required bits are even. If an odd bit is given, then the corresponding even bit will +/// be set instead (i.e., `bit - 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelFeatures_set_required_feature_bit(this_arg: &mut crate::lightning::ln::features::ChannelFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelFeatures)) }.set_required_feature_bit(bit); + 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 +} + +/// Sets an optional feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be +/// set instead (i.e., `bit + 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelFeatures_set_optional_feature_bit(this_arg: &mut crate::lightning::ln::features::ChannelFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelFeatures)) }.set_optional_feature_bit(bit); + 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 +} + /// Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined /// by [bLIP 2] or if it is a known `T` feature. /// @@ -2169,6 +2345,36 @@ pub extern "C" fn Bolt11InvoiceFeatures_requires_unknown_bits(this_arg: &crate:: ret } +/// Sets a required feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Required bits are even. If an odd bit is given, then the corresponding even bit will +/// be set instead (i.e., `bit - 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_set_required_feature_bit(this_arg: &mut crate::lightning::ln::features::Bolt11InvoiceFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeBolt11InvoiceFeatures)) }.set_required_feature_bit(bit); + 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 +} + +/// Sets an optional feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be +/// set instead (i.e., `bit + 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_set_optional_feature_bit(this_arg: &mut crate::lightning::ln::features::Bolt11InvoiceFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeBolt11InvoiceFeatures)) }.set_optional_feature_bit(bit); + 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 +} + /// Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined /// by [bLIP 2] or if it is a known `T` feature. /// @@ -2224,6 +2430,36 @@ pub extern "C" fn OfferFeatures_requires_unknown_bits(this_arg: &crate::lightnin ret } +/// Sets a required feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Required bits are even. If an odd bit is given, then the corresponding even bit will +/// be set instead (i.e., `bit - 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn OfferFeatures_set_required_feature_bit(this_arg: &mut crate::lightning::ln::features::OfferFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeOfferFeatures)) }.set_required_feature_bit(bit); + 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 +} + +/// Sets an optional feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be +/// set instead (i.e., `bit + 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn OfferFeatures_set_optional_feature_bit(this_arg: &mut crate::lightning::ln::features::OfferFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeOfferFeatures)) }.set_optional_feature_bit(bit); + 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 +} + /// Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined /// by [bLIP 2] or if it is a known `T` feature. /// @@ -2279,6 +2515,36 @@ pub extern "C" fn InvoiceRequestFeatures_requires_unknown_bits(this_arg: &crate: ret } +/// Sets a required feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Required bits are even. If an odd bit is given, then the corresponding even bit will +/// be set instead (i.e., `bit - 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequestFeatures_set_required_feature_bit(this_arg: &mut crate::lightning::ln::features::InvoiceRequestFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceRequestFeatures)) }.set_required_feature_bit(bit); + 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 +} + +/// Sets an optional feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be +/// set instead (i.e., `bit + 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequestFeatures_set_optional_feature_bit(this_arg: &mut crate::lightning::ln::features::InvoiceRequestFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceRequestFeatures)) }.set_optional_feature_bit(bit); + 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 +} + /// Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined /// by [bLIP 2] or if it is a known `T` feature. /// @@ -2334,6 +2600,36 @@ pub extern "C" fn Bolt12InvoiceFeatures_requires_unknown_bits(this_arg: &crate:: ret } +/// Sets a required feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Required bits are even. If an odd bit is given, then the corresponding even bit will +/// be set instead (i.e., `bit - 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12InvoiceFeatures_set_required_feature_bit(this_arg: &mut crate::lightning::ln::features::Bolt12InvoiceFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeBolt12InvoiceFeatures)) }.set_required_feature_bit(bit); + 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 +} + +/// Sets an optional feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be +/// set instead (i.e., `bit + 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12InvoiceFeatures_set_optional_feature_bit(this_arg: &mut crate::lightning::ln::features::Bolt12InvoiceFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeBolt12InvoiceFeatures)) }.set_optional_feature_bit(bit); + 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 +} + /// Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined /// by [bLIP 2] or if it is a known `T` feature. /// @@ -2389,6 +2685,36 @@ pub extern "C" fn BlindedHopFeatures_requires_unknown_bits(this_arg: &crate::lig ret } +/// Sets a required feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Required bits are even. If an odd bit is given, then the corresponding even bit will +/// be set instead (i.e., `bit - 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn BlindedHopFeatures_set_required_feature_bit(this_arg: &mut crate::lightning::ln::features::BlindedHopFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeBlindedHopFeatures)) }.set_required_feature_bit(bit); + 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 +} + +/// Sets an optional feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be +/// set instead (i.e., `bit + 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn BlindedHopFeatures_set_optional_feature_bit(this_arg: &mut crate::lightning::ln::features::BlindedHopFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeBlindedHopFeatures)) }.set_optional_feature_bit(bit); + 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 +} + /// Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined /// by [bLIP 2] or if it is a known `T` feature. /// @@ -2444,6 +2770,36 @@ pub extern "C" fn ChannelTypeFeatures_requires_unknown_bits(this_arg: &crate::li ret } +/// Sets a required feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Required bits are even. If an odd bit is given, then the corresponding even bit will +/// be set instead (i.e., `bit - 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_set_required_feature_bit(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_required_feature_bit(bit); + 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 +} + +/// Sets an optional feature bit. Errors if `bit` is outside the feature range as defined +/// by [BOLT 9]. +/// +/// Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be +/// set instead (i.e., `bit + 1`). +/// +/// [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_set_optional_feature_bit(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures, mut bit: usize) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_optional_feature_bit(bit); + 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 +} + /// Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined /// by [bLIP 2] or if it is a known `T` feature. /// diff --git a/lightning-c-bindings/src/lightning/ln/inbound_payment.rs b/lightning-c-bindings/src/lightning/ln/inbound_payment.rs index 4a4d1dd6..a1cea417 100644 --- a/lightning-c-bindings/src/lightning/ln/inbound_payment.rs +++ b/lightning-c-bindings/src/lightning/ln/inbound_payment.rs @@ -9,6 +9,7 @@ //! Utilities to generate inbound payment information in service of invoice creation. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -96,7 +97,7 @@ pub extern "C" fn ExpandedKey_new(key_material: *const [u8; 32]) -> crate::light /// [phantom node payments]: crate::sign::PhantomKeysManager /// [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material #[no_mangle] -pub extern "C" fn create(keys: &crate::lightning::ln::inbound_payment::ExpandedKey, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32, entropy_source: &crate::lightning::sign::EntropySource, mut current_time: u64, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { +pub extern "C" fn create(keys: &crate::lightning::ln::inbound_payment::ExpandedKey, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32, entropy_source: &crate::lightning::sign::EntropySource, mut current_time: u64, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None }; let mut local_min_final_cltv_expiry_delta = if min_final_cltv_expiry_delta.is_some() { Some( { min_final_cltv_expiry_delta.take() }) } else { None }; let mut ret = lightning::ln::inbound_payment::create::(keys.get_native_ref(), local_min_value_msat, invoice_expiry_delta_secs, entropy_source, current_time, local_min_final_cltv_expiry_delta); @@ -115,7 +116,7 @@ pub extern "C" fn create(keys: &crate::lightning::ln::inbound_payment::ExpandedK /// /// [phantom node payments]: crate::sign::PhantomKeysManager #[no_mangle] -pub extern "C" fn create_from_hash(keys: &crate::lightning::ln::inbound_payment::ExpandedKey, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut invoice_expiry_delta_secs: u32, mut current_time: u64, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_PaymentSecretNoneZ { +pub extern "C" fn create_from_hash(keys: &crate::lightning::ln::inbound_payment::ExpandedKey, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut invoice_expiry_delta_secs: u32, mut current_time: u64, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_ThirtyTwoBytesNoneZ { let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None }; let mut local_min_final_cltv_expiry_delta = if min_final_cltv_expiry_delta.is_some() { Some( { min_final_cltv_expiry_delta.take() }) } else { None }; let mut ret = lightning::ln::inbound_payment::create_from_hash(keys.get_native_ref(), local_min_value_msat, ::lightning::ln::PaymentHash(payment_hash.data), invoice_expiry_delta_secs, current_time, local_min_final_cltv_expiry_delta); diff --git a/lightning-c-bindings/src/lightning/ln/mod.rs b/lightning-c-bindings/src/lightning/ln/mod.rs index 98594035..0df9ab62 100644 --- a/lightning-c-bindings/src/lightning/ln/mod.rs +++ b/lightning-c-bindings/src/lightning/ln/mod.rs @@ -9,6 +9,7 @@ //! Implementations of various parts of the Lightning protocol are in this module. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -25,9 +26,22 @@ pub mod features; pub mod script; pub mod outbound_payment; pub mod wire; +mod channel_id { + +use alloc::str::FromStr; +use alloc::string::String; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +} mod peer_channel_encryptor { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -39,6 +53,7 @@ use alloc::{vec::Vec, boxed::Box}; mod channel { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -50,6 +65,7 @@ use alloc::{vec::Vec, boxed::Box}; mod onion_utils { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/ln/msgs.rs b/lightning-c-bindings/src/lightning/ln/msgs.rs index d3e4c4bb..dbc23972 100644 --- a/lightning-c-bindings/src/lightning/ln/msgs.rs +++ b/lightning-c-bindings/src/lightning/ln/msgs.rs @@ -24,6 +24,7 @@ //! track the network on the less-secure system. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -242,16 +243,16 @@ pub extern "C" fn Init_set_features(this_ptr: &mut Init, mut val: crate::lightni /// /// Returns a copy of the field. #[no_mangle] -pub extern "C" fn Init_get_networks(this_ptr: &Init) -> crate::c_types::derived::COption_CVec_ChainHashZZ { +pub extern "C" fn Init_get_networks(this_ptr: &Init) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ { let mut inner_val = this_ptr.get_native_mut_ref().networks.clone(); - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_CVec_ChainHashZZ::None } else { crate::c_types::derived::COption_CVec_ChainHashZZ::Some( { let mut local_inner_val_0 = Vec::new(); for mut item in inner_val.unwrap().drain(..) { local_inner_val_0.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_inner_val_0.into() }) }; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::None } else { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::Some( { let mut local_inner_val_0 = Vec::new(); for mut item in inner_val.unwrap().drain(..) { local_inner_val_0.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_inner_val_0.into() }) }; local_inner_val } /// Indicates chains the sender is interested in. /// /// If there are no common chains, the connection will be closed. #[no_mangle] -pub extern "C" fn Init_set_networks(this_ptr: &mut Init, mut val: crate::c_types::derived::COption_CVec_ChainHashZZ) { +pub extern "C" fn Init_set_networks(this_ptr: &mut Init, mut val: crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ) { let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { let mut local_val_0 = Vec::new(); for mut item in { val_opt.take() }.into_rust().drain(..) { local_val_0.push( { ::bitcoin::blockdata::constants::ChainHash::from(&item.data[..]) }); }; local_val_0 }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.networks = local_val; } @@ -262,9 +263,9 @@ pub extern "C" fn Init_set_networks(this_ptr: &mut Init, mut val: crate::c_types /// public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing /// the new address. #[no_mangle] -pub extern "C" fn Init_get_remote_network_address(this_ptr: &Init) -> crate::c_types::derived::COption_NetAddressZ { +pub extern "C" fn Init_get_remote_network_address(this_ptr: &Init) -> crate::c_types::derived::COption_SocketAddressZ { let mut inner_val = &mut this_ptr.get_native_mut_ref().remote_network_address; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_NetAddressZ::None } else { crate::c_types::derived::COption_NetAddressZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::lightning::ln::msgs::NetAddress::native_into((*inner_val.as_ref().unwrap()).clone()) }) }; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_SocketAddressZ::None } else { crate::c_types::derived::COption_SocketAddressZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::lightning::ln::msgs::SocketAddress::native_into((*inner_val.as_ref().unwrap()).clone()) }) }; local_inner_val } /// The receipient's network address. @@ -274,14 +275,14 @@ pub extern "C" fn Init_get_remote_network_address(this_ptr: &Init) -> crate::c_t /// public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing /// the new address. #[no_mangle] -pub extern "C" fn Init_set_remote_network_address(this_ptr: &mut Init, mut val: crate::c_types::derived::COption_NetAddressZ) { +pub extern "C" fn Init_set_remote_network_address(this_ptr: &mut Init, mut val: crate::c_types::derived::COption_SocketAddressZ) { let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_native() }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.remote_network_address = local_val; } /// Constructs a new Init given each field #[must_use] #[no_mangle] -pub extern "C" fn Init_new(mut features_arg: crate::lightning::ln::features::InitFeatures, mut networks_arg: crate::c_types::derived::COption_CVec_ChainHashZZ, mut remote_network_address_arg: crate::c_types::derived::COption_NetAddressZ) -> Init { +pub extern "C" fn Init_new(mut features_arg: crate::lightning::ln::features::InitFeatures, mut networks_arg: crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ, mut remote_network_address_arg: crate::c_types::derived::COption_SocketAddressZ) -> Init { let mut local_networks_arg = { /*networks_arg*/ let networks_arg_opt = networks_arg; if networks_arg_opt.is_none() { None } else { Some({ { let mut local_networks_arg_0 = Vec::new(); for mut item in { networks_arg_opt.take() }.into_rust().drain(..) { local_networks_arg_0.push( { ::bitcoin::blockdata::constants::ChainHash::from(&item.data[..]) }); }; local_networks_arg_0 }})} }; let mut local_remote_network_address_arg = { /*remote_network_address_arg*/ let remote_network_address_arg_opt = remote_network_address_arg; if remote_network_address_arg_opt.is_none() { None } else { Some({ { { remote_network_address_arg_opt.take() }.into_native() }})} }; Init { inner: ObjOps::heap_alloc(nativeInit { @@ -378,7 +379,7 @@ impl ErrorMessage { #[no_mangle] pub extern "C" fn ErrorMessage_get_channel_id(this_ptr: &ErrorMessage) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID involved in the error. /// @@ -386,7 +387,7 @@ pub extern "C" fn ErrorMessage_get_channel_id(this_ptr: &ErrorMessage) -> *const /// with the sending peer should be closed. #[no_mangle] pub extern "C" fn ErrorMessage_set_channel_id(this_ptr: &mut ErrorMessage, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// A possibly human-readable error description. /// @@ -412,7 +413,7 @@ pub extern "C" fn ErrorMessage_set_data(this_ptr: &mut ErrorMessage, mut val: cr #[no_mangle] pub extern "C" fn ErrorMessage_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut data_arg: crate::c_types::Str) -> ErrorMessage { ErrorMessage { inner: ObjOps::heap_alloc(nativeErrorMessage { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), data: data_arg.into_string(), }), is_owned: true } } @@ -503,14 +504,14 @@ impl WarningMessage { #[no_mangle] pub extern "C" fn WarningMessage_get_channel_id(this_ptr: &WarningMessage) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID involved in the warning. /// /// All-0s indicates a warning unrelated to a specific channel. #[no_mangle] pub extern "C" fn WarningMessage_set_channel_id(this_ptr: &mut WarningMessage, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// A possibly human-readable warning description. /// @@ -536,7 +537,7 @@ pub extern "C" fn WarningMessage_set_data(this_ptr: &mut WarningMessage, mut val #[no_mangle] pub extern "C" fn WarningMessage_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut data_arg: crate::c_types::Str) -> WarningMessage { WarningMessage { inner: ObjOps::heap_alloc(nativeWarningMessage { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), data: data_arg.into_string(), }), is_owned: true } } @@ -858,12 +859,12 @@ pub extern "C" fn OpenChannel_set_chain_hash(this_ptr: &mut OpenChannel, mut val #[no_mangle] pub extern "C" fn OpenChannel_get_temporary_channel_id(this_ptr: &OpenChannel) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().temporary_channel_id; - inner_val + &inner_val.0 } /// A temporary channel ID, until the funding outpoint is announced #[no_mangle] pub extern "C" fn OpenChannel_set_temporary_channel_id(this_ptr: &mut OpenChannel, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.temporary_channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.temporary_channel_id = ::lightning::ln::ChannelId(val.data); } /// The channel value #[no_mangle] @@ -1047,14 +1048,14 @@ pub extern "C" fn OpenChannel_set_channel_flags(this_ptr: &mut OpenChannel, mut } /// A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close #[no_mangle] -pub extern "C" fn OpenChannel_get_shutdown_scriptpubkey(this_ptr: &OpenChannel) -> crate::c_types::derived::COption_ScriptZ { +pub extern "C" fn OpenChannel_get_shutdown_scriptpubkey(this_ptr: &OpenChannel) -> crate::c_types::derived::COption_CVec_u8ZZ { let mut inner_val = &mut this_ptr.get_native_mut_ref().shutdown_scriptpubkey; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ScriptZ::None } else { crate::c_types::derived::COption_ScriptZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { (*inner_val.as_ref().unwrap()).clone().into_bytes().into() }) }; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { (*inner_val.as_ref().unwrap()).clone().into_bytes().into() }) }; local_inner_val } /// A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close #[no_mangle] -pub extern "C" fn OpenChannel_set_shutdown_scriptpubkey(this_ptr: &mut OpenChannel, mut val: crate::c_types::derived::COption_ScriptZ) { +pub extern "C" fn OpenChannel_set_shutdown_scriptpubkey(this_ptr: &mut OpenChannel, mut val: crate::c_types::derived::COption_CVec_u8ZZ) { let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::bitcoin::blockdata::script::Script::from({ val_opt.take() }.into_rust()) }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.shutdown_scriptpubkey = local_val; } @@ -1082,14 +1083,16 @@ pub extern "C" fn OpenChannel_set_channel_type(this_ptr: &mut OpenChannel, mut v unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_type = local_val; } /// Constructs a new OpenChannel given each field +/// +/// Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn OpenChannel_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut temporary_channel_id_arg: crate::c_types::ThirtyTwoBytes, mut funding_satoshis_arg: u64, mut push_msat_arg: u64, mut dust_limit_satoshis_arg: u64, mut max_htlc_value_in_flight_msat_arg: u64, mut channel_reserve_satoshis_arg: u64, mut htlc_minimum_msat_arg: u64, mut feerate_per_kw_arg: u32, mut to_self_delay_arg: u16, mut max_accepted_htlcs_arg: u16, mut funding_pubkey_arg: crate::c_types::PublicKey, mut revocation_basepoint_arg: crate::c_types::PublicKey, mut payment_point_arg: crate::c_types::PublicKey, mut delayed_payment_basepoint_arg: crate::c_types::PublicKey, mut htlc_basepoint_arg: crate::c_types::PublicKey, mut first_per_commitment_point_arg: crate::c_types::PublicKey, mut channel_flags_arg: u8, mut shutdown_scriptpubkey_arg: crate::c_types::derived::COption_ScriptZ, mut channel_type_arg: crate::lightning::ln::features::ChannelTypeFeatures) -> OpenChannel { +pub extern "C" fn OpenChannel_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut temporary_channel_id_arg: crate::c_types::ThirtyTwoBytes, mut funding_satoshis_arg: u64, mut push_msat_arg: u64, mut dust_limit_satoshis_arg: u64, mut max_htlc_value_in_flight_msat_arg: u64, mut channel_reserve_satoshis_arg: u64, mut htlc_minimum_msat_arg: u64, mut feerate_per_kw_arg: u32, mut to_self_delay_arg: u16, mut max_accepted_htlcs_arg: u16, mut funding_pubkey_arg: crate::c_types::PublicKey, mut revocation_basepoint_arg: crate::c_types::PublicKey, mut payment_point_arg: crate::c_types::PublicKey, mut delayed_payment_basepoint_arg: crate::c_types::PublicKey, mut htlc_basepoint_arg: crate::c_types::PublicKey, mut first_per_commitment_point_arg: crate::c_types::PublicKey, mut channel_flags_arg: u8, mut shutdown_scriptpubkey_arg: crate::c_types::derived::COption_CVec_u8ZZ, mut channel_type_arg: crate::lightning::ln::features::ChannelTypeFeatures) -> OpenChannel { let mut local_shutdown_scriptpubkey_arg = { /*shutdown_scriptpubkey_arg*/ let shutdown_scriptpubkey_arg_opt = shutdown_scriptpubkey_arg; if shutdown_scriptpubkey_arg_opt.is_none() { None } else { Some({ { ::bitcoin::blockdata::script::Script::from({ shutdown_scriptpubkey_arg_opt.take() }.into_rust()) }})} }; let mut local_channel_type_arg = if channel_type_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_type_arg.take_inner()) } }) }; OpenChannel { inner: ObjOps::heap_alloc(nativeOpenChannel { chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(), - temporary_channel_id: temporary_channel_id_arg.data, + temporary_channel_id: ::lightning::ln::ChannelId(temporary_channel_id_arg.data), funding_satoshis: funding_satoshis_arg, push_msat: push_msat_arg, dust_limit_satoshis: dust_limit_satoshis_arg, @@ -1207,12 +1210,12 @@ pub extern "C" fn OpenChannelV2_set_chain_hash(this_ptr: &mut OpenChannelV2, mut #[no_mangle] pub extern "C" fn OpenChannelV2_get_temporary_channel_id(this_ptr: &OpenChannelV2) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().temporary_channel_id; - inner_val + &inner_val.0 } /// A temporary channel ID derived using a zeroed out value for the channel acceptor's revocation basepoint #[no_mangle] pub extern "C" fn OpenChannelV2_set_temporary_channel_id(this_ptr: &mut OpenChannelV2, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.temporary_channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.temporary_channel_id = ::lightning::ln::ChannelId(val.data); } /// The feerate for the funding transaction set by the channel initiator #[no_mangle] @@ -1410,15 +1413,15 @@ pub extern "C" fn OpenChannelV2_set_channel_flags(this_ptr: &mut OpenChannelV2, /// Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we /// collaboratively close #[no_mangle] -pub extern "C" fn OpenChannelV2_get_shutdown_scriptpubkey(this_ptr: &OpenChannelV2) -> crate::c_types::derived::COption_ScriptZ { +pub extern "C" fn OpenChannelV2_get_shutdown_scriptpubkey(this_ptr: &OpenChannelV2) -> crate::c_types::derived::COption_CVec_u8ZZ { let mut inner_val = &mut this_ptr.get_native_mut_ref().shutdown_scriptpubkey; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ScriptZ::None } else { crate::c_types::derived::COption_ScriptZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { (*inner_val.as_ref().unwrap()).clone().into_bytes().into() }) }; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { (*inner_val.as_ref().unwrap()).clone().into_bytes().into() }) }; local_inner_val } /// Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we /// collaboratively close #[no_mangle] -pub extern "C" fn OpenChannelV2_set_shutdown_scriptpubkey(this_ptr: &mut OpenChannelV2, mut val: crate::c_types::derived::COption_ScriptZ) { +pub extern "C" fn OpenChannelV2_set_shutdown_scriptpubkey(this_ptr: &mut OpenChannelV2, mut val: crate::c_types::derived::COption_CVec_u8ZZ) { let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::bitcoin::blockdata::script::Script::from({ val_opt.take() }.into_rust()) }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.shutdown_scriptpubkey = local_val; } @@ -1457,15 +1460,17 @@ pub extern "C" fn OpenChannelV2_set_require_confirmed_inputs(this_ptr: &mut Open unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.require_confirmed_inputs = local_val; } /// Constructs a new OpenChannelV2 given each field +/// +/// Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn OpenChannelV2_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut temporary_channel_id_arg: crate::c_types::ThirtyTwoBytes, mut funding_feerate_sat_per_1000_weight_arg: u32, mut commitment_feerate_sat_per_1000_weight_arg: u32, mut funding_satoshis_arg: u64, mut dust_limit_satoshis_arg: u64, mut max_htlc_value_in_flight_msat_arg: u64, mut htlc_minimum_msat_arg: u64, mut to_self_delay_arg: u16, mut max_accepted_htlcs_arg: u16, mut locktime_arg: u32, mut funding_pubkey_arg: crate::c_types::PublicKey, mut revocation_basepoint_arg: crate::c_types::PublicKey, mut payment_basepoint_arg: crate::c_types::PublicKey, mut delayed_payment_basepoint_arg: crate::c_types::PublicKey, mut htlc_basepoint_arg: crate::c_types::PublicKey, mut first_per_commitment_point_arg: crate::c_types::PublicKey, mut second_per_commitment_point_arg: crate::c_types::PublicKey, mut channel_flags_arg: u8, mut shutdown_scriptpubkey_arg: crate::c_types::derived::COption_ScriptZ, mut channel_type_arg: crate::lightning::ln::features::ChannelTypeFeatures, mut require_confirmed_inputs_arg: crate::c_types::derived::COption_NoneZ) -> OpenChannelV2 { +pub extern "C" fn OpenChannelV2_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut temporary_channel_id_arg: crate::c_types::ThirtyTwoBytes, mut funding_feerate_sat_per_1000_weight_arg: u32, mut commitment_feerate_sat_per_1000_weight_arg: u32, mut funding_satoshis_arg: u64, mut dust_limit_satoshis_arg: u64, mut max_htlc_value_in_flight_msat_arg: u64, mut htlc_minimum_msat_arg: u64, mut to_self_delay_arg: u16, mut max_accepted_htlcs_arg: u16, mut locktime_arg: u32, mut funding_pubkey_arg: crate::c_types::PublicKey, mut revocation_basepoint_arg: crate::c_types::PublicKey, mut payment_basepoint_arg: crate::c_types::PublicKey, mut delayed_payment_basepoint_arg: crate::c_types::PublicKey, mut htlc_basepoint_arg: crate::c_types::PublicKey, mut first_per_commitment_point_arg: crate::c_types::PublicKey, mut second_per_commitment_point_arg: crate::c_types::PublicKey, mut channel_flags_arg: u8, mut shutdown_scriptpubkey_arg: crate::c_types::derived::COption_CVec_u8ZZ, mut channel_type_arg: crate::lightning::ln::features::ChannelTypeFeatures, mut require_confirmed_inputs_arg: crate::c_types::derived::COption_NoneZ) -> OpenChannelV2 { let mut local_shutdown_scriptpubkey_arg = { /*shutdown_scriptpubkey_arg*/ let shutdown_scriptpubkey_arg_opt = shutdown_scriptpubkey_arg; if shutdown_scriptpubkey_arg_opt.is_none() { None } else { Some({ { ::bitcoin::blockdata::script::Script::from({ shutdown_scriptpubkey_arg_opt.take() }.into_rust()) }})} }; let mut local_channel_type_arg = if channel_type_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_type_arg.take_inner()) } }) }; let mut local_require_confirmed_inputs_arg = if require_confirmed_inputs_arg.is_some() { Some( { () /*require_confirmed_inputs_arg.take()*/ }) } else { None }; OpenChannelV2 { inner: ObjOps::heap_alloc(nativeOpenChannelV2 { chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(), - temporary_channel_id: temporary_channel_id_arg.data, + temporary_channel_id: ::lightning::ln::ChannelId(temporary_channel_id_arg.data), funding_feerate_sat_per_1000_weight: funding_feerate_sat_per_1000_weight_arg, commitment_feerate_sat_per_1000_weight: commitment_feerate_sat_per_1000_weight_arg, funding_satoshis: funding_satoshis_arg, @@ -1575,12 +1580,12 @@ impl AcceptChannel { #[no_mangle] pub extern "C" fn AcceptChannel_get_temporary_channel_id(this_ptr: &AcceptChannel) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().temporary_channel_id; - inner_val + &inner_val.0 } /// A temporary channel ID, until the funding outpoint is announced #[no_mangle] pub extern "C" fn AcceptChannel_set_temporary_channel_id(this_ptr: &mut AcceptChannel, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.temporary_channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.temporary_channel_id = ::lightning::ln::ChannelId(val.data); } /// The threshold below which outputs on transactions broadcast by sender will be omitted #[no_mangle] @@ -1727,14 +1732,14 @@ pub extern "C" fn AcceptChannel_set_first_per_commitment_point(this_ptr: &mut Ac } /// A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close #[no_mangle] -pub extern "C" fn AcceptChannel_get_shutdown_scriptpubkey(this_ptr: &AcceptChannel) -> crate::c_types::derived::COption_ScriptZ { +pub extern "C" fn AcceptChannel_get_shutdown_scriptpubkey(this_ptr: &AcceptChannel) -> crate::c_types::derived::COption_CVec_u8ZZ { let mut inner_val = &mut this_ptr.get_native_mut_ref().shutdown_scriptpubkey; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ScriptZ::None } else { crate::c_types::derived::COption_ScriptZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { (*inner_val.as_ref().unwrap()).clone().into_bytes().into() }) }; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { (*inner_val.as_ref().unwrap()).clone().into_bytes().into() }) }; local_inner_val } /// A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close #[no_mangle] -pub extern "C" fn AcceptChannel_set_shutdown_scriptpubkey(this_ptr: &mut AcceptChannel, mut val: crate::c_types::derived::COption_ScriptZ) { +pub extern "C" fn AcceptChannel_set_shutdown_scriptpubkey(this_ptr: &mut AcceptChannel, mut val: crate::c_types::derived::COption_CVec_u8ZZ) { let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::bitcoin::blockdata::script::Script::from({ val_opt.take() }.into_rust()) }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.shutdown_scriptpubkey = local_val; } @@ -1764,13 +1769,15 @@ pub extern "C" fn AcceptChannel_set_channel_type(this_ptr: &mut AcceptChannel, m unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_type = local_val; } /// Constructs a new AcceptChannel given each field +/// +/// Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn AcceptChannel_new(mut temporary_channel_id_arg: crate::c_types::ThirtyTwoBytes, mut dust_limit_satoshis_arg: u64, mut max_htlc_value_in_flight_msat_arg: u64, mut channel_reserve_satoshis_arg: u64, mut htlc_minimum_msat_arg: u64, mut minimum_depth_arg: u32, mut to_self_delay_arg: u16, mut max_accepted_htlcs_arg: u16, mut funding_pubkey_arg: crate::c_types::PublicKey, mut revocation_basepoint_arg: crate::c_types::PublicKey, mut payment_point_arg: crate::c_types::PublicKey, mut delayed_payment_basepoint_arg: crate::c_types::PublicKey, mut htlc_basepoint_arg: crate::c_types::PublicKey, mut first_per_commitment_point_arg: crate::c_types::PublicKey, mut shutdown_scriptpubkey_arg: crate::c_types::derived::COption_ScriptZ, mut channel_type_arg: crate::lightning::ln::features::ChannelTypeFeatures) -> AcceptChannel { +pub extern "C" fn AcceptChannel_new(mut temporary_channel_id_arg: crate::c_types::ThirtyTwoBytes, mut dust_limit_satoshis_arg: u64, mut max_htlc_value_in_flight_msat_arg: u64, mut channel_reserve_satoshis_arg: u64, mut htlc_minimum_msat_arg: u64, mut minimum_depth_arg: u32, mut to_self_delay_arg: u16, mut max_accepted_htlcs_arg: u16, mut funding_pubkey_arg: crate::c_types::PublicKey, mut revocation_basepoint_arg: crate::c_types::PublicKey, mut payment_point_arg: crate::c_types::PublicKey, mut delayed_payment_basepoint_arg: crate::c_types::PublicKey, mut htlc_basepoint_arg: crate::c_types::PublicKey, mut first_per_commitment_point_arg: crate::c_types::PublicKey, mut shutdown_scriptpubkey_arg: crate::c_types::derived::COption_CVec_u8ZZ, mut channel_type_arg: crate::lightning::ln::features::ChannelTypeFeatures) -> AcceptChannel { let mut local_shutdown_scriptpubkey_arg = { /*shutdown_scriptpubkey_arg*/ let shutdown_scriptpubkey_arg_opt = shutdown_scriptpubkey_arg; if shutdown_scriptpubkey_arg_opt.is_none() { None } else { Some({ { ::bitcoin::blockdata::script::Script::from({ shutdown_scriptpubkey_arg_opt.take() }.into_rust()) }})} }; let mut local_channel_type_arg = if channel_type_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_type_arg.take_inner()) } }) }; AcceptChannel { inner: ObjOps::heap_alloc(nativeAcceptChannel { - temporary_channel_id: temporary_channel_id_arg.data, + temporary_channel_id: ::lightning::ln::ChannelId(temporary_channel_id_arg.data), dust_limit_satoshis: dust_limit_satoshis_arg, max_htlc_value_in_flight_msat: max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis: channel_reserve_satoshis_arg, @@ -1874,12 +1881,12 @@ impl AcceptChannelV2 { #[no_mangle] pub extern "C" fn AcceptChannelV2_get_temporary_channel_id(this_ptr: &AcceptChannelV2) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().temporary_channel_id; - inner_val + &inner_val.0 } /// The same `temporary_channel_id` received from the initiator's `open_channel2` message. #[no_mangle] pub extern "C" fn AcceptChannelV2_set_temporary_channel_id(this_ptr: &mut AcceptChannelV2, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.temporary_channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.temporary_channel_id = ::lightning::ln::ChannelId(val.data); } /// Part of the channel value contributed by the channel acceptor #[no_mangle] @@ -2044,15 +2051,15 @@ pub extern "C" fn AcceptChannelV2_set_second_per_commitment_point(this_ptr: &mut /// Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we /// collaboratively close #[no_mangle] -pub extern "C" fn AcceptChannelV2_get_shutdown_scriptpubkey(this_ptr: &AcceptChannelV2) -> crate::c_types::derived::COption_ScriptZ { +pub extern "C" fn AcceptChannelV2_get_shutdown_scriptpubkey(this_ptr: &AcceptChannelV2) -> crate::c_types::derived::COption_CVec_u8ZZ { let mut inner_val = &mut this_ptr.get_native_mut_ref().shutdown_scriptpubkey; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ScriptZ::None } else { crate::c_types::derived::COption_ScriptZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { (*inner_val.as_ref().unwrap()).clone().into_bytes().into() }) }; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { (*inner_val.as_ref().unwrap()).clone().into_bytes().into() }) }; local_inner_val } /// Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we /// collaboratively close #[no_mangle] -pub extern "C" fn AcceptChannelV2_set_shutdown_scriptpubkey(this_ptr: &mut AcceptChannelV2, mut val: crate::c_types::derived::COption_ScriptZ) { +pub extern "C" fn AcceptChannelV2_set_shutdown_scriptpubkey(this_ptr: &mut AcceptChannelV2, mut val: crate::c_types::derived::COption_CVec_u8ZZ) { let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::bitcoin::blockdata::script::Script::from({ val_opt.take() }.into_rust()) }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.shutdown_scriptpubkey = local_val; } @@ -2095,14 +2102,16 @@ pub extern "C" fn AcceptChannelV2_set_require_confirmed_inputs(this_ptr: &mut Ac unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.require_confirmed_inputs = local_val; } /// Constructs a new AcceptChannelV2 given each field +/// +/// Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn AcceptChannelV2_new(mut temporary_channel_id_arg: crate::c_types::ThirtyTwoBytes, mut funding_satoshis_arg: u64, mut dust_limit_satoshis_arg: u64, mut max_htlc_value_in_flight_msat_arg: u64, mut htlc_minimum_msat_arg: u64, mut minimum_depth_arg: u32, mut to_self_delay_arg: u16, mut max_accepted_htlcs_arg: u16, mut funding_pubkey_arg: crate::c_types::PublicKey, mut revocation_basepoint_arg: crate::c_types::PublicKey, mut payment_basepoint_arg: crate::c_types::PublicKey, mut delayed_payment_basepoint_arg: crate::c_types::PublicKey, mut htlc_basepoint_arg: crate::c_types::PublicKey, mut first_per_commitment_point_arg: crate::c_types::PublicKey, mut second_per_commitment_point_arg: crate::c_types::PublicKey, mut shutdown_scriptpubkey_arg: crate::c_types::derived::COption_ScriptZ, mut channel_type_arg: crate::lightning::ln::features::ChannelTypeFeatures, mut require_confirmed_inputs_arg: crate::c_types::derived::COption_NoneZ) -> AcceptChannelV2 { +pub extern "C" fn AcceptChannelV2_new(mut temporary_channel_id_arg: crate::c_types::ThirtyTwoBytes, mut funding_satoshis_arg: u64, mut dust_limit_satoshis_arg: u64, mut max_htlc_value_in_flight_msat_arg: u64, mut htlc_minimum_msat_arg: u64, mut minimum_depth_arg: u32, mut to_self_delay_arg: u16, mut max_accepted_htlcs_arg: u16, mut funding_pubkey_arg: crate::c_types::PublicKey, mut revocation_basepoint_arg: crate::c_types::PublicKey, mut payment_basepoint_arg: crate::c_types::PublicKey, mut delayed_payment_basepoint_arg: crate::c_types::PublicKey, mut htlc_basepoint_arg: crate::c_types::PublicKey, mut first_per_commitment_point_arg: crate::c_types::PublicKey, mut second_per_commitment_point_arg: crate::c_types::PublicKey, mut shutdown_scriptpubkey_arg: crate::c_types::derived::COption_CVec_u8ZZ, mut channel_type_arg: crate::lightning::ln::features::ChannelTypeFeatures, mut require_confirmed_inputs_arg: crate::c_types::derived::COption_NoneZ) -> AcceptChannelV2 { let mut local_shutdown_scriptpubkey_arg = { /*shutdown_scriptpubkey_arg*/ let shutdown_scriptpubkey_arg_opt = shutdown_scriptpubkey_arg; if shutdown_scriptpubkey_arg_opt.is_none() { None } else { Some({ { ::bitcoin::blockdata::script::Script::from({ shutdown_scriptpubkey_arg_opt.take() }.into_rust()) }})} }; let mut local_channel_type_arg = if channel_type_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_type_arg.take_inner()) } }) }; let mut local_require_confirmed_inputs_arg = if require_confirmed_inputs_arg.is_some() { Some( { () /*require_confirmed_inputs_arg.take()*/ }) } else { None }; AcceptChannelV2 { inner: ObjOps::heap_alloc(nativeAcceptChannelV2 { - temporary_channel_id: temporary_channel_id_arg.data, + temporary_channel_id: ::lightning::ln::ChannelId(temporary_channel_id_arg.data), funding_satoshis: funding_satoshis_arg, dust_limit_satoshis: dust_limit_satoshis_arg, max_htlc_value_in_flight_msat: max_htlc_value_in_flight_msat_arg, @@ -2209,12 +2218,12 @@ impl FundingCreated { #[no_mangle] pub extern "C" fn FundingCreated_get_temporary_channel_id(this_ptr: &FundingCreated) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().temporary_channel_id; - inner_val + &inner_val.0 } /// A temporary channel ID, until the funding is established #[no_mangle] pub extern "C" fn FundingCreated_set_temporary_channel_id(this_ptr: &mut FundingCreated, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.temporary_channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.temporary_channel_id = ::lightning::ln::ChannelId(val.data); } /// The funding transaction ID #[no_mangle] @@ -2240,21 +2249,21 @@ pub extern "C" fn FundingCreated_set_funding_output_index(this_ptr: &mut Funding } /// The signature of the channel initiator (funder) on the initial commitment transaction #[no_mangle] -pub extern "C" fn FundingCreated_get_signature(this_ptr: &FundingCreated) -> crate::c_types::Signature { +pub extern "C" fn FundingCreated_get_signature(this_ptr: &FundingCreated) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().signature; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// The signature of the channel initiator (funder) on the initial commitment transaction #[no_mangle] -pub extern "C" fn FundingCreated_set_signature(this_ptr: &mut FundingCreated, mut val: crate::c_types::Signature) { +pub extern "C" fn FundingCreated_set_signature(this_ptr: &mut FundingCreated, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.signature = val.into_rust(); } /// Constructs a new FundingCreated given each field #[must_use] #[no_mangle] -pub extern "C" fn FundingCreated_new(mut temporary_channel_id_arg: crate::c_types::ThirtyTwoBytes, mut funding_txid_arg: crate::c_types::ThirtyTwoBytes, mut funding_output_index_arg: u16, mut signature_arg: crate::c_types::Signature) -> FundingCreated { +pub extern "C" fn FundingCreated_new(mut temporary_channel_id_arg: crate::c_types::ThirtyTwoBytes, mut funding_txid_arg: crate::c_types::ThirtyTwoBytes, mut funding_output_index_arg: u16, mut signature_arg: crate::c_types::ECDSASignature) -> FundingCreated { FundingCreated { inner: ObjOps::heap_alloc(nativeFundingCreated { - temporary_channel_id: temporary_channel_id_arg.data, + temporary_channel_id: ::lightning::ln::ChannelId(temporary_channel_id_arg.data), funding_txid: ::bitcoin::hash_types::Txid::from_slice(&funding_txid_arg.data[..]).unwrap(), funding_output_index: funding_output_index_arg, signature: signature_arg.into_rust(), @@ -2347,30 +2356,30 @@ impl FundingSigned { #[no_mangle] pub extern "C" fn FundingSigned_get_channel_id(this_ptr: &FundingSigned) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn FundingSigned_set_channel_id(this_ptr: &mut FundingSigned, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The signature of the channel acceptor (fundee) on the initial commitment transaction #[no_mangle] -pub extern "C" fn FundingSigned_get_signature(this_ptr: &FundingSigned) -> crate::c_types::Signature { +pub extern "C" fn FundingSigned_get_signature(this_ptr: &FundingSigned) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().signature; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// The signature of the channel acceptor (fundee) on the initial commitment transaction #[no_mangle] -pub extern "C" fn FundingSigned_set_signature(this_ptr: &mut FundingSigned, mut val: crate::c_types::Signature) { +pub extern "C" fn FundingSigned_set_signature(this_ptr: &mut FundingSigned, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.signature = val.into_rust(); } /// Constructs a new FundingSigned given each field #[must_use] #[no_mangle] -pub extern "C" fn FundingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut signature_arg: crate::c_types::Signature) -> FundingSigned { +pub extern "C" fn FundingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut signature_arg: crate::c_types::ECDSASignature) -> FundingSigned { FundingSigned { inner: ObjOps::heap_alloc(nativeFundingSigned { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), signature: signature_arg.into_rust(), }), is_owned: true } } @@ -2459,12 +2468,12 @@ impl ChannelReady { #[no_mangle] pub extern "C" fn ChannelReady_get_channel_id(this_ptr: &ChannelReady) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn ChannelReady_set_channel_id(this_ptr: &mut ChannelReady, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The per-commitment point of the second commitment transaction #[no_mangle] @@ -2502,7 +2511,7 @@ pub extern "C" fn ChannelReady_set_short_channel_id_alias(this_ptr: &mut Channel pub extern "C" fn ChannelReady_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut next_per_commitment_point_arg: crate::c_types::PublicKey, mut short_channel_id_alias_arg: crate::c_types::derived::COption_u64Z) -> ChannelReady { let mut local_short_channel_id_alias_arg = if short_channel_id_alias_arg.is_some() { Some( { short_channel_id_alias_arg.take() }) } else { None }; ChannelReady { inner: ObjOps::heap_alloc(nativeChannelReady { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), next_per_commitment_point: next_per_commitment_point_arg.into_rust(), short_channel_id_alias: local_short_channel_id_alias_arg, }), is_owned: true } @@ -2591,12 +2600,12 @@ impl TxAddInput { #[no_mangle] pub extern "C" fn TxAddInput_get_channel_id(this_ptr: &TxAddInput) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn TxAddInput_set_channel_id(this_ptr: &mut TxAddInput, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// A randomly chosen unique identifier for this input, which is even for initiators and odd for /// non-initiators. @@ -2651,7 +2660,7 @@ pub extern "C" fn TxAddInput_set_sequence(this_ptr: &mut TxAddInput, mut val: u3 #[no_mangle] pub extern "C" fn TxAddInput_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut serial_id_arg: u64, mut prevtx_arg: crate::lightning::util::ser::TransactionU16LenLimited, mut prevtx_out_arg: u32, mut sequence_arg: u32) -> TxAddInput { TxAddInput { inner: ObjOps::heap_alloc(nativeTxAddInput { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), serial_id: serial_id_arg, prevtx: *unsafe { Box::from_raw(prevtx_arg.take_inner()) }, prevtx_out: prevtx_out_arg, @@ -2742,12 +2751,12 @@ impl TxAddOutput { #[no_mangle] pub extern "C" fn TxAddOutput_get_channel_id(this_ptr: &TxAddOutput) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn TxAddOutput_set_channel_id(this_ptr: &mut TxAddOutput, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// A randomly chosen unique identifier for this output, which is even for initiators and odd for /// non-initiators. @@ -2789,7 +2798,7 @@ pub extern "C" fn TxAddOutput_set_script(this_ptr: &mut TxAddOutput, mut val: cr #[no_mangle] pub extern "C" fn TxAddOutput_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut serial_id_arg: u64, mut sats_arg: u64, mut script_arg: crate::c_types::derived::CVec_u8Z) -> TxAddOutput { TxAddOutput { inner: ObjOps::heap_alloc(nativeTxAddOutput { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), serial_id: serial_id_arg, sats: sats_arg, script: ::bitcoin::blockdata::script::Script::from(script_arg.into_rust()), @@ -2879,12 +2888,12 @@ impl TxRemoveInput { #[no_mangle] pub extern "C" fn TxRemoveInput_get_channel_id(this_ptr: &TxRemoveInput) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn TxRemoveInput_set_channel_id(this_ptr: &mut TxRemoveInput, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The serial ID of the input to be removed #[no_mangle] @@ -2902,7 +2911,7 @@ pub extern "C" fn TxRemoveInput_set_serial_id(this_ptr: &mut TxRemoveInput, mut #[no_mangle] pub extern "C" fn TxRemoveInput_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut serial_id_arg: u64) -> TxRemoveInput { TxRemoveInput { inner: ObjOps::heap_alloc(nativeTxRemoveInput { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), serial_id: serial_id_arg, }), is_owned: true } } @@ -2990,12 +2999,12 @@ impl TxRemoveOutput { #[no_mangle] pub extern "C" fn TxRemoveOutput_get_channel_id(this_ptr: &TxRemoveOutput) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn TxRemoveOutput_set_channel_id(this_ptr: &mut TxRemoveOutput, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The serial ID of the output to be removed #[no_mangle] @@ -3013,7 +3022,7 @@ pub extern "C" fn TxRemoveOutput_set_serial_id(this_ptr: &mut TxRemoveOutput, mu #[no_mangle] pub extern "C" fn TxRemoveOutput_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut serial_id_arg: u64) -> TxRemoveOutput { TxRemoveOutput { inner: ObjOps::heap_alloc(nativeTxRemoveOutput { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), serial_id: serial_id_arg, }), is_owned: true } } @@ -3102,19 +3111,19 @@ impl TxComplete { #[no_mangle] pub extern "C" fn TxComplete_get_channel_id(this_ptr: &TxComplete) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn TxComplete_set_channel_id(this_ptr: &mut TxComplete, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// Constructs a new TxComplete given each field #[must_use] #[no_mangle] pub extern "C" fn TxComplete_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes) -> TxComplete { TxComplete { inner: ObjOps::heap_alloc(nativeTxComplete { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), }), is_owned: true } } impl Clone for TxComplete { @@ -3202,12 +3211,12 @@ impl TxSignatures { #[no_mangle] pub extern "C" fn TxSignatures_get_channel_id(this_ptr: &TxSignatures) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn TxSignatures_set_channel_id(this_ptr: &mut TxSignatures, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The TXID #[no_mangle] @@ -3241,7 +3250,7 @@ pub extern "C" fn TxSignatures_set_witnesses(this_ptr: &mut TxSignatures, mut va pub extern "C" fn TxSignatures_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut tx_hash_arg: crate::c_types::ThirtyTwoBytes, mut witnesses_arg: crate::c_types::derived::CVec_WitnessZ) -> TxSignatures { let mut local_witnesses_arg = Vec::new(); for mut item in witnesses_arg.into_rust().drain(..) { local_witnesses_arg.push( { item.into_bitcoin() }); }; TxSignatures { inner: ObjOps::heap_alloc(nativeTxSignatures { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), tx_hash: ::bitcoin::hash_types::Txid::from_slice(&tx_hash_arg.data[..]).unwrap(), witnesses: local_witnesses_arg, }), is_owned: true } @@ -3331,12 +3340,12 @@ impl TxInitRbf { #[no_mangle] pub extern "C" fn TxInitRbf_get_channel_id(this_ptr: &TxInitRbf) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn TxInitRbf_set_channel_id(this_ptr: &mut TxInitRbf, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The locktime of the transaction #[no_mangle] @@ -3381,7 +3390,7 @@ pub extern "C" fn TxInitRbf_set_funding_output_contribution(this_ptr: &mut TxIni pub extern "C" fn TxInitRbf_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut locktime_arg: u32, mut feerate_sat_per_1000_weight_arg: u32, mut funding_output_contribution_arg: crate::c_types::derived::COption_i64Z) -> TxInitRbf { let mut local_funding_output_contribution_arg = if funding_output_contribution_arg.is_some() { Some( { funding_output_contribution_arg.take() }) } else { None }; TxInitRbf { inner: ObjOps::heap_alloc(nativeTxInitRbf { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), locktime: locktime_arg, feerate_sat_per_1000_weight: feerate_sat_per_1000_weight_arg, funding_output_contribution: local_funding_output_contribution_arg, @@ -3472,12 +3481,12 @@ impl TxAckRbf { #[no_mangle] pub extern "C" fn TxAckRbf_get_channel_id(this_ptr: &TxAckRbf) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn TxAckRbf_set_channel_id(this_ptr: &mut TxAckRbf, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The number of satoshis the sender will contribute to or, if negative, remove from /// (e.g. splice-out) the funding output of the transaction @@ -3500,7 +3509,7 @@ pub extern "C" fn TxAckRbf_set_funding_output_contribution(this_ptr: &mut TxAckR pub extern "C" fn TxAckRbf_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut funding_output_contribution_arg: crate::c_types::derived::COption_i64Z) -> TxAckRbf { let mut local_funding_output_contribution_arg = if funding_output_contribution_arg.is_some() { Some( { funding_output_contribution_arg.take() }) } else { None }; TxAckRbf { inner: ObjOps::heap_alloc(nativeTxAckRbf { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), funding_output_contribution: local_funding_output_contribution_arg, }), is_owned: true } } @@ -3588,12 +3597,12 @@ impl TxAbort { #[no_mangle] pub extern "C" fn TxAbort_get_channel_id(this_ptr: &TxAbort) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn TxAbort_set_channel_id(this_ptr: &mut TxAbort, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// Message data /// @@ -3616,7 +3625,7 @@ pub extern "C" fn TxAbort_set_data(this_ptr: &mut TxAbort, mut val: crate::c_typ pub extern "C" fn TxAbort_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut data_arg: crate::c_types::derived::CVec_u8Z) -> TxAbort { let mut local_data_arg = Vec::new(); for mut item in data_arg.into_rust().drain(..) { local_data_arg.push( { item }); }; TxAbort { inner: ObjOps::heap_alloc(nativeTxAbort { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), data: local_data_arg, }), is_owned: true } } @@ -3705,12 +3714,12 @@ impl Shutdown { #[no_mangle] pub extern "C" fn Shutdown_get_channel_id(this_ptr: &Shutdown) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn Shutdown_set_channel_id(this_ptr: &mut Shutdown, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The destination of this peer's funds on closing. /// @@ -3732,7 +3741,7 @@ pub extern "C" fn Shutdown_set_scriptpubkey(this_ptr: &mut Shutdown, mut val: cr #[no_mangle] pub extern "C" fn Shutdown_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut scriptpubkey_arg: crate::c_types::derived::CVec_u8Z) -> Shutdown { Shutdown { inner: ObjOps::heap_alloc(nativeShutdown { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), scriptpubkey: ::bitcoin::blockdata::script::Script::from(scriptpubkey_arg.into_rust()), }), is_owned: true } } @@ -3938,12 +3947,12 @@ impl ClosingSigned { #[no_mangle] pub extern "C" fn ClosingSigned_get_channel_id(this_ptr: &ClosingSigned) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn ClosingSigned_set_channel_id(this_ptr: &mut ClosingSigned, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The proposed total fee for the closing transaction #[no_mangle] @@ -3958,13 +3967,13 @@ pub extern "C" fn ClosingSigned_set_fee_satoshis(this_ptr: &mut ClosingSigned, m } /// A signature on the closing transaction #[no_mangle] -pub extern "C" fn ClosingSigned_get_signature(this_ptr: &ClosingSigned) -> crate::c_types::Signature { +pub extern "C" fn ClosingSigned_get_signature(this_ptr: &ClosingSigned) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().signature; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// A signature on the closing transaction #[no_mangle] -pub extern "C" fn ClosingSigned_set_signature(this_ptr: &mut ClosingSigned, mut val: crate::c_types::Signature) { +pub extern "C" fn ClosingSigned_set_signature(this_ptr: &mut ClosingSigned, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.signature = val.into_rust(); } /// The minimum and maximum fees which the sender is willing to accept, provided only by new @@ -3987,12 +3996,14 @@ pub extern "C" fn ClosingSigned_set_fee_range(this_ptr: &mut ClosingSigned, mut unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_range = local_val; } /// Constructs a new ClosingSigned given each field +/// +/// Note that fee_range_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn ClosingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut fee_satoshis_arg: u64, mut signature_arg: crate::c_types::Signature, mut fee_range_arg: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> ClosingSigned { +pub extern "C" fn ClosingSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut fee_satoshis_arg: u64, mut signature_arg: crate::c_types::ECDSASignature, mut fee_range_arg: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> ClosingSigned { let mut local_fee_range_arg = if fee_range_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(fee_range_arg.take_inner()) } }) }; ClosingSigned { inner: ObjOps::heap_alloc(nativeClosingSigned { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), fee_satoshis: fee_satoshis_arg, signature: signature_arg.into_rust(), fee_range: local_fee_range_arg, @@ -4083,12 +4094,12 @@ impl UpdateAddHTLC { #[no_mangle] pub extern "C" fn UpdateAddHTLC_get_channel_id(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn UpdateAddHTLC_set_channel_id(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The HTLC ID #[no_mangle] @@ -4244,6 +4255,26 @@ pub extern "C" fn OnionMessage_get_blinding_point(this_ptr: &OnionMessage) -> cr pub extern "C" fn OnionMessage_set_blinding_point(this_ptr: &mut OnionMessage, mut val: crate::c_types::PublicKey) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.blinding_point = val.into_rust(); } +/// The full onion packet including hop data, pubkey, and hmac +#[no_mangle] +pub extern "C" fn OnionMessage_get_onion_routing_packet(this_ptr: &OnionMessage) -> crate::lightning::onion_message::packet::Packet { + let mut inner_val = &mut this_ptr.get_native_mut_ref().onion_routing_packet; + crate::lightning::onion_message::packet::Packet { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::onion_message::packet::Packet<>) as *mut _) }, is_owned: false } +} +/// The full onion packet including hop data, pubkey, and hmac +#[no_mangle] +pub extern "C" fn OnionMessage_set_onion_routing_packet(this_ptr: &mut OnionMessage, mut val: crate::lightning::onion_message::packet::Packet) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.onion_routing_packet = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// Constructs a new OnionMessage given each field +#[must_use] +#[no_mangle] +pub extern "C" fn OnionMessage_new(mut blinding_point_arg: crate::c_types::PublicKey, mut onion_routing_packet_arg: crate::lightning::onion_message::packet::Packet) -> OnionMessage { + OnionMessage { inner: ObjOps::heap_alloc(nativeOnionMessage { + blinding_point: blinding_point_arg.into_rust(), + onion_routing_packet: *unsafe { Box::from_raw(onion_routing_packet_arg.take_inner()) }, + }), is_owned: true } +} impl Clone for OnionMessage { fn clone(&self) -> Self { Self { @@ -4329,12 +4360,12 @@ impl UpdateFulfillHTLC { #[no_mangle] pub extern "C" fn UpdateFulfillHTLC_get_channel_id(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn UpdateFulfillHTLC_set_channel_id(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The HTLC ID #[no_mangle] @@ -4363,7 +4394,7 @@ pub extern "C" fn UpdateFulfillHTLC_set_payment_preimage(this_ptr: &mut UpdateFu #[no_mangle] pub extern "C" fn UpdateFulfillHTLC_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut htlc_id_arg: u64, mut payment_preimage_arg: crate::c_types::ThirtyTwoBytes) -> UpdateFulfillHTLC { UpdateFulfillHTLC { inner: ObjOps::heap_alloc(nativeUpdateFulfillHTLC { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), htlc_id: htlc_id_arg, payment_preimage: ::lightning::ln::PaymentPreimage(payment_preimage_arg.data), }), is_owned: true } @@ -4453,12 +4484,12 @@ impl UpdateFailHTLC { #[no_mangle] pub extern "C" fn UpdateFailHTLC_get_channel_id(this_ptr: &UpdateFailHTLC) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn UpdateFailHTLC_set_channel_id(this_ptr: &mut UpdateFailHTLC, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The HTLC ID #[no_mangle] @@ -4556,12 +4587,12 @@ impl UpdateFailMalformedHTLC { #[no_mangle] pub extern "C" fn UpdateFailMalformedHTLC_get_channel_id(this_ptr: &UpdateFailMalformedHTLC) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn UpdateFailMalformedHTLC_set_channel_id(this_ptr: &mut UpdateFailMalformedHTLC, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The HTLC ID #[no_mangle] @@ -4670,46 +4701,46 @@ impl CommitmentSigned { #[no_mangle] pub extern "C" fn CommitmentSigned_get_channel_id(this_ptr: &CommitmentSigned) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn CommitmentSigned_set_channel_id(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// A signature on the commitment transaction #[no_mangle] -pub extern "C" fn CommitmentSigned_get_signature(this_ptr: &CommitmentSigned) -> crate::c_types::Signature { +pub extern "C" fn CommitmentSigned_get_signature(this_ptr: &CommitmentSigned) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().signature; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// A signature on the commitment transaction #[no_mangle] -pub extern "C" fn CommitmentSigned_set_signature(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::Signature) { +pub extern "C" fn CommitmentSigned_set_signature(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.signature = val.into_rust(); } /// Signatures on the HTLC transactions /// /// Returns a copy of the field. #[no_mangle] -pub extern "C" fn CommitmentSigned_get_htlc_signatures(this_ptr: &CommitmentSigned) -> crate::c_types::derived::CVec_SignatureZ { +pub extern "C" fn CommitmentSigned_get_htlc_signatures(this_ptr: &CommitmentSigned) -> crate::c_types::derived::CVec_ECDSASignatureZ { let mut inner_val = this_ptr.get_native_mut_ref().htlc_signatures.clone(); - let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { crate::c_types::Signature::from_rust(&item) }); }; + let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { crate::c_types::ECDSASignature::from_rust(&item) }); }; local_inner_val.into() } /// Signatures on the HTLC transactions #[no_mangle] -pub extern "C" fn CommitmentSigned_set_htlc_signatures(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::derived::CVec_SignatureZ) { +pub extern "C" fn CommitmentSigned_set_htlc_signatures(this_ptr: &mut CommitmentSigned, mut val: crate::c_types::derived::CVec_ECDSASignatureZ) { let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_rust() }); }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_signatures = local_val; } /// Constructs a new CommitmentSigned given each field #[must_use] #[no_mangle] -pub extern "C" fn CommitmentSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut signature_arg: crate::c_types::Signature, mut htlc_signatures_arg: crate::c_types::derived::CVec_SignatureZ) -> CommitmentSigned { +pub extern "C" fn CommitmentSigned_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut signature_arg: crate::c_types::ECDSASignature, mut htlc_signatures_arg: crate::c_types::derived::CVec_ECDSASignatureZ) -> CommitmentSigned { let mut local_htlc_signatures_arg = Vec::new(); for mut item in htlc_signatures_arg.into_rust().drain(..) { local_htlc_signatures_arg.push( { item.into_rust() }); }; CommitmentSigned { inner: ObjOps::heap_alloc(nativeCommitmentSigned { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), signature: signature_arg.into_rust(), htlc_signatures: local_htlc_signatures_arg, }), is_owned: true } @@ -4799,12 +4830,12 @@ impl RevokeAndACK { #[no_mangle] pub extern "C" fn RevokeAndACK_get_channel_id(this_ptr: &RevokeAndACK) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn RevokeAndACK_set_channel_id(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The secret corresponding to the per-commitment point #[no_mangle] @@ -4833,7 +4864,7 @@ pub extern "C" fn RevokeAndACK_set_next_per_commitment_point(this_ptr: &mut Revo #[no_mangle] pub extern "C" fn RevokeAndACK_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut per_commitment_secret_arg: crate::c_types::ThirtyTwoBytes, mut next_per_commitment_point_arg: crate::c_types::PublicKey) -> RevokeAndACK { RevokeAndACK { inner: ObjOps::heap_alloc(nativeRevokeAndACK { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), per_commitment_secret: per_commitment_secret_arg.data, next_per_commitment_point: next_per_commitment_point_arg.into_rust(), }), is_owned: true } @@ -4923,12 +4954,12 @@ impl UpdateFee { #[no_mangle] pub extern "C" fn UpdateFee_get_channel_id(this_ptr: &UpdateFee) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn UpdateFee_set_channel_id(this_ptr: &mut UpdateFee, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// Fee rate per 1000-weight of the transaction #[no_mangle] @@ -4946,7 +4977,7 @@ pub extern "C" fn UpdateFee_set_feerate_per_kw(this_ptr: &mut UpdateFee, mut val #[no_mangle] pub extern "C" fn UpdateFee_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut feerate_per_kw_arg: u32) -> UpdateFee { UpdateFee { inner: ObjOps::heap_alloc(nativeUpdateFee { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), feerate_per_kw: feerate_per_kw_arg, }), is_owned: true } } @@ -5035,12 +5066,12 @@ impl ChannelReestablish { #[no_mangle] pub extern "C" fn ChannelReestablish_get_channel_id(this_ptr: &ChannelReestablish) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn ChannelReestablish_set_channel_id(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The next commitment number for the sender #[no_mangle] @@ -5090,24 +5121,24 @@ pub extern "C" fn ChannelReestablish_set_my_current_per_commitment_point(this_pt } /// The next funding transaction ID #[no_mangle] -pub extern "C" fn ChannelReestablish_get_next_funding_txid(this_ptr: &ChannelReestablish) -> crate::c_types::derived::COption_TxidZ { +pub extern "C" fn ChannelReestablish_get_next_funding_txid(this_ptr: &ChannelReestablish) -> crate::c_types::derived::COption_ThirtyTwoBytesZ { let mut inner_val = &mut this_ptr.get_native_mut_ref().next_funding_txid; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_TxidZ::None } else { crate::c_types::derived::COption_TxidZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: (*inner_val.as_ref().unwrap()).clone().into_inner() } }) }; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: (*inner_val.as_ref().unwrap()).clone().into_inner() } }) }; local_inner_val } /// The next funding transaction ID #[no_mangle] -pub extern "C" fn ChannelReestablish_set_next_funding_txid(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::derived::COption_TxidZ) { +pub extern "C" fn ChannelReestablish_set_next_funding_txid(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::derived::COption_ThirtyTwoBytesZ) { let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::bitcoin::hash_types::Txid::from_slice(&{ val_opt.take() }.data[..]).unwrap() }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_funding_txid = local_val; } /// Constructs a new ChannelReestablish given each field #[must_use] #[no_mangle] -pub extern "C" fn ChannelReestablish_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut next_local_commitment_number_arg: u64, mut next_remote_commitment_number_arg: u64, mut your_last_per_commitment_secret_arg: crate::c_types::ThirtyTwoBytes, mut my_current_per_commitment_point_arg: crate::c_types::PublicKey, mut next_funding_txid_arg: crate::c_types::derived::COption_TxidZ) -> ChannelReestablish { +pub extern "C" fn ChannelReestablish_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut next_local_commitment_number_arg: u64, mut next_remote_commitment_number_arg: u64, mut your_last_per_commitment_secret_arg: crate::c_types::ThirtyTwoBytes, mut my_current_per_commitment_point_arg: crate::c_types::PublicKey, mut next_funding_txid_arg: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> ChannelReestablish { let mut local_next_funding_txid_arg = { /*next_funding_txid_arg*/ let next_funding_txid_arg_opt = next_funding_txid_arg; if next_funding_txid_arg_opt.is_none() { None } else { Some({ { ::bitcoin::hash_types::Txid::from_slice(&{ next_funding_txid_arg_opt.take() }.data[..]).unwrap() }})} }; ChannelReestablish { inner: ObjOps::heap_alloc(nativeChannelReestablish { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), next_local_commitment_number: next_local_commitment_number_arg, next_remote_commitment_number: next_remote_commitment_number_arg, your_last_per_commitment_secret: your_last_per_commitment_secret_arg.data, @@ -5200,12 +5231,12 @@ impl AnnouncementSignatures { #[no_mangle] pub extern "C" fn AnnouncementSignatures_get_channel_id(this_ptr: &AnnouncementSignatures) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - inner_val + &inner_val.0 } /// The channel ID #[no_mangle] pub extern "C" fn AnnouncementSignatures_set_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = val.data; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = ::lightning::ln::ChannelId(val.data); } /// The short channel ID #[no_mangle] @@ -5220,32 +5251,32 @@ pub extern "C" fn AnnouncementSignatures_set_short_channel_id(this_ptr: &mut Ann } /// A signature by the node key #[no_mangle] -pub extern "C" fn AnnouncementSignatures_get_node_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::Signature { +pub extern "C" fn AnnouncementSignatures_get_node_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().node_signature; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// A signature by the node key #[no_mangle] -pub extern "C" fn AnnouncementSignatures_set_node_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::Signature) { +pub extern "C" fn AnnouncementSignatures_set_node_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_signature = val.into_rust(); } /// A signature by the funding key #[no_mangle] -pub extern "C" fn AnnouncementSignatures_get_bitcoin_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::Signature { +pub extern "C" fn AnnouncementSignatures_get_bitcoin_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().bitcoin_signature; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// A signature by the funding key #[no_mangle] -pub extern "C" fn AnnouncementSignatures_set_bitcoin_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::Signature) { +pub extern "C" fn AnnouncementSignatures_set_bitcoin_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.bitcoin_signature = val.into_rust(); } /// Constructs a new AnnouncementSignatures given each field #[must_use] #[no_mangle] -pub extern "C" fn AnnouncementSignatures_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut short_channel_id_arg: u64, mut node_signature_arg: crate::c_types::Signature, mut bitcoin_signature_arg: crate::c_types::Signature) -> AnnouncementSignatures { +pub extern "C" fn AnnouncementSignatures_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut short_channel_id_arg: u64, mut node_signature_arg: crate::c_types::ECDSASignature, mut bitcoin_signature_arg: crate::c_types::ECDSASignature) -> AnnouncementSignatures { AnnouncementSignatures { inner: ObjOps::heap_alloc(nativeAnnouncementSignatures { - channel_id: channel_id_arg.data, + channel_id: ::lightning::ln::ChannelId(channel_id_arg.data), short_channel_id: short_channel_id_arg, node_signature: node_signature_arg.into_rust(), bitcoin_signature: bitcoin_signature_arg.into_rust(), @@ -5283,16 +5314,16 @@ pub extern "C" fn AnnouncementSignatures_eq(a: &AnnouncementSignatures, b: &Anno #[derive(Clone)] #[must_use] #[repr(C)] -pub enum NetAddress { - /// An IPv4 address/port on which the peer is listening. - IPv4 { +pub enum SocketAddress { + /// An IPv4 address and port on which the peer is listening. + TcpIpV4 { /// The 4-byte IPv4 address addr: crate::c_types::FourBytes, /// The port on which the node is listening port: u16, }, - /// An IPv6 address/port on which the peer is listening. - IPv6 { + /// An IPv6 address and port on which the peer is listening. + TcpIpV6 { /// The 16-byte IPv6 address addr: crate::c_types::SixteenBytes, /// The port on which the node is listening @@ -5326,51 +5357,51 @@ pub enum NetAddress { port: u16, }, } -use lightning::ln::msgs::NetAddress as NetAddressImport; -pub(crate) type nativeNetAddress = NetAddressImport; +use lightning::ln::msgs::SocketAddress as SocketAddressImport; +pub(crate) type nativeSocketAddress = SocketAddressImport; -impl NetAddress { +impl SocketAddress { #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeNetAddress { + pub(crate) fn to_native(&self) -> nativeSocketAddress { match self { - NetAddress::IPv4 {ref addr, ref port, } => { + SocketAddress::TcpIpV4 {ref addr, ref port, } => { let mut addr_nonref = Clone::clone(addr); let mut port_nonref = Clone::clone(port); - nativeNetAddress::IPv4 { + nativeSocketAddress::TcpIpV4 { addr: addr_nonref.data, port: port_nonref, } }, - NetAddress::IPv6 {ref addr, ref port, } => { + SocketAddress::TcpIpV6 {ref addr, ref port, } => { let mut addr_nonref = Clone::clone(addr); let mut port_nonref = Clone::clone(port); - nativeNetAddress::IPv6 { + nativeSocketAddress::TcpIpV6 { addr: addr_nonref.data, port: port_nonref, } }, - NetAddress::OnionV2 (ref a, ) => { + SocketAddress::OnionV2 (ref a, ) => { let mut a_nonref = Clone::clone(a); - nativeNetAddress::OnionV2 ( + nativeSocketAddress::OnionV2 ( a_nonref.data, ) }, - NetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => { + SocketAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => { let mut ed25519_pubkey_nonref = Clone::clone(ed25519_pubkey); let mut checksum_nonref = Clone::clone(checksum); let mut version_nonref = Clone::clone(version); let mut port_nonref = Clone::clone(port); - nativeNetAddress::OnionV3 { + nativeSocketAddress::OnionV3 { ed25519_pubkey: ed25519_pubkey_nonref.data, checksum: checksum_nonref, version: version_nonref, port: port_nonref, } }, - NetAddress::Hostname {ref hostname, ref port, } => { + SocketAddress::Hostname {ref hostname, ref port, } => { let mut hostname_nonref = Clone::clone(hostname); let mut port_nonref = Clone::clone(port); - nativeNetAddress::Hostname { + nativeSocketAddress::Hostname { hostname: *unsafe { Box::from_raw(hostname_nonref.take_inner()) }, port: port_nonref, } @@ -5378,35 +5409,35 @@ impl NetAddress { } } #[allow(unused)] - pub(crate) fn into_native(self) -> nativeNetAddress { + pub(crate) fn into_native(self) -> nativeSocketAddress { match self { - NetAddress::IPv4 {mut addr, mut port, } => { - nativeNetAddress::IPv4 { + SocketAddress::TcpIpV4 {mut addr, mut port, } => { + nativeSocketAddress::TcpIpV4 { addr: addr.data, port: port, } }, - NetAddress::IPv6 {mut addr, mut port, } => { - nativeNetAddress::IPv6 { + SocketAddress::TcpIpV6 {mut addr, mut port, } => { + nativeSocketAddress::TcpIpV6 { addr: addr.data, port: port, } }, - NetAddress::OnionV2 (mut a, ) => { - nativeNetAddress::OnionV2 ( + SocketAddress::OnionV2 (mut a, ) => { + nativeSocketAddress::OnionV2 ( a.data, ) }, - NetAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => { - nativeNetAddress::OnionV3 { + SocketAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => { + nativeSocketAddress::OnionV3 { ed25519_pubkey: ed25519_pubkey.data, checksum: checksum, version: version, port: port, } }, - NetAddress::Hostname {mut hostname, mut port, } => { - nativeNetAddress::Hostname { + SocketAddress::Hostname {mut hostname, mut port, } => { + nativeSocketAddress::Hostname { hostname: *unsafe { Box::from_raw(hostname.take_inner()) }, port: port, } @@ -5414,46 +5445,46 @@ impl NetAddress { } } #[allow(unused)] - pub(crate) fn from_native(native: &nativeNetAddress) -> Self { + pub(crate) fn from_native(native: &nativeSocketAddress) -> Self { match native { - nativeNetAddress::IPv4 {ref addr, ref port, } => { + nativeSocketAddress::TcpIpV4 {ref addr, ref port, } => { let mut addr_nonref = Clone::clone(addr); let mut port_nonref = Clone::clone(port); - NetAddress::IPv4 { + SocketAddress::TcpIpV4 { addr: crate::c_types::FourBytes { data: addr_nonref }, port: port_nonref, } }, - nativeNetAddress::IPv6 {ref addr, ref port, } => { + nativeSocketAddress::TcpIpV6 {ref addr, ref port, } => { let mut addr_nonref = Clone::clone(addr); let mut port_nonref = Clone::clone(port); - NetAddress::IPv6 { + SocketAddress::TcpIpV6 { addr: crate::c_types::SixteenBytes { data: addr_nonref }, port: port_nonref, } }, - nativeNetAddress::OnionV2 (ref a, ) => { + nativeSocketAddress::OnionV2 (ref a, ) => { let mut a_nonref = Clone::clone(a); - NetAddress::OnionV2 ( + SocketAddress::OnionV2 ( crate::c_types::TwelveBytes { data: a_nonref }, ) }, - nativeNetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => { + nativeSocketAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => { let mut ed25519_pubkey_nonref = Clone::clone(ed25519_pubkey); let mut checksum_nonref = Clone::clone(checksum); let mut version_nonref = Clone::clone(version); let mut port_nonref = Clone::clone(port); - NetAddress::OnionV3 { + SocketAddress::OnionV3 { ed25519_pubkey: crate::c_types::ThirtyTwoBytes { data: ed25519_pubkey_nonref }, checksum: checksum_nonref, version: version_nonref, port: port_nonref, } }, - nativeNetAddress::Hostname {ref hostname, ref port, } => { + nativeSocketAddress::Hostname {ref hostname, ref port, } => { let mut hostname_nonref = Clone::clone(hostname); let mut port_nonref = Clone::clone(port); - NetAddress::Hostname { + SocketAddress::Hostname { hostname: crate::lightning::util::ser::Hostname { inner: ObjOps::heap_alloc(hostname_nonref), is_owned: true }, port: port_nonref, } @@ -5461,35 +5492,35 @@ impl NetAddress { } } #[allow(unused)] - pub(crate) fn native_into(native: nativeNetAddress) -> Self { + pub(crate) fn native_into(native: nativeSocketAddress) -> Self { match native { - nativeNetAddress::IPv4 {mut addr, mut port, } => { - NetAddress::IPv4 { + nativeSocketAddress::TcpIpV4 {mut addr, mut port, } => { + SocketAddress::TcpIpV4 { addr: crate::c_types::FourBytes { data: addr }, port: port, } }, - nativeNetAddress::IPv6 {mut addr, mut port, } => { - NetAddress::IPv6 { + nativeSocketAddress::TcpIpV6 {mut addr, mut port, } => { + SocketAddress::TcpIpV6 { addr: crate::c_types::SixteenBytes { data: addr }, port: port, } }, - nativeNetAddress::OnionV2 (mut a, ) => { - NetAddress::OnionV2 ( + nativeSocketAddress::OnionV2 (mut a, ) => { + SocketAddress::OnionV2 ( crate::c_types::TwelveBytes { data: a }, ) }, - nativeNetAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => { - NetAddress::OnionV3 { + nativeSocketAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => { + SocketAddress::OnionV3 { ed25519_pubkey: crate::c_types::ThirtyTwoBytes { data: ed25519_pubkey }, checksum: checksum, version: version, port: port, } }, - nativeNetAddress::Hostname {mut hostname, mut port, } => { - NetAddress::Hostname { + nativeSocketAddress::Hostname {mut hostname, mut port, } => { + SocketAddress::Hostname { hostname: crate::lightning::util::ser::Hostname { inner: ObjOps::heap_alloc(hostname), is_owned: true }, port: port, } @@ -5497,39 +5528,39 @@ impl NetAddress { } } } -/// Frees any resources used by the NetAddress +/// Frees any resources used by the SocketAddress #[no_mangle] -pub extern "C" fn NetAddress_free(this_ptr: NetAddress) { } -/// Creates a copy of the NetAddress +pub extern "C" fn SocketAddress_free(this_ptr: SocketAddress) { } +/// Creates a copy of the SocketAddress #[no_mangle] -pub extern "C" fn NetAddress_clone(orig: &NetAddress) -> NetAddress { +pub extern "C" fn SocketAddress_clone(orig: &SocketAddress) -> SocketAddress { orig.clone() } #[no_mangle] -/// Utility method to constructs a new IPv4-variant NetAddress -pub extern "C" fn NetAddress_ipv4(addr: crate::c_types::FourBytes, port: u16) -> NetAddress { - NetAddress::IPv4 { +/// Utility method to constructs a new TcpIpV4-variant SocketAddress +pub extern "C" fn SocketAddress_tcp_ip_v4(addr: crate::c_types::FourBytes, port: u16) -> SocketAddress { + SocketAddress::TcpIpV4 { addr, port, } } #[no_mangle] -/// Utility method to constructs a new IPv6-variant NetAddress -pub extern "C" fn NetAddress_ipv6(addr: crate::c_types::SixteenBytes, port: u16) -> NetAddress { - NetAddress::IPv6 { +/// Utility method to constructs a new TcpIpV6-variant SocketAddress +pub extern "C" fn SocketAddress_tcp_ip_v6(addr: crate::c_types::SixteenBytes, port: u16) -> SocketAddress { + SocketAddress::TcpIpV6 { addr, port, } } #[no_mangle] -/// Utility method to constructs a new OnionV2-variant NetAddress -pub extern "C" fn NetAddress_onion_v2(a: crate::c_types::TwelveBytes) -> NetAddress { - NetAddress::OnionV2(a, ) +/// Utility method to constructs a new OnionV2-variant SocketAddress +pub extern "C" fn SocketAddress_onion_v2(a: crate::c_types::TwelveBytes) -> SocketAddress { + SocketAddress::OnionV2(a, ) } #[no_mangle] -/// Utility method to constructs a new OnionV3-variant NetAddress -pub extern "C" fn NetAddress_onion_v3(ed25519_pubkey: crate::c_types::ThirtyTwoBytes, checksum: u16, version: u8, port: u16) -> NetAddress { - NetAddress::OnionV3 { +/// Utility method to constructs a new OnionV3-variant SocketAddress +pub extern "C" fn SocketAddress_onion_v3(ed25519_pubkey: crate::c_types::ThirtyTwoBytes, checksum: u16, version: u8, port: u16) -> SocketAddress { + SocketAddress::OnionV3 { ed25519_pubkey, checksum, version, @@ -5537,31 +5568,139 @@ pub extern "C" fn NetAddress_onion_v3(ed25519_pubkey: crate::c_types::ThirtyTwoB } } #[no_mangle] -/// Utility method to constructs a new Hostname-variant NetAddress -pub extern "C" fn NetAddress_hostname(hostname: crate::lightning::util::ser::Hostname, port: u16) -> NetAddress { - NetAddress::Hostname { +/// Utility method to constructs a new Hostname-variant SocketAddress +pub extern "C" fn SocketAddress_hostname(hostname: crate::lightning::util::ser::Hostname, port: u16) -> SocketAddress { + SocketAddress::Hostname { hostname, port, } } -/// Checks if two NetAddresss contain equal inner contents. +/// Checks if two SocketAddresss contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. #[no_mangle] -pub extern "C" fn NetAddress_eq(a: &NetAddress, b: &NetAddress) -> bool { +pub extern "C" fn SocketAddress_eq(a: &SocketAddress, b: &SocketAddress) -> bool { if &a.to_native() == &b.to_native() { true } else { false } } #[no_mangle] -/// Serialize the NetAddress object into a byte array which can be read by NetAddress_read -pub extern "C" fn NetAddress_write(obj: &crate::lightning::ln::msgs::NetAddress) -> crate::c_types::derived::CVec_u8Z { +/// Serialize the SocketAddress object into a byte array which can be read by SocketAddress_read +pub extern "C" fn SocketAddress_write(obj: &crate::lightning::ln::msgs::SocketAddress) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) } #[no_mangle] -/// Read a NetAddress from a byte array, created by NetAddress_write -pub extern "C" fn NetAddress_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NetAddressDecodeErrorZ { - let res: Result = crate::c_types::deserialize_obj(ser); - let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::NetAddress::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; +/// Read a SocketAddress from a byte array, created by SocketAddress_write +pub extern "C" fn SocketAddress_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_SocketAddressDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::SocketAddress::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_res } +/// [`SocketAddress`] error variants +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum SocketAddressParseError { + /// Socket address (IPv4/IPv6) parsing error + SocketAddrParse, + /// Invalid input format + InvalidInput, + /// Invalid port + InvalidPort, + /// Invalid onion v3 address + InvalidOnionV3, +} +use lightning::ln::msgs::SocketAddressParseError as SocketAddressParseErrorImport; +pub(crate) type nativeSocketAddressParseError = SocketAddressParseErrorImport; + +impl SocketAddressParseError { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeSocketAddressParseError { + match self { + SocketAddressParseError::SocketAddrParse => nativeSocketAddressParseError::SocketAddrParse, + SocketAddressParseError::InvalidInput => nativeSocketAddressParseError::InvalidInput, + SocketAddressParseError::InvalidPort => nativeSocketAddressParseError::InvalidPort, + SocketAddressParseError::InvalidOnionV3 => nativeSocketAddressParseError::InvalidOnionV3, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeSocketAddressParseError { + match self { + SocketAddressParseError::SocketAddrParse => nativeSocketAddressParseError::SocketAddrParse, + SocketAddressParseError::InvalidInput => nativeSocketAddressParseError::InvalidInput, + SocketAddressParseError::InvalidPort => nativeSocketAddressParseError::InvalidPort, + SocketAddressParseError::InvalidOnionV3 => nativeSocketAddressParseError::InvalidOnionV3, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &nativeSocketAddressParseError) -> Self { + match native { + nativeSocketAddressParseError::SocketAddrParse => SocketAddressParseError::SocketAddrParse, + nativeSocketAddressParseError::InvalidInput => SocketAddressParseError::InvalidInput, + nativeSocketAddressParseError::InvalidPort => SocketAddressParseError::InvalidPort, + nativeSocketAddressParseError::InvalidOnionV3 => SocketAddressParseError::InvalidOnionV3, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeSocketAddressParseError) -> Self { + match native { + nativeSocketAddressParseError::SocketAddrParse => SocketAddressParseError::SocketAddrParse, + nativeSocketAddressParseError::InvalidInput => SocketAddressParseError::InvalidInput, + nativeSocketAddressParseError::InvalidPort => SocketAddressParseError::InvalidPort, + nativeSocketAddressParseError::InvalidOnionV3 => SocketAddressParseError::InvalidOnionV3, + } + } +} +/// Creates a copy of the SocketAddressParseError +#[no_mangle] +pub extern "C" fn SocketAddressParseError_clone(orig: &SocketAddressParseError) -> SocketAddressParseError { + orig.clone() +} +#[no_mangle] +/// Utility method to constructs a new SocketAddrParse-variant SocketAddressParseError +pub extern "C" fn SocketAddressParseError_socket_addr_parse() -> SocketAddressParseError { + SocketAddressParseError::SocketAddrParse} +#[no_mangle] +/// Utility method to constructs a new InvalidInput-variant SocketAddressParseError +pub extern "C" fn SocketAddressParseError_invalid_input() -> SocketAddressParseError { + SocketAddressParseError::InvalidInput} +#[no_mangle] +/// Utility method to constructs a new InvalidPort-variant SocketAddressParseError +pub extern "C" fn SocketAddressParseError_invalid_port() -> SocketAddressParseError { + SocketAddressParseError::InvalidPort} +#[no_mangle] +/// Utility method to constructs a new InvalidOnionV3-variant SocketAddressParseError +pub extern "C" fn SocketAddressParseError_invalid_onion_v3() -> SocketAddressParseError { + SocketAddressParseError::InvalidOnionV3} +/// Checks if two SocketAddressParseErrors contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +#[no_mangle] +pub extern "C" fn SocketAddressParseError_eq(a: &SocketAddressParseError, b: &SocketAddressParseError) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } +} +/// Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`]. +/// +/// The host part must end with \".onion\". +#[no_mangle] +pub extern "C" fn parse_onion_address(mut host: crate::c_types::Str, mut port: u16) -> crate::c_types::derived::CResult_SocketAddressSocketAddressParseErrorZ { + let mut ret = lightning::ln::msgs::parse_onion_address(host.into_str(), port); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::SocketAddress::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::SocketAddressParseError::native_into(e) }).into() }; + local_ret +} + +#[no_mangle] +/// Read a SocketAddress object from a string +pub extern "C" fn SocketAddress_from_str(s: crate::c_types::Str) -> crate::c_types::derived::CResult_SocketAddressSocketAddressParseErrorZ { + match lightning::ln::msgs::SocketAddress::from_str(s.into_str()) { + Ok(r) => { + crate::c_types::CResultTempl::ok( + crate::lightning::ln::msgs::SocketAddress::native_into(r) + ) + }, + Err(e) => { + crate::c_types::CResultTempl::err( + crate::lightning::ln::msgs::SocketAddressParseError::native_into(e) + ) + }, + }.into() +} /// Represents the set of gossip messages that require a signature from a node's identity key. #[derive(Clone)] #[must_use] @@ -5814,14 +5953,14 @@ pub extern "C" fn UnsignedNodeAnnouncement_set_alias(this_ptr: &mut UnsignedNode /// /// Returns a copy of the field. #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_get_addresses(this_ptr: &UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_NetAddressZ { +pub extern "C" fn UnsignedNodeAnnouncement_get_addresses(this_ptr: &UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_SocketAddressZ { let mut inner_val = this_ptr.get_native_mut_ref().addresses.clone(); - let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { crate::lightning::ln::msgs::NetAddress::native_into(item) }); }; + let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { crate::lightning::ln::msgs::SocketAddress::native_into(item) }); }; local_inner_val.into() } /// List of addresses on which this node is reachable #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_set_addresses(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::derived::CVec_NetAddressZ) { +pub extern "C" fn UnsignedNodeAnnouncement_set_addresses(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::derived::CVec_SocketAddressZ) { let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_native() }); }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.addresses = local_val; } @@ -5908,13 +6047,13 @@ impl NodeAnnouncement { } /// The signature by the node key #[no_mangle] -pub extern "C" fn NodeAnnouncement_get_signature(this_ptr: &NodeAnnouncement) -> crate::c_types::Signature { +pub extern "C" fn NodeAnnouncement_get_signature(this_ptr: &NodeAnnouncement) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().signature; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// The signature by the node key #[no_mangle] -pub extern "C" fn NodeAnnouncement_set_signature(this_ptr: &mut NodeAnnouncement, mut val: crate::c_types::Signature) { +pub extern "C" fn NodeAnnouncement_set_signature(this_ptr: &mut NodeAnnouncement, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.signature = val.into_rust(); } /// The actual content of the announcement @@ -5931,7 +6070,7 @@ pub extern "C" fn NodeAnnouncement_set_contents(this_ptr: &mut NodeAnnouncement, /// Constructs a new NodeAnnouncement given each field #[must_use] #[no_mangle] -pub extern "C" fn NodeAnnouncement_new(mut signature_arg: crate::c_types::Signature, mut contents_arg: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> NodeAnnouncement { +pub extern "C" fn NodeAnnouncement_new(mut signature_arg: crate::c_types::ECDSASignature, mut contents_arg: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> NodeAnnouncement { NodeAnnouncement { inner: ObjOps::heap_alloc(nativeNodeAnnouncement { signature: signature_arg.into_rust(), contents: *unsafe { Box::from_raw(contents_arg.take_inner()) }, @@ -6095,6 +6234,43 @@ pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_2(this_ptr: &Unsig pub extern "C" fn UnsignedChannelAnnouncement_set_bitcoin_key_2(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::lightning::routing::gossip::NodeId) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.bitcoin_key_2 = *unsafe { Box::from_raw(val.take_inner()) }; } +/// Excess data which was signed as a part of the message which we do not (yet) understand how +/// to decode. +/// +/// This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. +/// +/// Returns a copy of the field. +#[no_mangle] +pub extern "C" fn UnsignedChannelAnnouncement_get_excess_data(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = this_ptr.get_native_mut_ref().excess_data.clone(); + let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { item }); }; + local_inner_val.into() +} +/// Excess data which was signed as a part of the message which we do not (yet) understand how +/// to decode. +/// +/// This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. +#[no_mangle] +pub extern "C" fn UnsignedChannelAnnouncement_set_excess_data(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::derived::CVec_u8Z) { + let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.excess_data = local_val; +} +/// Constructs a new UnsignedChannelAnnouncement given each field +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedChannelAnnouncement_new(mut features_arg: crate::lightning::ln::features::ChannelFeatures, mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut short_channel_id_arg: u64, mut node_id_1_arg: crate::lightning::routing::gossip::NodeId, mut node_id_2_arg: crate::lightning::routing::gossip::NodeId, mut bitcoin_key_1_arg: crate::lightning::routing::gossip::NodeId, mut bitcoin_key_2_arg: crate::lightning::routing::gossip::NodeId, mut excess_data_arg: crate::c_types::derived::CVec_u8Z) -> UnsignedChannelAnnouncement { + let mut local_excess_data_arg = Vec::new(); for mut item in excess_data_arg.into_rust().drain(..) { local_excess_data_arg.push( { item }); }; + UnsignedChannelAnnouncement { inner: ObjOps::heap_alloc(nativeUnsignedChannelAnnouncement { + features: *unsafe { Box::from_raw(features_arg.take_inner()) }, + chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(), + short_channel_id: short_channel_id_arg, + node_id_1: *unsafe { Box::from_raw(node_id_1_arg.take_inner()) }, + node_id_2: *unsafe { Box::from_raw(node_id_2_arg.take_inner()) }, + bitcoin_key_1: *unsafe { Box::from_raw(bitcoin_key_1_arg.take_inner()) }, + bitcoin_key_2: *unsafe { Box::from_raw(bitcoin_key_2_arg.take_inner()) }, + excess_data: local_excess_data_arg, + }), is_owned: true } +} impl Clone for UnsignedChannelAnnouncement { fn clone(&self) -> Self { Self { @@ -6178,46 +6354,46 @@ impl ChannelAnnouncement { } /// Authentication of the announcement by the first public node #[no_mangle] -pub extern "C" fn ChannelAnnouncement_get_node_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature { +pub extern "C" fn ChannelAnnouncement_get_node_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().node_signature_1; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// Authentication of the announcement by the first public node #[no_mangle] -pub extern "C" fn ChannelAnnouncement_set_node_signature_1(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) { +pub extern "C" fn ChannelAnnouncement_set_node_signature_1(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_signature_1 = val.into_rust(); } /// Authentication of the announcement by the second public node #[no_mangle] -pub extern "C" fn ChannelAnnouncement_get_node_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature { +pub extern "C" fn ChannelAnnouncement_get_node_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().node_signature_2; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// Authentication of the announcement by the second public node #[no_mangle] -pub extern "C" fn ChannelAnnouncement_set_node_signature_2(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) { +pub extern "C" fn ChannelAnnouncement_set_node_signature_2(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_signature_2 = val.into_rust(); } /// Proof of funding UTXO ownership by the first public node #[no_mangle] -pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature { +pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().bitcoin_signature_1; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// Proof of funding UTXO ownership by the first public node #[no_mangle] -pub extern "C" fn ChannelAnnouncement_set_bitcoin_signature_1(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) { +pub extern "C" fn ChannelAnnouncement_set_bitcoin_signature_1(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.bitcoin_signature_1 = val.into_rust(); } /// Proof of funding UTXO ownership by the second public node #[no_mangle] -pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::Signature { +pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().bitcoin_signature_2; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// Proof of funding UTXO ownership by the second public node #[no_mangle] -pub extern "C" fn ChannelAnnouncement_set_bitcoin_signature_2(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::Signature) { +pub extern "C" fn ChannelAnnouncement_set_bitcoin_signature_2(this_ptr: &mut ChannelAnnouncement, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.bitcoin_signature_2 = val.into_rust(); } /// The actual announcement @@ -6234,7 +6410,7 @@ pub extern "C" fn ChannelAnnouncement_set_contents(this_ptr: &mut ChannelAnnounc /// Constructs a new ChannelAnnouncement given each field #[must_use] #[no_mangle] -pub extern "C" fn ChannelAnnouncement_new(mut node_signature_1_arg: crate::c_types::Signature, mut node_signature_2_arg: crate::c_types::Signature, mut bitcoin_signature_1_arg: crate::c_types::Signature, mut bitcoin_signature_2_arg: crate::c_types::Signature, mut contents_arg: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> ChannelAnnouncement { +pub extern "C" fn ChannelAnnouncement_new(mut node_signature_1_arg: crate::c_types::ECDSASignature, mut node_signature_2_arg: crate::c_types::ECDSASignature, mut bitcoin_signature_1_arg: crate::c_types::ECDSASignature, mut bitcoin_signature_2_arg: crate::c_types::ECDSASignature, mut contents_arg: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> ChannelAnnouncement { ChannelAnnouncement { inner: ObjOps::heap_alloc(nativeChannelAnnouncement { node_signature_1: node_signature_1_arg.into_rust(), node_signature_2: node_signature_2_arg.into_rust(), @@ -6563,13 +6739,13 @@ impl ChannelUpdate { } /// A signature of the channel update #[no_mangle] -pub extern "C" fn ChannelUpdate_get_signature(this_ptr: &ChannelUpdate) -> crate::c_types::Signature { +pub extern "C" fn ChannelUpdate_get_signature(this_ptr: &ChannelUpdate) -> crate::c_types::ECDSASignature { let mut inner_val = &mut this_ptr.get_native_mut_ref().signature; - crate::c_types::Signature::from_rust(&inner_val) + crate::c_types::ECDSASignature::from_rust(&inner_val) } /// A signature of the channel update #[no_mangle] -pub extern "C" fn ChannelUpdate_set_signature(this_ptr: &mut ChannelUpdate, mut val: crate::c_types::Signature) { +pub extern "C" fn ChannelUpdate_set_signature(this_ptr: &mut ChannelUpdate, mut val: crate::c_types::ECDSASignature) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.signature = val.into_rust(); } /// The actual channel update @@ -6586,7 +6762,7 @@ pub extern "C" fn ChannelUpdate_set_contents(this_ptr: &mut ChannelUpdate, mut v /// Constructs a new ChannelUpdate given each field #[must_use] #[no_mangle] -pub extern "C" fn ChannelUpdate_new(mut signature_arg: crate::c_types::Signature, mut contents_arg: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> ChannelUpdate { +pub extern "C" fn ChannelUpdate_new(mut signature_arg: crate::c_types::ECDSASignature, mut contents_arg: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> ChannelUpdate { ChannelUpdate { inner: ObjOps::heap_alloc(nativeChannelUpdate { signature: signature_arg.into_rust(), contents: *unsafe { Box::from_raw(contents_arg.take_inner()) }, @@ -7755,6 +7931,8 @@ pub extern "C" fn CommitmentUpdate_set_commitment_signed(this_ptr: &mut Commitme unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.commitment_signed = *unsafe { Box::from_raw(val.take_inner()) }; } /// Constructs a new CommitmentUpdate given each field +/// +/// Note that update_fee_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] pub extern "C" fn CommitmentUpdate_new(mut update_add_htlcs_arg: crate::c_types::derived::CVec_UpdateAddHTLCZ, mut update_fulfill_htlcs_arg: crate::c_types::derived::CVec_UpdateFulfillHTLCZ, mut update_fail_htlcs_arg: crate::c_types::derived::CVec_UpdateFailHTLCZ, mut update_fail_malformed_htlcs_arg: crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ, mut update_fee_arg: crate::lightning::ln::msgs::UpdateFee, mut commitment_signed_arg: crate::lightning::ln::msgs::CommitmentSigned) -> CommitmentUpdate { @@ -7889,7 +8067,7 @@ pub struct ChannelMessageHandler { /// /// If it's `None`, then no particular network chain hash compatibility will be enforced when /// connecting to peers. - pub get_genesis_hashes: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ChainHashZZ, + pub get_genesis_hashes: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ, /// Implementation of MessageSendEventsProvider for this object. pub MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider, /// Frees any resources associated with this object given its this_arg pointer. @@ -7898,8 +8076,7 @@ pub struct ChannelMessageHandler { } unsafe impl Send for ChannelMessageHandler {} unsafe impl Sync for ChannelMessageHandler {} -#[no_mangle] -pub(crate) extern "C" fn ChannelMessageHandler_clone_fields(orig: &ChannelMessageHandler) -> ChannelMessageHandler { +pub(crate) fn ChannelMessageHandler_clone_fields(orig: &ChannelMessageHandler) -> ChannelMessageHandler { ChannelMessageHandler { this_arg: orig.this_arg, handle_open_channel: Clone::clone(&orig.handle_open_channel), @@ -8068,6 +8245,11 @@ impl core::ops::Deref for ChannelMessageHandler { self } } +impl core::ops::DerefMut for ChannelMessageHandler { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn ChannelMessageHandler_free(this_ptr: ChannelMessageHandler) { } @@ -8157,8 +8339,7 @@ pub struct RoutingMessageHandler { } unsafe impl Send for RoutingMessageHandler {} unsafe impl Sync for RoutingMessageHandler {} -#[no_mangle] -pub(crate) extern "C" fn RoutingMessageHandler_clone_fields(orig: &RoutingMessageHandler) -> RoutingMessageHandler { +pub(crate) fn RoutingMessageHandler_clone_fields(orig: &RoutingMessageHandler) -> RoutingMessageHandler { RoutingMessageHandler { this_arg: orig.this_arg, handle_node_announcement: Clone::clone(&orig.handle_node_announcement), @@ -8261,6 +8442,11 @@ impl core::ops::Deref for RoutingMessageHandler { self } } +impl core::ops::DerefMut for RoutingMessageHandler { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn RoutingMessageHandler_free(this_ptr: RoutingMessageHandler) { } @@ -8307,8 +8493,7 @@ pub struct OnionMessageHandler { } unsafe impl Send for OnionMessageHandler {} unsafe impl Sync for OnionMessageHandler {} -#[no_mangle] -pub(crate) extern "C" fn OnionMessageHandler_clone_fields(orig: &OnionMessageHandler) -> OnionMessageHandler { +pub(crate) fn OnionMessageHandler_clone_fields(orig: &OnionMessageHandler) -> OnionMessageHandler { OnionMessageHandler { this_arg: orig.this_arg, handle_onion_message: Clone::clone(&orig.handle_onion_message), @@ -8359,6 +8544,11 @@ impl core::ops::Deref for OnionMessageHandler { self } } +impl core::ops::DerefMut for OnionMessageHandler { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn OnionMessageHandler_free(this_ptr: OnionMessageHandler) { } @@ -8372,6 +8562,7 @@ impl Drop for OnionMessageHandler { mod fuzzy_internal_msgs { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/ln/outbound_payment.rs b/lightning-c-bindings/src/lightning/ln/outbound_payment.rs index 05afcdc2..946122ed 100644 --- a/lightning-c-bindings/src/lightning/ln/outbound_payment.rs +++ b/lightning-c-bindings/src/lightning/ln/outbound_payment.rs @@ -9,6 +9,7 @@ //! Utilities to send payments and manage outbound payment information. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -27,7 +28,7 @@ pub enum Retry { /// retry, and may retry multiple failed HTLCs at once if they failed around the same time and /// were retried along a route from a single call to [`Router::find_route_with_id`]. Attempts( - usize), + u32), /// Time elapsed before abandoning retries for a payment. At least one attempt at payment is made; /// see [`PaymentParameters::expiry_time`] to avoid any attempt at payment after a specific time. /// @@ -114,7 +115,7 @@ pub extern "C" fn Retry_clone(orig: &Retry) -> Retry { } #[no_mangle] /// Utility method to constructs a new Attempts-variant Retry -pub extern "C" fn Retry_attempts(a: usize) -> Retry { +pub extern "C" fn Retry_attempts(a: u32) -> Retry { Retry::Attempts(a, ) } #[no_mangle] @@ -137,6 +138,18 @@ pub extern "C" fn Retry_hash(o: &Retry) -> u64 { core::hash::Hash::hash(&o.to_native(), &mut hasher); core::hash::Hasher::finish(&hasher) } +#[no_mangle] +/// Serialize the Retry object into a byte array which can be read by Retry_read +pub extern "C" fn Retry_write(obj: &crate::lightning::ln::outbound_payment::Retry) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) +} +#[no_mangle] +/// Read a Retry from a byte array, created by Retry_write +pub extern "C" fn Retry_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RetryDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::outbound_payment::Retry::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} /// Indicates an immediate error on [`ChannelManager::send_payment`]. Further errors may be /// surfaced later via [`Event::PaymentPathFailed`] and [`Event::PaymentFailed`]. /// @@ -479,6 +492,100 @@ pub extern "C" fn PaymentSendFailure_partial_failure(results: crate::c_types::de payment_id, } } +/// Checks if two PaymentSendFailures contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +#[no_mangle] +pub extern "C" fn PaymentSendFailure_eq(a: &PaymentSendFailure, b: &PaymentSendFailure) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } +} +/// Indicates that we failed to send a payment probe. Further errors may be surfaced later via +/// [`Event::ProbeFailed`]. +/// +/// [`Event::ProbeFailed`]: crate::events::Event::ProbeFailed +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum ProbeSendFailure { + /// We were unable to find a route to the destination. + RouteNotFound, + /// We failed to send the payment probes. + SendingFailed( + crate::lightning::ln::outbound_payment::PaymentSendFailure), +} +use lightning::ln::outbound_payment::ProbeSendFailure as ProbeSendFailureImport; +pub(crate) type nativeProbeSendFailure = ProbeSendFailureImport; + +impl ProbeSendFailure { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeProbeSendFailure { + match self { + ProbeSendFailure::RouteNotFound => nativeProbeSendFailure::RouteNotFound, + ProbeSendFailure::SendingFailed (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeProbeSendFailure::SendingFailed ( + a_nonref.into_native(), + ) + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeProbeSendFailure { + match self { + ProbeSendFailure::RouteNotFound => nativeProbeSendFailure::RouteNotFound, + ProbeSendFailure::SendingFailed (mut a, ) => { + nativeProbeSendFailure::SendingFailed ( + a.into_native(), + ) + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &nativeProbeSendFailure) -> Self { + match native { + nativeProbeSendFailure::RouteNotFound => ProbeSendFailure::RouteNotFound, + nativeProbeSendFailure::SendingFailed (ref a, ) => { + let mut a_nonref = Clone::clone(a); + ProbeSendFailure::SendingFailed ( + crate::lightning::ln::outbound_payment::PaymentSendFailure::native_into(a_nonref), + ) + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeProbeSendFailure) -> Self { + match native { + nativeProbeSendFailure::RouteNotFound => ProbeSendFailure::RouteNotFound, + nativeProbeSendFailure::SendingFailed (mut a, ) => { + ProbeSendFailure::SendingFailed ( + crate::lightning::ln::outbound_payment::PaymentSendFailure::native_into(a), + ) + }, + } + } +} +/// Frees any resources used by the ProbeSendFailure +#[no_mangle] +pub extern "C" fn ProbeSendFailure_free(this_ptr: ProbeSendFailure) { } +/// Creates a copy of the ProbeSendFailure +#[no_mangle] +pub extern "C" fn ProbeSendFailure_clone(orig: &ProbeSendFailure) -> ProbeSendFailure { + orig.clone() +} +#[no_mangle] +/// Utility method to constructs a new RouteNotFound-variant ProbeSendFailure +pub extern "C" fn ProbeSendFailure_route_not_found() -> ProbeSendFailure { + ProbeSendFailure::RouteNotFound} +#[no_mangle] +/// Utility method to constructs a new SendingFailed-variant ProbeSendFailure +pub extern "C" fn ProbeSendFailure_sending_failed(a: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> ProbeSendFailure { + ProbeSendFailure::SendingFailed(a, ) +} +/// Checks if two ProbeSendFailures contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +#[no_mangle] +pub extern "C" fn ProbeSendFailure_eq(a: &ProbeSendFailure, b: &ProbeSendFailure) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } +} use lightning::ln::outbound_payment::RecipientOnionFields as nativeRecipientOnionFieldsImport; pub(crate) type nativeRecipientOnionFields = nativeRecipientOnionFieldsImport; @@ -545,9 +652,9 @@ impl RecipientOnionFields { /// want to provide a secret for a spontaneous payment if MPP is needed and you know your /// recipient will not reject it. #[no_mangle] -pub extern "C" fn RecipientOnionFields_get_payment_secret(this_ptr: &RecipientOnionFields) -> crate::c_types::derived::COption_PaymentSecretZ { +pub extern "C" fn RecipientOnionFields_get_payment_secret(this_ptr: &RecipientOnionFields) -> crate::c_types::derived::COption_ThirtyTwoBytesZ { let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_secret; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_PaymentSecretZ::None } else { crate::c_types::derived::COption_PaymentSecretZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: (*inner_val.as_ref().unwrap()).clone().0 } }) }; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: (*inner_val.as_ref().unwrap()).clone().0 } }) }; local_inner_val } /// The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat @@ -562,7 +669,7 @@ pub extern "C" fn RecipientOnionFields_get_payment_secret(this_ptr: &RecipientOn /// want to provide a secret for a spontaneous payment if MPP is needed and you know your /// recipient will not reject it. #[no_mangle] -pub extern "C" fn RecipientOnionFields_set_payment_secret(this_ptr: &mut RecipientOnionFields, mut val: crate::c_types::derived::COption_PaymentSecretZ) { +pub extern "C" fn RecipientOnionFields_set_payment_secret(this_ptr: &mut RecipientOnionFields, mut val: crate::c_types::derived::COption_ThirtyTwoBytesZ) { let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::lightning::ln::PaymentSecret({ val_opt.take() }.data) }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_secret = local_val; } @@ -603,17 +710,6 @@ pub extern "C" fn RecipientOnionFields_set_payment_metadata(this_ptr: &mut Recip let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { let mut local_val_0 = Vec::new(); for mut item in { val_opt.take() }.into_rust().drain(..) { local_val_0.push( { item }); }; local_val_0 }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_metadata = local_val; } -/// Constructs a new RecipientOnionFields given each field -#[must_use] -#[no_mangle] -pub extern "C" fn RecipientOnionFields_new(mut payment_secret_arg: crate::c_types::derived::COption_PaymentSecretZ, mut payment_metadata_arg: crate::c_types::derived::COption_CVec_u8ZZ) -> RecipientOnionFields { - let mut local_payment_secret_arg = { /*payment_secret_arg*/ let payment_secret_arg_opt = payment_secret_arg; if payment_secret_arg_opt.is_none() { None } else { Some({ { ::lightning::ln::PaymentSecret({ payment_secret_arg_opt.take() }.data) }})} }; - let mut local_payment_metadata_arg = { /*payment_metadata_arg*/ let payment_metadata_arg_opt = payment_metadata_arg; if payment_metadata_arg_opt.is_none() { None } else { Some({ { let mut local_payment_metadata_arg_0 = Vec::new(); for mut item in { payment_metadata_arg_opt.take() }.into_rust().drain(..) { local_payment_metadata_arg_0.push( { item }); }; local_payment_metadata_arg_0 }})} }; - RecipientOnionFields { inner: ObjOps::heap_alloc(nativeRecipientOnionFields { - payment_secret: local_payment_secret_arg, - payment_metadata: local_payment_metadata_arg, - }), is_owned: true } -} impl Clone for RecipientOnionFields { fn clone(&self) -> Self { Self { @@ -683,3 +779,39 @@ pub extern "C" fn RecipientOnionFields_spontaneous_empty() -> crate::lightning:: crate::lightning::ln::outbound_payment::RecipientOnionFields { inner: ObjOps::heap_alloc(ret), is_owned: true } } +/// Creates a new [`RecipientOnionFields`] from an existing one, adding custom TLVs. Each +/// TLV is provided as a `(u64, Vec)` for the type number and serialized value +/// respectively. TLV type numbers must be unique and within the range +/// reserved for custom types, i.e. >= 2^16, otherwise this method will return `Err(())`. +/// +/// This method will also error for types in the experimental range which have been +/// standardized within the protocol, which only includes 5482373484 (keysend) for now. +/// +/// See [`Self::custom_tlvs`] for more info. +#[must_use] +#[no_mangle] +pub extern "C" fn RecipientOnionFields_with_custom_tlvs(mut this_arg: crate::lightning::ln::outbound_payment::RecipientOnionFields, mut custom_tlvs: crate::c_types::derived::CVec_C2Tuple_u64CVec_u8ZZZ) -> crate::c_types::derived::CResult_RecipientOnionFieldsNoneZ { + let mut local_custom_tlvs = Vec::new(); for mut item in custom_tlvs.into_rust().drain(..) { local_custom_tlvs.push( { let (mut orig_custom_tlvs_0_0, mut orig_custom_tlvs_0_1) = item.to_rust(); let mut local_orig_custom_tlvs_0_1 = Vec::new(); for mut item in orig_custom_tlvs_0_1.into_rust().drain(..) { local_orig_custom_tlvs_0_1.push( { item }); }; let mut local_custom_tlvs_0 = (orig_custom_tlvs_0_0, local_orig_custom_tlvs_0_1); local_custom_tlvs_0 }); }; + let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).with_custom_tlvs(local_custom_tlvs); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::outbound_payment::RecipientOnionFields { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Gets the custom TLVs that will be sent or have been received. +/// +/// Custom TLVs allow sending extra application-specific data with a payment. They provide +/// additional flexibility on top of payment metadata, as while other implementations may +/// require `payment_metadata` to reflect metadata provided in an invoice, custom TLVs +/// do not have this restriction. +/// +/// Note that if this field is non-empty, it will contain strictly increasing TLVs, each +/// represented by a `(u64, Vec)` for its type number and serialized value respectively. +/// This is validated when setting this field using [`Self::with_custom_tlvs`]. +#[must_use] +#[no_mangle] +pub extern "C" fn RecipientOnionFields_custom_tlvs(this_arg: &crate::lightning::ln::outbound_payment::RecipientOnionFields) -> crate::c_types::derived::CVec_C2Tuple_u64CVec_u8ZZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.custom_tlvs(); + 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( { item }); }; let mut local_ret_0 = (orig_ret_0_0, local_orig_ret_0_1.into()).into(); local_ret_0 }); }; + local_ret.into() +} + diff --git a/lightning-c-bindings/src/lightning/ln/peer_handler.rs b/lightning-c-bindings/src/lightning/ln/peer_handler.rs index 6ac10683..d349f6fd 100644 --- a/lightning-c-bindings/src/lightning/ln/peer_handler.rs +++ b/lightning-c-bindings/src/lightning/ln/peer_handler.rs @@ -15,6 +15,7 @@ //! messages they should handle, and encoding/sending response messages. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -63,8 +64,7 @@ pub struct CustomMessageHandler { } unsafe impl Send for CustomMessageHandler {} unsafe impl Sync for CustomMessageHandler {} -#[no_mangle] -pub(crate) extern "C" fn CustomMessageHandler_clone_fields(orig: &CustomMessageHandler) -> CustomMessageHandler { +pub(crate) fn CustomMessageHandler_clone_fields(orig: &CustomMessageHandler) -> CustomMessageHandler { CustomMessageHandler { this_arg: orig.this_arg, handle_custom_message: Clone::clone(&orig.handle_custom_message), @@ -114,6 +114,11 @@ impl core::ops::Deref for CustomMessageHandler { self } } +impl core::ops::DerefMut for CustomMessageHandler { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn CustomMessageHandler_free(this_ptr: CustomMessageHandler) { } @@ -810,9 +815,9 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_provided_init_feature crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } #[must_use] -extern "C" fn ErroringMessageHandler_ChannelMessageHandler_get_genesis_hashes(this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ChainHashZZ { +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_get_genesis_hashes(this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ { let mut ret = >::get_genesis_hashes(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, ); - let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ChainHashZZ::None } else { crate::c_types::derived::COption_CVec_ChainHashZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_ret_0.into() }) }; + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::None } else { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_ret_0.into() }) }; local_ret } @@ -997,8 +1002,7 @@ pub struct SocketDescriptor { } unsafe impl Send for SocketDescriptor {} unsafe impl Sync for SocketDescriptor {} -#[no_mangle] -pub(crate) extern "C" fn SocketDescriptor_clone_fields(orig: &SocketDescriptor) -> SocketDescriptor { +pub(crate) fn SocketDescriptor_clone_fields(orig: &SocketDescriptor) -> SocketDescriptor { SocketDescriptor { this_arg: orig.this_arg, send_data: Clone::clone(&orig.send_data), @@ -1049,6 +1053,11 @@ impl core::ops::Deref for SocketDescriptor { self } } +impl core::ops::DerefMut for SocketDescriptor { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn SocketDescriptor_free(this_ptr: SocketDescriptor) { } @@ -1235,9 +1244,9 @@ pub extern "C" fn PeerManager_new(mut message_handler: crate::lightning::ln::pee /// [`Self::new_outbound_connection`] or [`Self::new_inbound_connection`]. #[must_use] #[no_mangle] -pub extern "C" fn PeerManager_get_peer_node_ids(this_arg: &crate::lightning::ln::peer_handler::PeerManager) -> crate::c_types::derived::CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ { +pub extern "C" fn PeerManager_get_peer_node_ids(this_arg: &crate::lightning::ln::peer_handler::PeerManager) -> crate::c_types::derived::CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ { 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( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = if orig_ret_0_1.is_none() { crate::c_types::derived::COption_NetAddressZ::None } else { crate::c_types::derived::COption_NetAddressZ::Some( { crate::lightning::ln::msgs::NetAddress::native_into(orig_ret_0_1.unwrap()) }) }; let mut local_ret_0 = (crate::c_types::PublicKey::from_rust(&orig_ret_0_0), local_orig_ret_0_1).into(); local_ret_0 }); }; + 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 = if orig_ret_0_1.is_none() { crate::c_types::derived::COption_SocketAddressZ::None } else { crate::c_types::derived::COption_SocketAddressZ::Some( { crate::lightning::ln::msgs::SocketAddress::native_into(orig_ret_0_1.unwrap()) }) }; let mut local_ret_0 = (crate::c_types::PublicKey::from_rust(&orig_ret_0_0), local_orig_ret_0_1).into(); local_ret_0 }); }; local_ret.into() } @@ -1258,7 +1267,7 @@ pub extern "C" fn PeerManager_get_peer_node_ids(this_arg: &crate::lightning::ln: /// [`socket_disconnected`]: PeerManager::socket_disconnected #[must_use] #[no_mangle] -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 { +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_SocketAddressZ) -> 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() }; @@ -1282,7 +1291,7 @@ pub extern "C" fn PeerManager_new_outbound_connection(this_arg: &crate::lightnin /// [`socket_disconnected`]: PeerManager::socket_disconnected #[must_use] #[no_mangle] -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 { +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_SocketAddressZ) -> 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() }; @@ -1413,7 +1422,7 @@ pub extern "C" fn PeerManager_timer_tick_occurred(this_arg: &crate::lightning::l /// /// [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events #[no_mangle] -pub extern "C" fn PeerManager_broadcast_node_announcement(this_arg: &crate::lightning::ln::peer_handler::PeerManager, mut rgb: crate::c_types::ThreeBytes, mut alias: crate::c_types::ThirtyTwoBytes, mut addresses: crate::c_types::derived::CVec_NetAddressZ) { +pub extern "C" fn PeerManager_broadcast_node_announcement(this_arg: &crate::lightning::ln::peer_handler::PeerManager, mut rgb: crate::c_types::ThreeBytes, mut alias: crate::c_types::ThirtyTwoBytes, mut addresses: crate::c_types::derived::CVec_SocketAddressZ) { 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) } diff --git a/lightning-c-bindings/src/lightning/ln/script.rs b/lightning-c-bindings/src/lightning/ln/script.rs index b0513570..e0e2e7f0 100644 --- a/lightning-c-bindings/src/lightning/ln/script.rs +++ b/lightning-c-bindings/src/lightning/ln/script.rs @@ -9,6 +9,7 @@ //! Abstractions for scripts used in the Lightning Network. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/ln/wire.rs b/lightning-c-bindings/src/lightning/ln/wire.rs index a39f35e7..9fa946dd 100644 --- a/lightning-c-bindings/src/lightning/ln/wire.rs +++ b/lightning-c-bindings/src/lightning/ln/wire.rs @@ -12,6 +12,7 @@ //! [BOLT #1]: https://github.com/lightning/bolts/blob/master/01-messaging.md use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -37,8 +38,7 @@ pub struct CustomMessageReader { } unsafe impl Send for CustomMessageReader {} unsafe impl Sync for CustomMessageReader {} -#[no_mangle] -pub(crate) extern "C" fn CustomMessageReader_clone_fields(orig: &CustomMessageReader) -> CustomMessageReader { +pub(crate) fn CustomMessageReader_clone_fields(orig: &CustomMessageReader) -> CustomMessageReader { CustomMessageReader { this_arg: orig.this_arg, read: Clone::clone(&orig.read), @@ -64,6 +64,11 @@ impl core::ops::Deref for CustomMessageReader { self } } +impl core::ops::DerefMut for CustomMessageReader { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn CustomMessageReader_free(this_ptr: CustomMessageReader) { } @@ -77,6 +82,7 @@ impl Drop for CustomMessageReader { mod encode { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -99,19 +105,23 @@ pub struct Type { pub debug_str: extern "C" fn (this_arg: *const c_void) -> crate::c_types::Str, /// Serialize the object into a byte array pub write: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z, + /// Called, if set, after this Type has been cloned into a duplicate object. + /// The new Type is provided, and should be mutated as needed to perform a + /// deep copy of the object pointed to by this_arg or avoid any double-freeing. + pub cloned: Option, /// Frees any resources associated with this object given its this_arg pointer. /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, } unsafe impl Send for Type {} unsafe impl Sync for Type {} -#[no_mangle] -pub(crate) extern "C" fn Type_clone_fields(orig: &Type) -> Type { +pub(crate) fn Type_clone_fields(orig: &Type) -> Type { Type { this_arg: orig.this_arg, type_id: Clone::clone(&orig.type_id), debug_str: Clone::clone(&orig.debug_str), write: Clone::clone(&orig.write), + cloned: Clone::clone(&orig.cloned), free: Clone::clone(&orig.free), } } @@ -126,6 +136,18 @@ impl lightning::util::ser::Writeable for Type { w.write_all(vec.as_slice()) } } +#[no_mangle] +/// Creates a copy of a Type +pub extern "C" fn Type_clone(orig: &Type) -> Type { + let mut res = Type_clone_fields(orig); + if let Some(f) = orig.cloned { (f)(&mut res) }; + res +} +impl Clone for Type { + fn clone(&self) -> Self { + Type_clone(self) + } +} use lightning::ln::wire::Type as rustType; impl rustType for Type { @@ -143,6 +165,11 @@ impl core::ops::Deref for Type { self } } +impl core::ops::DerefMut for Type { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn Type_free(this_ptr: Type) { } diff --git a/lightning-c-bindings/src/lightning/mod.rs b/lightning-c-bindings/src/lightning/mod.rs index 0f8a1432..313fa9bc 100644 --- a/lightning-c-bindings/src/lightning/mod.rs +++ b/lightning-c-bindings/src/lightning/mod.rs @@ -36,6 +36,7 @@ //! * `max_level_trace` use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -55,6 +56,7 @@ pub mod events; mod io_extras { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -66,6 +68,7 @@ use alloc::{vec::Vec, boxed::Box}; mod prelude { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -77,6 +80,7 @@ use alloc::{vec::Vec, boxed::Box}; mod sync { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -87,6 +91,7 @@ use alloc::{vec::Vec, boxed::Box}; mod fairrwlock { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -98,6 +103,7 @@ use alloc::{vec::Vec, boxed::Box}; mod ext_impl { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/offers/invoice.rs b/lightning-c-bindings/src/lightning/offers/invoice.rs index 2ad519ac..2385fd4b 100644 --- a/lightning-c-bindings/src/lightning/offers/invoice.rs +++ b/lightning-c-bindings/src/lightning/offers/invoice.rs @@ -51,7 +51,9 @@ //! .allow_mpp() //! .fallback_v0_p2wpkh(&wpubkey_hash) //! .build()? -//! .sign::<_, Infallible>(|digest| Ok(secp_ctx.sign_schnorr_no_aux_rand(digest, &keys))) +//! .sign::<_, Infallible>( +//! |message| Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys)) +//! ) //! .expect(\"failed verifying signature\") //! .write(&mut buffer) //! .unwrap(); @@ -77,7 +79,9 @@ //! .allow_mpp() //! .fallback_v0_p2wpkh(&wpubkey_hash) //! .build()? -//! .sign::<_, Infallible>(|digest| Ok(secp_ctx.sign_schnorr_no_aux_rand(digest, &keys))) +//! .sign::<_, Infallible>( +//! |message| Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys)) +//! ) //! .expect(\"failed verifying signature\") //! .write(&mut buffer) //! .unwrap(); @@ -87,6 +91,7 @@ //! ``` use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -96,9 +101,14 @@ use alloc::{vec::Vec, boxed::Box}; use lightning::offers::invoice::UnsignedBolt12Invoice as nativeUnsignedBolt12InvoiceImport; -pub(crate) type nativeUnsignedBolt12Invoice = nativeUnsignedBolt12InvoiceImport<'static>; +pub(crate) type nativeUnsignedBolt12Invoice = nativeUnsignedBolt12InvoiceImport; /// A semantically valid [`Bolt12Invoice`] that hasn't been signed. +/// +/// # Serialization +/// +/// This is serialized as a TLV stream, which includes TLV records from the originating message. As +/// such, it may include unknown, odd TLV records. #[must_use] #[repr(C)] pub struct UnsignedBolt12Invoice { @@ -145,12 +155,12 @@ impl UnsignedBolt12Invoice { ret } } -/// The public key corresponding to the key needed to sign the invoice. +/// Returns the [`TaggedHash`] of the invoice to sign. #[must_use] #[no_mangle] -pub extern "C" fn UnsignedBolt12Invoice_signing_pubkey(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::PublicKey { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey(); - crate::c_types::PublicKey::from_rust(&ret) +pub extern "C" fn UnsignedBolt12Invoice_tagged_hash(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::offers::merkle::TaggedHash { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.tagged_hash(); + crate::lightning::offers::merkle::TaggedHash { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::offers::merkle::TaggedHash<>) as *mut _) }, is_owned: false } } @@ -230,8 +240,345 @@ pub(crate) extern "C" fn Bolt12Invoice_clone_void(this_ptr: *const c_void) -> *m pub extern "C" fn Bolt12Invoice_clone(orig: &Bolt12Invoice) -> Bolt12Invoice { orig.clone() } -/// A complete description of the purpose of the originating offer or refund. Intended to be -/// displayed to the user but with the caveat that it has not been verified in any way. +/// The chains that may be used when paying a requested invoice. +/// +/// From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`]. +/// +/// [`Offer::chains`]: crate::offers::offer::Offer::chains +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_offer_chains(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_chains(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::None } else { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_ret_0.into() }) }; + local_ret +} + +/// The chain that must be used when paying the invoice; selected from [`offer_chains`] if the +/// invoice originated from an offer. +/// +/// From [`InvoiceRequest::chain`] or [`Refund::chain`]. +/// +/// [`offer_chains`]: Self::offer_chains +/// [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_chain(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::ThirtyTwoBytes { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain(); + crate::c_types::ThirtyTwoBytes { data: ret.to_bytes() } +} + +/// Opaque bytes set by the originating [`Offer`]. +/// +/// From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or +/// if the [`Offer`] did not set it. +/// +/// [`Offer`]: crate::offers::offer::Offer +/// [`Offer::metadata`]: crate::offers::offer::Offer::metadata +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_metadata(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::COption_CVec_u8ZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { let mut local_ret_0 = Vec::new(); for mut item in (*ret.as_ref().unwrap()).clone().drain(..) { local_ret_0.push( { item }); }; local_ret_0.into() }) }; + local_ret +} + +/// The minimum amount required for a successful payment of a single item. +/// +/// From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if +/// the [`Offer`] did not set it. +/// +/// [`Offer`]: crate::offers::offer::Offer +/// [`Offer::amount`]: crate::offers::offer::Offer::amount +/// +/// 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 UnsignedBolt12Invoice_amount(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::offers::offer::Amount { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount(); + let mut local_ret = crate::lightning::offers::offer::Amount { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::offers::offer::Amount<>) as *mut _ }, is_owned: false }; + local_ret +} + +/// Features pertaining to the originating [`Offer`]. +/// +/// From [`Offer::offer_features`]; `None` if the invoice was created in response to a +/// [`Refund`]. +/// +/// [`Offer`]: crate::offers::offer::Offer +/// [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features +/// +/// 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 UnsignedBolt12Invoice_offer_features(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::ln::features::OfferFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features(); + let mut local_ret = crate::lightning::ln::features::OfferFeatures { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::ln::features::OfferFeatures<>) as *mut _ }, is_owned: false }; + local_ret +} + +/// A complete description of the purpose of the originating offer or refund. +/// +/// From [`Offer::description`] or [`Refund::description`]. +/// +/// [`Offer::description`]: crate::offers::offer::Offer::description +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_description(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::util::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description(); + crate::lightning::util::string::PrintableString { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Duration since the Unix epoch when an invoice should no longer be requested. +/// +/// From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`]. +/// +/// [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_absolute_expiry(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry(); + 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().as_secs() }) }; + local_ret +} + +/// The issuer of the offer or refund. +/// +/// From [`Offer::issuer`] or [`Refund::issuer`]. +/// +/// [`Offer::issuer`]: crate::offers::offer::Offer::issuer +/// +/// 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 UnsignedBolt12Invoice_issuer(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::util::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer(); + let mut local_ret = crate::lightning::util::string::PrintableString { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} + +/// Paths to the recipient originating from publicly reachable nodes. +/// +/// From [`Offer::paths`] or [`Refund::paths`]. +/// +/// [`Offer::paths`]: crate::offers::offer::Offer::paths +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_message_paths(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::CVec_BlindedPathZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.message_paths(); + let mut local_ret_clone = Vec::new(); local_ret_clone.extend_from_slice(ret); let mut ret = local_ret_clone; let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + +/// The quantity of items supported. +/// +/// From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a +/// [`Refund`]. +/// +/// [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity +/// +/// 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 UnsignedBolt12Invoice_supported_quantity(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::offers::offer::Quantity { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity(); + let mut local_ret = crate::lightning::offers::offer::Quantity { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} + +/// An unpredictable series of bytes from the payer. +/// +/// From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_payer_metadata(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::u8slice { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_metadata(); + let mut local_ret = crate::c_types::u8slice::from_slice(ret); + local_ret +} + +/// Features pertaining to requesting an invoice. +/// +/// From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_invoice_request_features(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::ln::features::InvoiceRequestFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_request_features(); + crate::lightning::ln::features::InvoiceRequestFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::InvoiceRequestFeatures<>) as *mut _) }, is_owned: false } +} + +/// The quantity of items requested or refunded for. +/// +/// From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_quantity(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.quantity(); + 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 +} + +/// A possibly transient pubkey used to sign the invoice request or to send an invoice for a +/// refund in case there are no [`message_paths`]. +/// +/// [`message_paths`]: Self::message_paths +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_payer_id(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id(); + crate::c_types::PublicKey::from_rust(&ret) +} + +/// A payer-provided note reflected back in the invoice. +/// +/// From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`]. +/// +/// 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 UnsignedBolt12Invoice_payer_note(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::util::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_note(); + let mut local_ret = crate::lightning::util::string::PrintableString { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} + +/// Duration since the Unix epoch when the invoice was created. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_created_at(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> u64 { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.created_at(); + ret.as_secs() +} + +/// Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore +/// should no longer be paid. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_relative_expiry(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> u64 { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.relative_expiry(); + ret.as_secs() +} + +/// Whether the invoice has expired. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_is_expired(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_expired(); + ret +} + +/// SHA256 hash of the payment preimage that will be given in return for paying the invoice. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_payment_hash(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::ThirtyTwoBytes { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_hash(); + crate::c_types::ThirtyTwoBytes { data: ret.0 } +} + +/// The minimum amount required for a successful payment of the invoice. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_amount_msats(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> u64 { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_msats(); + ret +} + +/// Features pertaining to paying an invoice. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_invoice_features(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::ln::features::Bolt12InvoiceFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_features(); + crate::lightning::ln::features::Bolt12InvoiceFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::Bolt12InvoiceFeatures<>) as *mut _) }, is_owned: false } +} + +/// The public key corresponding to the key used to sign the invoice. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_signing_pubkey(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey(); + crate::c_types::PublicKey::from_rust(&ret) +} + +/// The chains that may be used when paying a requested invoice. +/// +/// From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`]. +/// +/// [`Offer::chains`]: crate::offers::offer::Offer::chains +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12Invoice_offer_chains(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_chains(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::None } else { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_ret_0.into() }) }; + local_ret +} + +/// The chain that must be used when paying the invoice; selected from [`offer_chains`] if the +/// invoice originated from an offer. +/// +/// From [`InvoiceRequest::chain`] or [`Refund::chain`]. +/// +/// [`offer_chains`]: Self::offer_chains +/// [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12Invoice_chain(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::ThirtyTwoBytes { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain(); + crate::c_types::ThirtyTwoBytes { data: ret.to_bytes() } +} + +/// Opaque bytes set by the originating [`Offer`]. +/// +/// From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or +/// if the [`Offer`] did not set it. +/// +/// [`Offer`]: crate::offers::offer::Offer +/// [`Offer::metadata`]: crate::offers::offer::Offer::metadata +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12Invoice_metadata(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::derived::COption_CVec_u8ZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { let mut local_ret_0 = Vec::new(); for mut item in (*ret.as_ref().unwrap()).clone().drain(..) { local_ret_0.push( { item }); }; local_ret_0.into() }) }; + local_ret +} + +/// The minimum amount required for a successful payment of a single item. +/// +/// From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if +/// the [`Offer`] did not set it. +/// +/// [`Offer`]: crate::offers::offer::Offer +/// [`Offer::amount`]: crate::offers::offer::Offer::amount +/// +/// 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 Bolt12Invoice_amount(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::lightning::offers::offer::Amount { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount(); + let mut local_ret = crate::lightning::offers::offer::Amount { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::offers::offer::Amount<>) as *mut _ }, is_owned: false }; + local_ret +} + +/// Features pertaining to the originating [`Offer`]. +/// +/// From [`Offer::offer_features`]; `None` if the invoice was created in response to a +/// [`Refund`]. +/// +/// [`Offer`]: crate::offers::offer::Offer +/// [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features +/// +/// 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 Bolt12Invoice_offer_features(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::lightning::ln::features::OfferFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features(); + let mut local_ret = crate::lightning::ln::features::OfferFeatures { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::ln::features::OfferFeatures<>) as *mut _ }, is_owned: false }; + local_ret +} + +/// A complete description of the purpose of the originating offer or refund. +/// +/// From [`Offer::description`] or [`Refund::description`]. +/// +/// [`Offer::description`]: crate::offers::offer::Offer::description #[must_use] #[no_mangle] pub extern "C" fn Bolt12Invoice_description(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::lightning::util::string::PrintableString { @@ -239,6 +586,119 @@ pub extern "C" fn Bolt12Invoice_description(this_arg: &crate::lightning::offers: crate::lightning::util::string::PrintableString { inner: ObjOps::heap_alloc(ret), is_owned: true } } +/// Duration since the Unix epoch when an invoice should no longer be requested. +/// +/// From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`]. +/// +/// [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12Invoice_absolute_expiry(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry(); + 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().as_secs() }) }; + local_ret +} + +/// The issuer of the offer or refund. +/// +/// From [`Offer::issuer`] or [`Refund::issuer`]. +/// +/// [`Offer::issuer`]: crate::offers::offer::Offer::issuer +/// +/// 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 Bolt12Invoice_issuer(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::lightning::util::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer(); + let mut local_ret = crate::lightning::util::string::PrintableString { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} + +/// Paths to the recipient originating from publicly reachable nodes. +/// +/// From [`Offer::paths`] or [`Refund::paths`]. +/// +/// [`Offer::paths`]: crate::offers::offer::Offer::paths +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12Invoice_message_paths(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::derived::CVec_BlindedPathZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.message_paths(); + let mut local_ret_clone = Vec::new(); local_ret_clone.extend_from_slice(ret); let mut ret = local_ret_clone; let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + +/// The quantity of items supported. +/// +/// From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a +/// [`Refund`]. +/// +/// [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity +/// +/// 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 Bolt12Invoice_supported_quantity(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::lightning::offers::offer::Quantity { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity(); + let mut local_ret = crate::lightning::offers::offer::Quantity { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} + +/// An unpredictable series of bytes from the payer. +/// +/// From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12Invoice_payer_metadata(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::u8slice { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_metadata(); + let mut local_ret = crate::c_types::u8slice::from_slice(ret); + local_ret +} + +/// Features pertaining to requesting an invoice. +/// +/// From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12Invoice_invoice_request_features(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::lightning::ln::features::InvoiceRequestFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_request_features(); + crate::lightning::ln::features::InvoiceRequestFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::InvoiceRequestFeatures<>) as *mut _) }, is_owned: false } +} + +/// The quantity of items requested or refunded for. +/// +/// From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12Invoice_quantity(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.quantity(); + 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 +} + +/// A possibly transient pubkey used to sign the invoice request or to send an invoice for a +/// refund in case there are no [`message_paths`]. +/// +/// [`message_paths`]: Self::message_paths +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12Invoice_payer_id(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id(); + crate::c_types::PublicKey::from_rust(&ret) +} + +/// A payer-provided note reflected back in the invoice. +/// +/// From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`]. +/// +/// 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 Bolt12Invoice_payer_note(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::lightning::util::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_note(); + let mut local_ret = crate::lightning::util::string::PrintableString { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} + /// Duration since the Unix epoch when the invoice was created. #[must_use] #[no_mangle] @@ -283,8 +743,8 @@ pub extern "C" fn Bolt12Invoice_amount_msats(this_arg: &crate::lightning::offers /// Features pertaining to paying an invoice. #[must_use] #[no_mangle] -pub extern "C" fn Bolt12Invoice_features(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::lightning::ln::features::Bolt12InvoiceFeatures { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.features(); +pub extern "C" fn Bolt12Invoice_invoice_features(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::lightning::ln::features::Bolt12InvoiceFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_features(); crate::lightning::ln::features::Bolt12InvoiceFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::Bolt12InvoiceFeatures<>) as *mut _) }, is_owned: false } } @@ -296,6 +756,14 @@ pub extern "C" fn Bolt12Invoice_signing_pubkey(this_arg: &crate::lightning::offe crate::c_types::PublicKey::from_rust(&ret) } +/// Signature of the invoice verified using [`Bolt12Invoice::signing_pubkey`]. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12Invoice_signature(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::SchnorrSignature { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signature(); + crate::c_types::SchnorrSignature::from_rust(&ret) +} + /// Hash that was used for signing the invoice. #[must_use] #[no_mangle] @@ -304,14 +772,25 @@ pub extern "C" fn Bolt12Invoice_signable_hash(this_arg: &crate::lightning::offer crate::c_types::ThirtyTwoBytes { data: ret } } -/// Verifies that the invoice was for a request or refund created using the given key. +/// Verifies that the invoice was for a request or refund created using the given key. Returns +/// the associated [`PaymentId`] to use when sending the payment. #[must_use] #[no_mangle] -pub extern "C" fn Bolt12Invoice_verify(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice, key: &crate::lightning::ln::inbound_payment::ExpandedKey) -> bool { +pub extern "C" fn Bolt12Invoice_verify(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice, key: &crate::lightning::ln::inbound_payment::ExpandedKey) -> crate::c_types::derived::CResult_ThirtyTwoBytesNoneZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.verify(key.get_native_ref(), secp256k1::global::SECP256K1); - ret + 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() }; + local_ret } +#[no_mangle] +/// Serialize the UnsignedBolt12Invoice object into a byte array which can be read by UnsignedBolt12Invoice_read +pub extern "C" fn UnsignedBolt12Invoice_write(obj: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn UnsignedBolt12Invoice_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedBolt12Invoice) }) +} #[no_mangle] /// Serialize the Bolt12Invoice object into a byte array which can be read by Bolt12Invoice_read pub extern "C" fn Bolt12Invoice_write(obj: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::derived::CVec_u8Z { diff --git a/lightning-c-bindings/src/lightning/offers/invoice_error.rs b/lightning-c-bindings/src/lightning/offers/invoice_error.rs index 374c5e1e..069ad78b 100644 --- a/lightning-c-bindings/src/lightning/offers/invoice_error.rs +++ b/lightning-c-bindings/src/lightning/offers/invoice_error.rs @@ -9,6 +9,7 @@ //! Data structures and encoding for `invoice_error` messages. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -105,6 +106,8 @@ pub extern "C" fn InvoiceError_set_message(this_ptr: &mut InvoiceError, mut val: unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.message = *unsafe { Box::from_raw(val.take_inner()) }; } /// Constructs a new InvoiceError given each field +/// +/// Note that erroneous_field_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] pub extern "C" fn InvoiceError_new(mut erroneous_field_arg: crate::lightning::offers::invoice_error::ErroneousField, mut message_arg: crate::lightning::util::string::UntrustedString) -> InvoiceError { diff --git a/lightning-c-bindings/src/lightning/offers/invoice_request.rs b/lightning-c-bindings/src/lightning/offers/invoice_request.rs index b458687e..b8563372 100644 --- a/lightning-c-bindings/src/lightning/offers/invoice_request.rs +++ b/lightning-c-bindings/src/lightning/offers/invoice_request.rs @@ -43,7 +43,9 @@ //! .quantity(5)? //! .payer_note(\"foo\".to_string()) //! .build()? -//! .sign::<_, Infallible>(|digest| Ok(secp_ctx.sign_schnorr_no_aux_rand(digest, &keys))) +//! .sign::<_, Infallible>( +//! |message| Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys)) +//! ) //! .expect(\"failed verifying signature\") //! .write(&mut buffer) //! .unwrap(); @@ -52,6 +54,7 @@ //! ``` use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -61,9 +64,14 @@ use alloc::{vec::Vec, boxed::Box}; use lightning::offers::invoice_request::UnsignedInvoiceRequest as nativeUnsignedInvoiceRequestImport; -pub(crate) type nativeUnsignedInvoiceRequest = nativeUnsignedInvoiceRequestImport<'static>; +pub(crate) type nativeUnsignedInvoiceRequest = nativeUnsignedInvoiceRequestImport; /// A semantically valid [`InvoiceRequest`] that hasn't been signed. +/// +/// # Serialization +/// +/// This is serialized as a TLV stream, which includes TLV records from the originating message. As +/// such, it may include unknown, odd TLV records. #[must_use] #[repr(C)] pub struct UnsignedInvoiceRequest { @@ -110,6 +118,14 @@ impl UnsignedInvoiceRequest { ret } } +/// Returns the [`TaggedHash`] of the invoice to sign. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_tagged_hash(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::offers::merkle::TaggedHash { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.tagged_hash(); + crate::lightning::offers::merkle::TaggedHash { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::offers::merkle::TaggedHash<>) as *mut _) }, is_owned: false } +} + use lightning::offers::invoice_request::InvoiceRequest as nativeInvoiceRequestImport; pub(crate) type nativeInvoiceRequest = nativeInvoiceRequestImport; @@ -186,14 +202,377 @@ pub(crate) extern "C" fn InvoiceRequest_clone_void(this_ptr: *const c_void) -> * pub extern "C" fn InvoiceRequest_clone(orig: &InvoiceRequest) -> InvoiceRequest { orig.clone() } + +use lightning::offers::invoice_request::VerifiedInvoiceRequest as nativeVerifiedInvoiceRequestImport; +pub(crate) type nativeVerifiedInvoiceRequest = nativeVerifiedInvoiceRequestImport; + +/// An [`InvoiceRequest`] that has been verified by [`InvoiceRequest::verify`] and exposes different +/// ways to respond depending on whether the signing keys were derived. +#[must_use] +#[repr(C)] +pub struct VerifiedInvoiceRequest { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, inner must be non-null, however in places where + /// the Rust equivalent takes an Option, it may be set to null to indicate None. + pub inner: *mut nativeVerifiedInvoiceRequest, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for VerifiedInvoiceRequest { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeVerifiedInvoiceRequest>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the VerifiedInvoiceRequest, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_free(this_obj: VerifiedInvoiceRequest) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn VerifiedInvoiceRequest_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeVerifiedInvoiceRequest) }; +} +#[allow(unused)] +impl VerifiedInvoiceRequest { + pub(crate) fn get_native_ref(&self) -> &'static nativeVerifiedInvoiceRequest { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeVerifiedInvoiceRequest { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeVerifiedInvoiceRequest { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// Keys used for signing a [`Bolt12Invoice`] if they can be derived. +/// +/// If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call +/// [`respond_with`]. +/// +/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice +/// [`respond_using_derived_keys`]: Self::respond_using_derived_keys +/// [`respond_with`]: Self::respond_with +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_get_keys(this_ptr: &VerifiedInvoiceRequest) -> crate::c_types::derived::COption_SecretKeyZ { + let mut inner_val = &mut this_ptr.get_native_mut_ref().keys; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_SecretKeyZ::None } else { crate::c_types::derived::COption_SecretKeyZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::SecretKey::from_rust((*inner_val.as_ref().unwrap()).clone().secret_key()) }) }; + local_inner_val +} +/// Keys used for signing a [`Bolt12Invoice`] if they can be derived. +/// +/// If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call +/// [`respond_with`]. +/// +/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice +/// [`respond_using_derived_keys`]: Self::respond_using_derived_keys +/// [`respond_with`]: Self::respond_with +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_set_keys(this_ptr: &mut VerifiedInvoiceRequest, mut val: crate::c_types::derived::COption_SecretKeyZ) { + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::bitcoin::secp256k1::KeyPair::from_secret_key(&secp256k1::global::SECP256K1, &{ val_opt.take() }.into_rust()) }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.keys = local_val; +} +impl Clone for VerifiedInvoiceRequest { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeVerifiedInvoiceRequest>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn VerifiedInvoiceRequest_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeVerifiedInvoiceRequest)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the VerifiedInvoiceRequest +pub extern "C" fn VerifiedInvoiceRequest_clone(orig: &VerifiedInvoiceRequest) -> VerifiedInvoiceRequest { + orig.clone() +} +/// The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). +/// Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) +/// for the selected chain. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_chains(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chains(); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; + local_ret.into() +} + +/// Opaque bytes set by the originator. Useful for authentication and validating fields since it +/// is reflected in `invoice_request` messages along with all the other fields from the `offer`. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_metadata(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::COption_CVec_u8ZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { let mut local_ret_0 = Vec::new(); for mut item in (*ret.as_ref().unwrap()).clone().drain(..) { local_ret_0.push( { item }); }; local_ret_0.into() }) }; + local_ret +} + +/// The minimum amount required for a successful payment of a single item. +/// +/// 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 UnsignedInvoiceRequest_amount(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::offers::offer::Amount { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount(); + let mut local_ret = crate::lightning::offers::offer::Amount { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::offers::offer::Amount<>) as *mut _ }, is_owned: false }; + local_ret +} + +/// A complete description of the purpose of the payment. Intended to be displayed to the user +/// but with the caveat that it has not been verified in any way. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_description(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::util::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description(); + crate::lightning::util::string::PrintableString { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Features pertaining to the offer. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_offer_features(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::ln::features::OfferFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features(); + crate::lightning::ln::features::OfferFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::OfferFeatures<>) as *mut _) }, is_owned: false } +} + +/// Duration since the Unix epoch when an invoice should no longer be requested. +/// +/// If `None`, the offer does not expire. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_absolute_expiry(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry(); + 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().as_secs() }) }; + local_ret +} + +/// The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be +/// displayed to the user but with the caveat that it has not been verified in any way. +/// +/// 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 UnsignedInvoiceRequest_issuer(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::util::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer(); + let mut local_ret = crate::lightning::util::string::PrintableString { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} + +/// Paths to the recipient originating from publicly reachable nodes. Blinded paths provide +/// recipient privacy by obfuscating its node id. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_paths(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CVec_BlindedPathZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.paths(); + let mut local_ret_clone = Vec::new(); local_ret_clone.extend_from_slice(ret); let mut ret = local_ret_clone; let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + +/// The quantity of items supported. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_supported_quantity(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::offers::offer::Quantity { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity(); + crate::lightning::offers::offer::Quantity { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// The public key used by the recipient to sign invoices. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey(); + crate::c_types::PublicKey::from_rust(&ret) +} + /// An unpredictable series of bytes, typically containing information about the derivation of /// [`payer_id`]. /// /// [`payer_id`]: Self::payer_id #[must_use] #[no_mangle] -pub extern "C" fn InvoiceRequest_metadata(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::u8slice { +pub extern "C" fn UnsignedInvoiceRequest_payer_metadata(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::u8slice { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_metadata(); + let mut local_ret = crate::c_types::u8slice::from_slice(ret); + local_ret +} + +/// A chain from [`Offer::chains`] that the offer is valid for. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_chain(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::ThirtyTwoBytes { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain(); + crate::c_types::ThirtyTwoBytes { data: ret.to_bytes() } +} + +/// The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which +/// must be greater than or equal to [`Offer::amount`], converted if necessary. +/// +/// [`chain`]: Self::chain +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_amount_msats(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_msats(); + 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 +} + +/// Features pertaining to requesting an invoice. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_invoice_request_features(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::ln::features::InvoiceRequestFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_request_features(); + crate::lightning::ln::features::InvoiceRequestFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::InvoiceRequestFeatures<>) as *mut _) }, is_owned: false } +} + +/// The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_quantity(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.quantity(); + 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 +} + +/// A possibly transient pubkey used to sign the invoice request. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_payer_id(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id(); + crate::c_types::PublicKey::from_rust(&ret) +} + +/// A payer-provided note which will be seen by the recipient and reflected back in the invoice +/// response. +/// +/// 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 UnsignedInvoiceRequest_payer_note(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::util::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_note(); + let mut local_ret = crate::lightning::util::string::PrintableString { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} + +/// The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). +/// Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) +/// for the selected chain. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequest_chains(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chains(); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; + local_ret.into() +} + +/// Opaque bytes set by the originator. Useful for authentication and validating fields since it +/// is reflected in `invoice_request` messages along with all the other fields from the `offer`. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequest_metadata(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::COption_CVec_u8ZZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { let mut local_ret_0 = Vec::new(); for mut item in (*ret.as_ref().unwrap()).clone().drain(..) { local_ret_0.push( { item }); }; local_ret_0.into() }) }; + local_ret +} + +/// The minimum amount required for a successful payment of a single item. +/// +/// 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 InvoiceRequest_amount(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::offers::offer::Amount { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount(); + let mut local_ret = crate::lightning::offers::offer::Amount { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::offers::offer::Amount<>) as *mut _ }, is_owned: false }; + local_ret +} + +/// A complete description of the purpose of the payment. Intended to be displayed to the user +/// but with the caveat that it has not been verified in any way. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequest_description(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::util::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description(); + crate::lightning::util::string::PrintableString { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Features pertaining to the offer. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequest_offer_features(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::ln::features::OfferFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features(); + crate::lightning::ln::features::OfferFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::OfferFeatures<>) as *mut _) }, is_owned: false } +} + +/// Duration since the Unix epoch when an invoice should no longer be requested. +/// +/// If `None`, the offer does not expire. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequest_absolute_expiry(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry(); + 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().as_secs() }) }; + local_ret +} + +/// The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be +/// displayed to the user but with the caveat that it has not been verified in any way. +/// +/// 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 InvoiceRequest_issuer(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::util::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer(); + let mut local_ret = crate::lightning::util::string::PrintableString { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} + +/// Paths to the recipient originating from publicly reachable nodes. Blinded paths provide +/// recipient privacy by obfuscating its node id. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequest_paths(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::CVec_BlindedPathZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.paths(); + let mut local_ret_clone = Vec::new(); local_ret_clone.extend_from_slice(ret); let mut ret = local_ret_clone; let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + +/// The quantity of items supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequest_supported_quantity(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::offers::offer::Quantity { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity(); + crate::lightning::offers::offer::Quantity { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// The public key used by the recipient to sign invoices. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequest_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey(); + crate::c_types::PublicKey::from_rust(&ret) +} + +/// An unpredictable series of bytes, typically containing information about the derivation of +/// [`payer_id`]. +/// +/// [`payer_id`]: Self::payer_id +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequest_payer_metadata(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::u8slice { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_metadata(); let mut local_ret = crate::c_types::u8slice::from_slice(ret); local_ret } @@ -221,8 +600,8 @@ pub extern "C" fn InvoiceRequest_amount_msats(this_arg: &crate::lightning::offer /// Features pertaining to requesting an invoice. #[must_use] #[no_mangle] -pub extern "C" fn InvoiceRequest_features(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::ln::features::InvoiceRequestFeatures { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.features(); +pub extern "C" fn InvoiceRequest_invoice_request_features(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::ln::features::InvoiceRequestFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_request_features(); crate::lightning::ln::features::InvoiceRequestFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::InvoiceRequestFeatures<>) as *mut _) }, is_owned: false } } @@ -255,19 +634,205 @@ pub extern "C" fn InvoiceRequest_payer_note(this_arg: &crate::lightning::offers: local_ret } -/// Verifies that the request was for an offer created using the given key. Returns the derived -/// keys need to sign an [`Bolt12Invoice`] for the request if they could be extracted from the -/// metadata. +/// Signature of the invoice request using [`payer_id`]. +/// +/// [`payer_id`]: Self::payer_id +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequest_signature(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::SchnorrSignature { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signature(); + crate::c_types::SchnorrSignature::from_rust(&ret) +} + +/// Verifies that the request was for an offer created using the given key. Returns the verified +/// request which contains the derived keys needed to sign a [`Bolt12Invoice`] for the request +/// if they could be extracted from the metadata. /// /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice #[must_use] #[no_mangle] -pub extern "C" fn InvoiceRequest_verify(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest, key: &crate::lightning::ln::inbound_payment::ExpandedKey) -> crate::c_types::derived::CResult_COption_KeyPairZNoneZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.verify(key.get_native_ref(), secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = if o.is_none() { crate::c_types::derived::COption_KeyPairZ::None } else { crate::c_types::derived::COption_KeyPairZ::Some( { crate::c_types::SecretKey::from_rust(o.unwrap().secret_key()) }) }; local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; +pub extern "C" fn InvoiceRequest_verify(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequest, key: &crate::lightning::ln::inbound_payment::ExpandedKey) -> crate::c_types::derived::CResult_VerifiedInvoiceRequestNoneZ { + let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).verify(key.get_native_ref(), secp256k1::global::SECP256K1); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice_request::VerifiedInvoiceRequest { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). +/// Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) +/// for the selected chain. +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_chains(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chains(); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; + local_ret.into() +} + +/// Opaque bytes set by the originator. Useful for authentication and validating fields since it +/// is reflected in `invoice_request` messages along with all the other fields from the `offer`. +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_metadata(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::COption_CVec_u8ZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { let mut local_ret_0 = Vec::new(); for mut item in (*ret.as_ref().unwrap()).clone().drain(..) { local_ret_0.push( { item }); }; local_ret_0.into() }) }; local_ret } +/// The minimum amount required for a successful payment of a single item. +/// +/// 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 VerifiedInvoiceRequest_amount(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::offers::offer::Amount { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount(); + let mut local_ret = crate::lightning::offers::offer::Amount { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::offers::offer::Amount<>) as *mut _ }, is_owned: false }; + local_ret +} + +/// A complete description of the purpose of the payment. Intended to be displayed to the user +/// but with the caveat that it has not been verified in any way. +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_description(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::util::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description(); + crate::lightning::util::string::PrintableString { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Features pertaining to the offer. +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_offer_features(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::ln::features::OfferFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features(); + crate::lightning::ln::features::OfferFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::OfferFeatures<>) as *mut _) }, is_owned: false } +} + +/// Duration since the Unix epoch when an invoice should no longer be requested. +/// +/// If `None`, the offer does not expire. +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_absolute_expiry(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry(); + 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().as_secs() }) }; + local_ret +} + +/// The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be +/// displayed to the user but with the caveat that it has not been verified in any way. +/// +/// 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 VerifiedInvoiceRequest_issuer(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::util::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer(); + let mut local_ret = crate::lightning::util::string::PrintableString { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} + +/// Paths to the recipient originating from publicly reachable nodes. Blinded paths provide +/// recipient privacy by obfuscating its node id. +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_paths(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::CVec_BlindedPathZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.paths(); + let mut local_ret_clone = Vec::new(); local_ret_clone.extend_from_slice(ret); let mut ret = local_ret_clone; let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + +/// The quantity of items supported. +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_supported_quantity(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::offers::offer::Quantity { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity(); + crate::lightning::offers::offer::Quantity { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// The public key used by the recipient to sign invoices. +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey(); + crate::c_types::PublicKey::from_rust(&ret) +} + +/// An unpredictable series of bytes, typically containing information about the derivation of +/// [`payer_id`]. +/// +/// [`payer_id`]: Self::payer_id +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_payer_metadata(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::u8slice { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_metadata(); + let mut local_ret = crate::c_types::u8slice::from_slice(ret); + local_ret +} + +/// A chain from [`Offer::chains`] that the offer is valid for. +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_chain(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::ThirtyTwoBytes { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain(); + crate::c_types::ThirtyTwoBytes { data: ret.to_bytes() } +} + +/// The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which +/// must be greater than or equal to [`Offer::amount`], converted if necessary. +/// +/// [`chain`]: Self::chain +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_amount_msats(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_msats(); + 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 +} + +/// Features pertaining to requesting an invoice. +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_invoice_request_features(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::ln::features::InvoiceRequestFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_request_features(); + crate::lightning::ln::features::InvoiceRequestFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::InvoiceRequestFeatures<>) as *mut _) }, is_owned: false } +} + +/// The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_quantity(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.quantity(); + 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 +} + +/// A possibly transient pubkey used to sign the invoice request. +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_payer_id(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id(); + crate::c_types::PublicKey::from_rust(&ret) +} + +/// A payer-provided note which will be seen by the recipient and reflected back in the invoice +/// response. +/// +/// 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 VerifiedInvoiceRequest_payer_note(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::util::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_note(); + let mut local_ret = crate::lightning::util::string::PrintableString { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} + +#[no_mangle] +/// Serialize the UnsignedInvoiceRequest object into a byte array which can be read by UnsignedInvoiceRequest_read +pub extern "C" fn UnsignedInvoiceRequest_write(obj: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn UnsignedInvoiceRequest_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedInvoiceRequest) }) +} #[no_mangle] /// Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read pub extern "C" fn InvoiceRequest_write(obj: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::CVec_u8Z { diff --git a/lightning-c-bindings/src/lightning/offers/merkle.rs b/lightning-c-bindings/src/lightning/offers/merkle.rs new file mode 100644 index 00000000..106169c2 --- /dev/null +++ b/lightning-c-bindings/src/lightning/offers/merkle.rs @@ -0,0 +1,74 @@ +// This file is Copyright its original authors, visible in version control +// history and in the source files from which this was generated. +// +// This file is licensed under the license available in the LICENSE or LICENSE.md +// file in the root of this repository or, if no such file exists, the same +// license as that which applies to the original source files from which this +// source was automatically generated. + +//! Tagged hashes for use in signature calculation and verification. + +use alloc::str::FromStr; +use alloc::string::String; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + + +use lightning::offers::merkle::TaggedHash as nativeTaggedHashImport; +pub(crate) type nativeTaggedHash = nativeTaggedHashImport; + +/// A hash for use in a specific context by tweaking with a context-dependent tag as per [BIP 340] +/// and computed over the merkle root of a TLV stream to sign as defined in [BOLT 12]. +/// +/// [BIP 340]: https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki +/// [BOLT 12]: https://github.com/rustyrussell/lightning-rfc/blob/guilt/offers/12-offer-encoding.md#signature-calculation +#[must_use] +#[repr(C)] +pub struct TaggedHash { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, inner must be non-null, however in places where + /// the Rust equivalent takes an Option, it may be set to null to indicate None. + pub inner: *mut nativeTaggedHash, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for TaggedHash { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeTaggedHash>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the TaggedHash, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn TaggedHash_free(this_obj: TaggedHash) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn TaggedHash_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTaggedHash) }; +} +#[allow(unused)] +impl TaggedHash { + pub(crate) fn get_native_ref(&self) -> &'static nativeTaggedHash { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTaggedHash { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeTaggedHash { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} diff --git a/lightning-c-bindings/src/lightning/offers/mod.rs b/lightning-c-bindings/src/lightning/offers/mod.rs index 0ea60899..68d2175a 100644 --- a/lightning-c-bindings/src/lightning/offers/mod.rs +++ b/lightning-c-bindings/src/lightning/offers/mod.rs @@ -12,6 +12,7 @@ //! Offers are a flexible protocol for Lightning payments. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -19,26 +20,17 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; +pub mod offer; pub mod invoice; pub mod invoice_error; pub mod invoice_request; -pub mod offer; +pub mod merkle; pub mod parse; pub mod refund; -mod merkle { - -use alloc::str::FromStr; -use core::ffi::c_void; -use core::convert::Infallible; -use bitcoin::hashes::Hash; -use crate::c_types::*; -#[cfg(feature="no-std")] -use alloc::{vec::Vec, boxed::Box}; - -} mod payer { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -50,6 +42,7 @@ use alloc::{vec::Vec, boxed::Box}; mod signer { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/offers/offer.rs b/lightning-c-bindings/src/lightning/offers/offer.rs index a5d19c3c..c4f0c064 100644 --- a/lightning-c-bindings/src/lightning/offers/offer.rs +++ b/lightning-c-bindings/src/lightning/offers/offer.rs @@ -66,6 +66,7 @@ //! ``` use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -160,20 +161,12 @@ pub extern "C" fn Offer_clone(orig: &Offer) -> Offer { /// for the selected chain. #[must_use] #[no_mangle] -pub extern "C" fn Offer_chains(this_arg: &crate::lightning::offers::offer::Offer) -> crate::c_types::derived::CVec_ChainHashZ { +pub extern "C" fn Offer_chains(this_arg: &crate::lightning::offers::offer::Offer) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chains(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_ret.into() } -/// Returns whether the given chain is supported by the offer. -#[must_use] -#[no_mangle] -pub extern "C" fn Offer_supports_chain(this_arg: &crate::lightning::offers::offer::Offer, mut chain: crate::c_types::ThirtyTwoBytes) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_chain(::bitcoin::blockdata::constants::ChainHash::from(&chain.data[..])); - ret -} - /// Opaque bytes set by the originator. Useful for authentication and validating fields since it /// is reflected in `invoice_request` messages along with all the other fields from the `offer`. #[must_use] @@ -207,8 +200,8 @@ pub extern "C" fn Offer_description(this_arg: &crate::lightning::offers::offer:: /// Features pertaining to the offer. #[must_use] #[no_mangle] -pub extern "C" fn Offer_features(this_arg: &crate::lightning::offers::offer::Offer) -> crate::lightning::ln::features::OfferFeatures { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.features(); +pub extern "C" fn Offer_offer_features(this_arg: &crate::lightning::offers::offer::Offer) -> crate::lightning::ln::features::OfferFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features(); crate::lightning::ln::features::OfferFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::OfferFeatures<>) as *mut _) }, is_owned: false } } @@ -217,20 +210,12 @@ pub extern "C" fn Offer_features(this_arg: &crate::lightning::offers::offer::Off /// If `None`, the offer does not expire. #[must_use] #[no_mangle] -pub extern "C" fn Offer_absolute_expiry(this_arg: &crate::lightning::offers::offer::Offer) -> crate::c_types::derived::COption_DurationZ { +pub extern "C" fn Offer_absolute_expiry(this_arg: &crate::lightning::offers::offer::Offer) -> crate::c_types::derived::COption_u64Z { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry(); - let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_DurationZ::None } else { crate::c_types::derived::COption_DurationZ::Some( { ret.unwrap().as_secs() }) }; + 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().as_secs() }) }; local_ret } -/// Whether the offer has expired. -#[must_use] -#[no_mangle] -pub extern "C" fn Offer_is_expired(this_arg: &crate::lightning::offers::offer::Offer) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_expired(); - ret -} - /// The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be /// displayed to the user but with the caveat that it has not been verified in any way. /// @@ -261,6 +246,30 @@ pub extern "C" fn Offer_supported_quantity(this_arg: &crate::lightning::offers:: crate::lightning::offers::offer::Quantity { inner: ObjOps::heap_alloc(ret), is_owned: true } } +/// The public key used by the recipient to sign invoices. +#[must_use] +#[no_mangle] +pub extern "C" fn Offer_signing_pubkey(this_arg: &crate::lightning::offers::offer::Offer) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey(); + crate::c_types::PublicKey::from_rust(&ret) +} + +/// Returns whether the given chain is supported by the offer. +#[must_use] +#[no_mangle] +pub extern "C" fn Offer_supports_chain(this_arg: &crate::lightning::offers::offer::Offer, mut chain: crate::c_types::ThirtyTwoBytes) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_chain(::bitcoin::blockdata::constants::ChainHash::from(&chain.data[..])); + ret +} + +/// Whether the offer has expired. +#[must_use] +#[no_mangle] +pub extern "C" fn Offer_is_expired(this_arg: &crate::lightning::offers::offer::Offer) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_expired(); + ret +} + /// Returns whether the given quantity is valid for the offer. #[must_use] #[no_mangle] @@ -279,14 +288,6 @@ pub extern "C" fn Offer_expects_quantity(this_arg: &crate::lightning::offers::of ret } -/// The public key used by the recipient to sign invoices. -#[must_use] -#[no_mangle] -pub extern "C" fn Offer_signing_pubkey(this_arg: &crate::lightning::offers::offer::Offer) -> crate::c_types::PublicKey { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey(); - crate::c_types::PublicKey::from_rust(&ret) -} - #[no_mangle] /// Serialize the Offer object into a byte array which can be read by Offer_read pub extern "C" fn Offer_write(obj: &crate::lightning::offers::offer::Offer) -> crate::c_types::derived::CVec_u8Z { diff --git a/lightning-c-bindings/src/lightning/offers/parse.rs b/lightning-c-bindings/src/lightning/offers/parse.rs index 7730cc13..22ab654a 100644 --- a/lightning-c-bindings/src/lightning/offers/parse.rs +++ b/lightning-c-bindings/src/lightning/offers/parse.rs @@ -9,6 +9,7 @@ //! Parsing and formatting for bech32 message encoding. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -19,6 +20,7 @@ use alloc::{vec::Vec, boxed::Box}; mod sealed { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/offers/refund.rs b/lightning-c-bindings/src/lightning/offers/refund.rs index fe35bc20..b7ec076a 100644 --- a/lightning-c-bindings/src/lightning/offers/refund.rs +++ b/lightning-c-bindings/src/lightning/offers/refund.rs @@ -71,6 +71,7 @@ //! ``` use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -169,9 +170,9 @@ pub extern "C" fn Refund_description(this_arg: &crate::lightning::offers::refund /// If `None`, the refund does not expire. #[must_use] #[no_mangle] -pub extern "C" fn Refund_absolute_expiry(this_arg: &crate::lightning::offers::refund::Refund) -> crate::c_types::derived::COption_DurationZ { +pub extern "C" fn Refund_absolute_expiry(this_arg: &crate::lightning::offers::refund::Refund) -> crate::c_types::derived::COption_u64Z { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry(); - let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_DurationZ::None } else { crate::c_types::derived::COption_DurationZ::Some( { ret.unwrap().as_secs() }) }; + 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().as_secs() }) }; local_ret } @@ -211,8 +212,8 @@ pub extern "C" fn Refund_paths(this_arg: &crate::lightning::offers::refund::Refu /// [`payer_id`]: Self::payer_id #[must_use] #[no_mangle] -pub extern "C" fn Refund_metadata(this_arg: &crate::lightning::offers::refund::Refund) -> crate::c_types::u8slice { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata(); +pub extern "C" fn Refund_payer_metadata(this_arg: &crate::lightning::offers::refund::Refund) -> crate::c_types::u8slice { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_metadata(); let mut local_ret = crate::c_types::u8slice::from_slice(ret); local_ret } diff --git a/lightning-c-bindings/src/lightning/onion_message/messenger.rs b/lightning-c-bindings/src/lightning/onion_message/messenger.rs index 0c989038..4a0e6005 100644 --- a/lightning-c-bindings/src/lightning/onion_message/messenger.rs +++ b/lightning-c-bindings/src/lightning/onion_message/messenger.rs @@ -10,6 +10,7 @@ //! more information. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -69,6 +70,7 @@ pub(crate) type nativeOnionMessenger = nativeOnionMessengerImport(&self, w: &mut W) -> Result<(), io::Error> { @@ -174,8 +176,7 @@ pub struct MessageRouter { } unsafe impl Send for MessageRouter {} unsafe impl Sync for MessageRouter {} -#[no_mangle] -pub(crate) extern "C" fn MessageRouter_clone_fields(orig: &MessageRouter) -> MessageRouter { +pub(crate) fn MessageRouter_clone_fields(orig: &MessageRouter) -> MessageRouter { MessageRouter { this_arg: orig.this_arg, find_path: Clone::clone(&orig.find_path), @@ -201,6 +202,11 @@ impl core::ops::Deref for MessageRouter { self } } +impl core::ops::DerefMut for MessageRouter { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn MessageRouter_free(this_ptr: MessageRouter) { } @@ -682,8 +688,7 @@ pub struct CustomOnionMessageHandler { } unsafe impl Send for CustomOnionMessageHandler {} unsafe impl Sync for CustomOnionMessageHandler {} -#[no_mangle] -pub(crate) extern "C" fn CustomOnionMessageHandler_clone_fields(orig: &CustomOnionMessageHandler) -> CustomOnionMessageHandler { +pub(crate) fn CustomOnionMessageHandler_clone_fields(orig: &CustomOnionMessageHandler) -> CustomOnionMessageHandler { CustomOnionMessageHandler { this_arg: orig.this_arg, handle_custom_message: Clone::clone(&orig.handle_custom_message), @@ -715,6 +720,11 @@ impl core::ops::Deref for CustomOnionMessageHandler { self } } +impl core::ops::DerefMut for CustomOnionMessageHandler { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn CustomOnionMessageHandler_free(this_ptr: CustomOnionMessageHandler) { } @@ -725,6 +735,18 @@ impl Drop for CustomOnionMessageHandler { } } } +/// Create an onion message with contents `message` to the destination of `path`. +/// Returns (introduction_node_id, onion_msg) +/// +/// Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn create_onion_message(entropy_source: &crate::lightning::sign::EntropySource, node_signer: &crate::lightning::sign::NodeSigner, mut path: crate::lightning::onion_message::messenger::OnionMessagePath, mut message: crate::lightning::onion_message::packet::OnionMessageContents, mut reply_path: crate::lightning::blinded_path::BlindedPath) -> crate::c_types::derived::CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ { + let mut local_reply_path = if reply_path.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(reply_path.take_inner()) } }) }; + let mut ret = lightning::onion_message::messenger::create_onion_message::(entropy_source, node_signer, secp256k1::global::SECP256K1, *unsafe { Box::from_raw(path.take_inner()) }, message.into_native(), local_reply_path); + 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::PublicKey::from_rust(&orig_ret_0_0), crate::lightning::ln::msgs::OnionMessage { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::onion_message::messenger::SendError::native_into(e) }).into() }; + local_ret +} + /// Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to /// their respective handlers. #[must_use] diff --git a/lightning-c-bindings/src/lightning/onion_message/mod.rs b/lightning-c-bindings/src/lightning/onion_message/mod.rs index 83d2f00d..51cfdbcb 100644 --- a/lightning-c-bindings/src/lightning/onion_message/mod.rs +++ b/lightning-c-bindings/src/lightning/onion_message/mod.rs @@ -20,6 +20,7 @@ //! [blinded paths]: crate::blinded_path::BlindedPath use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/onion_message/offers.rs b/lightning-c-bindings/src/lightning/onion_message/offers.rs index 55fd8e1f..ae1f1a68 100644 --- a/lightning-c-bindings/src/lightning/onion_message/offers.rs +++ b/lightning-c-bindings/src/lightning/onion_message/offers.rs @@ -9,6 +9,7 @@ //! Message handling for BOLT 12 Offers. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -33,8 +34,7 @@ pub struct OffersMessageHandler { } unsafe impl Send for OffersMessageHandler {} unsafe impl Sync for OffersMessageHandler {} -#[no_mangle] -pub(crate) extern "C" fn OffersMessageHandler_clone_fields(orig: &OffersMessageHandler) -> OffersMessageHandler { +pub(crate) fn OffersMessageHandler_clone_fields(orig: &OffersMessageHandler) -> OffersMessageHandler { OffersMessageHandler { this_arg: orig.this_arg, handle_message: Clone::clone(&orig.handle_message), @@ -59,6 +59,11 @@ impl core::ops::Deref for OffersMessageHandler { self } } +impl core::ops::DerefMut for OffersMessageHandler { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn OffersMessageHandler_free(this_ptr: OffersMessageHandler) { } diff --git a/lightning-c-bindings/src/lightning/onion_message/packet.rs b/lightning-c-bindings/src/lightning/onion_message/packet.rs index 8b253aad..94d6d656 100644 --- a/lightning-c-bindings/src/lightning/onion_message/packet.rs +++ b/lightning-c-bindings/src/lightning/onion_message/packet.rs @@ -9,6 +9,7 @@ //! Structs and enums useful for constructing and reading an onion message packet. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -16,8 +17,157 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; + +use lightning::onion_message::packet::Packet as nativePacketImport; +pub(crate) type nativePacket = nativePacketImport; + +/// Packet of hop data for next peer +#[must_use] +#[repr(C)] +pub struct Packet { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, inner must be non-null, however in places where + /// the Rust equivalent takes an Option, it may be set to null to indicate None. + pub inner: *mut nativePacket, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for Packet { + fn drop(&mut self) { + if self.is_owned && !<*mut nativePacket>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the Packet, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn Packet_free(this_obj: Packet) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn Packet_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePacket) }; +} +#[allow(unused)] +impl Packet { + pub(crate) fn get_native_ref(&self) -> &'static nativePacket { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativePacket { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativePacket { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// Bolt 04 version number +#[no_mangle] +pub extern "C" fn Packet_get_version(this_ptr: &Packet) -> u8 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().version; + *inner_val +} +/// Bolt 04 version number +#[no_mangle] +pub extern "C" fn Packet_set_version(this_ptr: &mut Packet, mut val: u8) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.version = val; +} +/// A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data +#[no_mangle] +pub extern "C" fn Packet_get_public_key(this_ptr: &Packet) -> crate::c_types::PublicKey { + let mut inner_val = &mut this_ptr.get_native_mut_ref().public_key; + crate::c_types::PublicKey::from_rust(&inner_val) +} +/// A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data +#[no_mangle] +pub extern "C" fn Packet_set_public_key(this_ptr: &mut Packet, mut val: crate::c_types::PublicKey) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.public_key = val.into_rust(); +} +/// Encrypted payload for the next hop +/// +/// Returns a copy of the field. +#[no_mangle] +pub extern "C" fn Packet_get_hop_data(this_ptr: &Packet) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = this_ptr.get_native_mut_ref().hop_data.clone(); + let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { item }); }; + local_inner_val.into() +} +/// Encrypted payload for the next hop +#[no_mangle] +pub extern "C" fn Packet_set_hop_data(this_ptr: &mut Packet, mut val: crate::c_types::derived::CVec_u8Z) { + let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.hop_data = local_val; +} +/// HMAC to verify the integrity of hop_data +#[no_mangle] +pub extern "C" fn Packet_get_hmac(this_ptr: &Packet) -> *const [u8; 32] { + let mut inner_val = &mut this_ptr.get_native_mut_ref().hmac; + inner_val +} +/// HMAC to verify the integrity of hop_data +#[no_mangle] +pub extern "C" fn Packet_set_hmac(this_ptr: &mut Packet, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.hmac = val.data; +} +/// Constructs a new Packet given each field +#[must_use] +#[no_mangle] +pub extern "C" fn Packet_new(mut version_arg: u8, mut public_key_arg: crate::c_types::PublicKey, mut hop_data_arg: crate::c_types::derived::CVec_u8Z, mut hmac_arg: crate::c_types::ThirtyTwoBytes) -> Packet { + let mut local_hop_data_arg = Vec::new(); for mut item in hop_data_arg.into_rust().drain(..) { local_hop_data_arg.push( { item }); }; + Packet { inner: ObjOps::heap_alloc(nativePacket { + version: version_arg, + public_key: public_key_arg.into_rust(), + hop_data: local_hop_data_arg, + hmac: hmac_arg.data, + }), is_owned: true } +} +impl Clone for Packet { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativePacket>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn Packet_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePacket)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the Packet +pub extern "C" fn Packet_clone(orig: &Packet) -> Packet { + orig.clone() +} +/// Checks if two Packets contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +/// Two objects with NULL inner values will be considered "equal" here. +#[no_mangle] +pub extern "C" fn Packet_eq(a: &Packet, b: &Packet) -> bool { + if a.inner == b.inner { return true; } + if a.inner.is_null() || b.inner.is_null() { return false; } + if a.get_native_ref() == b.get_native_ref() { true } else { false } +} +#[no_mangle] +/// Serialize the Packet object into a byte array which can be read by Packet_read +pub extern "C" fn Packet_write(obj: &crate::lightning::onion_message::packet::Packet) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn Packet_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativePacket) }) +} /// The contents of an onion message. In the context of offers, this would be the invoice, invoice /// request, or invoice error. +#[derive(Clone)] #[must_use] #[repr(C)] pub enum OnionMessageContents { @@ -32,6 +182,23 @@ use lightning::onion_message::packet::OnionMessageContents as OnionMessageConten pub(crate) type nativeOnionMessageContents = OnionMessageContentsImport; impl OnionMessageContents { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeOnionMessageContents { + match self { + OnionMessageContents::Offers (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeOnionMessageContents::Offers ( + a_nonref.into_native(), + ) + }, + OnionMessageContents::Custom (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeOnionMessageContents::Custom ( + a_nonref, + ) + }, + } + } #[allow(unused)] pub(crate) fn into_native(self) -> nativeOnionMessageContents { match self { @@ -48,6 +215,23 @@ impl OnionMessageContents { } } #[allow(unused)] + pub(crate) fn from_native(native: &nativeOnionMessageContents) -> Self { + match native { + nativeOnionMessageContents::Offers (ref a, ) => { + let mut a_nonref = Clone::clone(a); + OnionMessageContents::Offers ( + crate::lightning::onion_message::offers::OffersMessage::native_into(a_nonref), + ) + }, + nativeOnionMessageContents::Custom (ref a, ) => { + let mut a_nonref = Clone::clone(a); + OnionMessageContents::Custom ( + Into::into(a_nonref), + ) + }, + } + } + #[allow(unused)] pub(crate) fn native_into(native: nativeOnionMessageContents) -> Self { match native { nativeOnionMessageContents::Offers (mut a, ) => { @@ -66,6 +250,11 @@ impl OnionMessageContents { /// Frees any resources used by the OnionMessageContents #[no_mangle] pub extern "C" fn OnionMessageContents_free(this_ptr: OnionMessageContents) { } +/// Creates a copy of the OnionMessageContents +#[no_mangle] +pub extern "C" fn OnionMessageContents_clone(orig: &OnionMessageContents) -> OnionMessageContents { + orig.clone() +} #[no_mangle] /// Utility method to constructs a new Offers-variant OnionMessageContents pub extern "C" fn OnionMessageContents_offers(a: crate::lightning::onion_message::offers::OffersMessage) -> OnionMessageContents { @@ -86,18 +275,22 @@ pub struct CustomOnionMessageContents { pub tlv_type: extern "C" fn (this_arg: *const c_void) -> u64, /// Serialize the object into a byte array pub write: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z, + /// Called, if set, after this CustomOnionMessageContents has been cloned into a duplicate object. + /// The new CustomOnionMessageContents is provided, and should be mutated as needed to perform a + /// deep copy of the object pointed to by this_arg or avoid any double-freeing. + pub cloned: Option, /// Frees any resources associated with this object given its this_arg pointer. /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, } unsafe impl Send for CustomOnionMessageContents {} unsafe impl Sync for CustomOnionMessageContents {} -#[no_mangle] -pub(crate) extern "C" fn CustomOnionMessageContents_clone_fields(orig: &CustomOnionMessageContents) -> CustomOnionMessageContents { +pub(crate) fn CustomOnionMessageContents_clone_fields(orig: &CustomOnionMessageContents) -> CustomOnionMessageContents { CustomOnionMessageContents { this_arg: orig.this_arg, tlv_type: Clone::clone(&orig.tlv_type), write: Clone::clone(&orig.write), + cloned: Clone::clone(&orig.cloned), free: Clone::clone(&orig.free), } } @@ -107,6 +300,18 @@ impl lightning::util::ser::Writeable for CustomOnionMessageContents { w.write_all(vec.as_slice()) } } +#[no_mangle] +/// Creates a copy of a CustomOnionMessageContents +pub extern "C" fn CustomOnionMessageContents_clone(orig: &CustomOnionMessageContents) -> CustomOnionMessageContents { + let mut res = CustomOnionMessageContents_clone_fields(orig); + if let Some(f) = orig.cloned { (f)(&mut res) }; + res +} +impl Clone for CustomOnionMessageContents { + fn clone(&self) -> Self { + CustomOnionMessageContents_clone(self) + } +} use lightning::onion_message::packet::CustomOnionMessageContents as rustCustomOnionMessageContents; impl rustCustomOnionMessageContents for CustomOnionMessageContents { @@ -124,6 +329,11 @@ impl core::ops::Deref for CustomOnionMessageContents { self } } +impl core::ops::DerefMut for CustomOnionMessageContents { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn CustomOnionMessageContents_free(this_ptr: CustomOnionMessageContents) { } diff --git a/lightning-c-bindings/src/lightning/routing/gossip.rs b/lightning-c-bindings/src/lightning/routing/gossip.rs index ed22681e..bef0af53 100644 --- a/lightning-c-bindings/src/lightning/routing/gossip.rs +++ b/lightning-c-bindings/src/lightning/routing/gossip.rs @@ -9,6 +9,7 @@ //! The [`NetworkGraph`] stores the network gossip and [`P2PGossipSync`] fetches it from peers use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -106,7 +107,7 @@ pub extern "C" fn NodeId_as_slice(this_arg: &crate::lightning::routing::gossip:: /// Get the public key from this NodeId #[must_use] #[no_mangle] -pub extern "C" fn NodeId_as_pubkey(this_arg: &crate::lightning::routing::gossip::NodeId) -> crate::c_types::derived::CResult_PublicKeyErrorZ { +pub extern "C" fn NodeId_as_pubkey(this_arg: &crate::lightning::routing::gossip::NodeId) -> crate::c_types::derived::CResult_PublicKeySecp256k1ErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_pubkey(); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::PublicKey::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() }; local_ret @@ -496,9 +497,9 @@ pub extern "C" fn P2PGossipSync_new(network_graph: &crate::lightning::routing::g /// existing announcements unless they are updated. /// Add, update or remove the provider would replace the current one. #[no_mangle] -pub extern "C" fn P2PGossipSync_add_utxo_lookup(this_arg: &mut crate::lightning::routing::gossip::P2PGossipSync, mut utxo_lookup: crate::c_types::derived::COption_UtxoLookupZ) { +pub extern "C" fn P2PGossipSync_add_utxo_lookup(this_arg: &crate::lightning::routing::gossip::P2PGossipSync, mut utxo_lookup: crate::c_types::derived::COption_UtxoLookupZ) { let mut local_utxo_lookup = { /*utxo_lookup*/ let utxo_lookup_opt = utxo_lookup; if utxo_lookup_opt.is_none() { None } else { Some({ { { utxo_lookup_opt.take() } }})} }; - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::routing::gossip::nativeP2PGossipSync)) }.add_utxo_lookup(local_utxo_lookup) + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.add_utxo_lookup(local_utxo_lookup) } /// Handles any network updates originating from [`Event`]s. @@ -823,6 +824,8 @@ pub extern "C" fn ChannelUpdateInfo_set_last_update_message(this_ptr: &mut Chann unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.last_update_message = local_val; } /// Constructs a new ChannelUpdateInfo given each field +/// +/// Note that last_update_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] pub extern "C" fn ChannelUpdateInfo_new(mut last_update_arg: u32, mut enabled_arg: bool, mut cltv_expiry_delta_arg: u16, mut htlc_minimum_msat_arg: u64, mut htlc_maximum_msat_arg: u64, mut fees_arg: crate::lightning::routing::gossip::RoutingFees, mut last_update_message_arg: crate::lightning::ln::msgs::ChannelUpdate) -> ChannelUpdateInfo { @@ -1677,6 +1680,8 @@ pub extern "C" fn NodeAnnouncementInfo_set_announcement_message(this_ptr: &mut N unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.announcement_message = local_val; } /// Constructs a new NodeAnnouncementInfo given each field +/// +/// Note that announcement_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] pub extern "C" fn NodeAnnouncementInfo_new(mut features_arg: crate::lightning::ln::features::NodeFeatures, mut last_update_arg: u32, mut rgb_arg: crate::c_types::ThreeBytes, mut alias_arg: crate::lightning::routing::gossip::NodeAlias, mut announcement_message_arg: crate::lightning::ln::msgs::NodeAnnouncement) -> NodeAnnouncementInfo { @@ -1720,9 +1725,9 @@ pub extern "C" fn NodeAnnouncementInfo_eq(a: &NodeAnnouncementInfo, b: &NodeAnno /// Internet-level addresses via which one can connect to the node #[must_use] #[no_mangle] -pub extern "C" fn NodeAnnouncementInfo_addresses(this_arg: &crate::lightning::routing::gossip::NodeAnnouncementInfo) -> crate::c_types::derived::CVec_NetAddressZ { +pub extern "C" fn NodeAnnouncementInfo_addresses(this_arg: &crate::lightning::routing::gossip::NodeAnnouncementInfo) -> crate::c_types::derived::CVec_SocketAddressZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.addresses(); - let mut local_ret_clone = Vec::new(); local_ret_clone.extend_from_slice(ret); let mut ret = local_ret_clone; let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::msgs::NetAddress::native_into(item) }); }; + let mut local_ret_clone = Vec::new(); local_ret_clone.extend_from_slice(ret); let mut ret = local_ret_clone; let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::msgs::SocketAddress::native_into(item) }); }; local_ret.into() } @@ -1945,6 +1950,8 @@ pub extern "C" fn NodeInfo_set_announcement_info(this_ptr: &mut NodeInfo, mut va unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.announcement_info = local_val; } /// Constructs a new NodeInfo given each field +/// +/// Note that announcement_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] pub extern "C" fn NodeInfo_new(mut channels_arg: crate::c_types::derived::CVec_u64Z, mut announcement_info_arg: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> NodeInfo { @@ -2266,9 +2273,9 @@ pub extern "C" fn ReadOnlyNetworkGraph_list_nodes(this_arg: &crate::lightning::r /// or if node announcement for the node was never received. #[must_use] #[no_mangle] -pub extern "C" fn ReadOnlyNetworkGraph_get_addresses(this_arg: &crate::lightning::routing::gossip::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::gossip::ReadOnlyNetworkGraph, mut pubkey: crate::c_types::PublicKey) -> crate::c_types::derived::COption_CVec_SocketAddressZZ { 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() }) }; + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_SocketAddressZZ::None } else { crate::c_types::derived::COption_CVec_SocketAddressZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::lightning::ln::msgs::SocketAddress::native_into(item) }); }; local_ret_0.into() }) }; local_ret } diff --git a/lightning-c-bindings/src/lightning/routing/mod.rs b/lightning-c-bindings/src/lightning/routing/mod.rs index d010ca5d..ec192712 100644 --- a/lightning-c-bindings/src/lightning/routing/mod.rs +++ b/lightning-c-bindings/src/lightning/routing/mod.rs @@ -9,6 +9,7 @@ //! Structs and impls for receiving messages about the network and storing the topology live here. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/routing/router.rs b/lightning-c-bindings/src/lightning/routing/router.rs index 5e12f9e8..4594db3e 100644 --- a/lightning-c-bindings/src/lightning/routing/router.rs +++ b/lightning-c-bindings/src/lightning/routing/router.rs @@ -9,6 +9,7 @@ //! The router finds paths within a [`NetworkGraph`] for a payment. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -141,8 +142,7 @@ pub struct Router { } unsafe impl Send for Router {} unsafe impl Sync for Router {} -#[no_mangle] -pub(crate) extern "C" fn Router_clone_fields(orig: &Router) -> Router { +pub(crate) fn Router_clone_fields(orig: &Router) -> Router { Router { this_arg: orig.this_arg, find_route: Clone::clone(&orig.find_route), @@ -175,6 +175,11 @@ impl core::ops::Deref for Router { self } } +impl core::ops::DerefMut for Router { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn Router_free(this_ptr: Router) { } @@ -187,14 +192,14 @@ impl Drop for Router { } use lightning::routing::router::ScorerAccountingForInFlightHtlcs as nativeScorerAccountingForInFlightHtlcsImport; -pub(crate) type nativeScorerAccountingForInFlightHtlcs = nativeScorerAccountingForInFlightHtlcsImport<'static, crate::lightning::routing::scoring::Score>; +pub(crate) type nativeScorerAccountingForInFlightHtlcs = nativeScorerAccountingForInFlightHtlcsImport<'static, crate::lightning::routing::scoring::ScoreLookUp>; -/// [`Score`] implementation that factors in in-flight HTLC liquidity. +/// [`ScoreLookUp`] implementation that factors in in-flight HTLC liquidity. /// -/// Useful for custom [`Router`] implementations to wrap their [`Score`] on-the-fly when calling +/// Useful for custom [`Router`] implementations to wrap their [`ScoreLookUp`] on-the-fly when calling /// [`find_route`]. /// -/// [`Score`]: crate::routing::scoring::Score +/// [`ScoreLookUp`]: crate::routing::scoring::ScoreLookUp #[must_use] #[repr(C)] pub struct ScorerAccountingForInFlightHtlcs { @@ -244,63 +249,37 @@ impl ScorerAccountingForInFlightHtlcs { /// Initialize a new `ScorerAccountingForInFlightHtlcs`. #[must_use] #[no_mangle] -pub extern "C" fn ScorerAccountingForInFlightHtlcs_new(mut scorer: crate::lightning::routing::scoring::Score, inflight_htlcs: &crate::lightning::routing::router::InFlightHtlcs) -> crate::lightning::routing::router::ScorerAccountingForInFlightHtlcs { +pub extern "C" fn ScorerAccountingForInFlightHtlcs_new(mut scorer: crate::lightning::routing::scoring::ScoreLookUp, inflight_htlcs: &crate::lightning::routing::router::InFlightHtlcs) -> crate::lightning::routing::router::ScorerAccountingForInFlightHtlcs { let mut ret = lightning::routing::router::ScorerAccountingForInFlightHtlcs::new(scorer, inflight_htlcs.get_native_ref()); crate::lightning::routing::router::ScorerAccountingForInFlightHtlcs { inner: ObjOps::heap_alloc(ret), is_owned: true } } -#[no_mangle] -/// Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read -pub extern "C" fn ScorerAccountingForInFlightHtlcs_write(obj: &crate::lightning::routing::router::ScorerAccountingForInFlightHtlcs) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[no_mangle] -pub(crate) extern "C" fn ScorerAccountingForInFlightHtlcs_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeScorerAccountingForInFlightHtlcs) }) -} -impl From for crate::lightning::routing::scoring::Score { +impl From for crate::lightning::routing::scoring::ScoreLookUp { fn from(obj: nativeScorerAccountingForInFlightHtlcs) -> Self { let mut rust_obj = ScorerAccountingForInFlightHtlcs { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = ScorerAccountingForInFlightHtlcs_as_Score(&rust_obj); + let mut ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&rust_obj); // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn rust_obj.inner = core::ptr::null_mut(); ret.free = Some(ScorerAccountingForInFlightHtlcs_free_void); ret } } -/// Constructs a new Score which calls the relevant methods on this_arg. -/// This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is +/// Constructs a new ScoreLookUp which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is #[no_mangle] -pub extern "C" fn ScorerAccountingForInFlightHtlcs_as_Score(this_arg: &ScorerAccountingForInFlightHtlcs) -> crate::lightning::routing::scoring::Score { - crate::lightning::routing::scoring::Score { +pub extern "C" fn ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(this_arg: &ScorerAccountingForInFlightHtlcs) -> crate::lightning::routing::scoring::ScoreLookUp { + crate::lightning::routing::scoring::ScoreLookUp { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - channel_penalty_msat: ScorerAccountingForInFlightHtlcs_Score_channel_penalty_msat, - payment_path_failed: ScorerAccountingForInFlightHtlcs_Score_payment_path_failed, - payment_path_successful: ScorerAccountingForInFlightHtlcs_Score_payment_path_successful, - probe_failed: ScorerAccountingForInFlightHtlcs_Score_probe_failed, - probe_successful: ScorerAccountingForInFlightHtlcs_Score_probe_successful, - write: ScorerAccountingForInFlightHtlcs_write_void, + channel_penalty_msat: ScorerAccountingForInFlightHtlcs_ScoreLookUp_channel_penalty_msat, } } #[must_use] -extern "C" fn ScorerAccountingForInFlightHtlcs_Score_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 { - let mut ret = >::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeScorerAccountingForInFlightHtlcs) }, short_channel_id, source.get_native_ref(), target.get_native_ref(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref()); +extern "C" fn ScorerAccountingForInFlightHtlcs_ScoreLookUp_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 { + let mut ret = >::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeScorerAccountingForInFlightHtlcs) }, short_channel_id, source.get_native_ref(), target.get_native_ref(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref()); ret } -extern "C" fn ScorerAccountingForInFlightHtlcs_Score_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { - >::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeScorerAccountingForInFlightHtlcs) }, path.get_native_ref(), short_channel_id) -} -extern "C" fn ScorerAccountingForInFlightHtlcs_Score_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { - >::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeScorerAccountingForInFlightHtlcs) }, path.get_native_ref()) -} -extern "C" fn ScorerAccountingForInFlightHtlcs_Score_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { - >::probe_failed(unsafe { &mut *(this_arg as *mut nativeScorerAccountingForInFlightHtlcs) }, path.get_native_ref(), short_channel_id) -} -extern "C" fn ScorerAccountingForInFlightHtlcs_Score_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { - >::probe_successful(unsafe { &mut *(this_arg as *mut nativeScorerAccountingForInFlightHtlcs) }, path.get_native_ref()) -} use lightning::routing::router::InFlightHtlcs as nativeInFlightHtlcsImport; @@ -562,10 +541,35 @@ pub extern "C" fn RouteHop_get_cltv_expiry_delta(this_ptr: &RouteHop) -> u32 { pub extern "C" fn RouteHop_set_cltv_expiry_delta(this_ptr: &mut RouteHop, mut val: u32) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry_delta = val; } +/// Indicates whether this hop is possibly announced in the public network graph. +/// +/// Will be `true` if there is a possibility that the channel is publicly known, i.e., if we +/// either know for sure it's announced in the public graph, or if any public channels exist +/// for which the given `short_channel_id` could be an alias for. Will be `false` if we believe +/// the channel to be unannounced. +/// +/// Will be `true` for objects serialized with LDK version 0.0.116 and before. +#[no_mangle] +pub extern "C" fn RouteHop_get_maybe_announced_channel(this_ptr: &RouteHop) -> bool { + let mut inner_val = &mut this_ptr.get_native_mut_ref().maybe_announced_channel; + *inner_val +} +/// Indicates whether this hop is possibly announced in the public network graph. +/// +/// Will be `true` if there is a possibility that the channel is publicly known, i.e., if we +/// either know for sure it's announced in the public graph, or if any public channels exist +/// for which the given `short_channel_id` could be an alias for. Will be `false` if we believe +/// the channel to be unannounced. +/// +/// Will be `true` for objects serialized with LDK version 0.0.116 and before. +#[no_mangle] +pub extern "C" fn RouteHop_set_maybe_announced_channel(this_ptr: &mut RouteHop, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.maybe_announced_channel = val; +} /// Constructs a new RouteHop given each field #[must_use] #[no_mangle] -pub extern "C" fn RouteHop_new(mut pubkey_arg: crate::c_types::PublicKey, mut node_features_arg: crate::lightning::ln::features::NodeFeatures, mut short_channel_id_arg: u64, mut channel_features_arg: crate::lightning::ln::features::ChannelFeatures, mut fee_msat_arg: u64, mut cltv_expiry_delta_arg: u32) -> RouteHop { +pub extern "C" fn RouteHop_new(mut pubkey_arg: crate::c_types::PublicKey, mut node_features_arg: crate::lightning::ln::features::NodeFeatures, mut short_channel_id_arg: u64, mut channel_features_arg: crate::lightning::ln::features::ChannelFeatures, mut fee_msat_arg: u64, mut cltv_expiry_delta_arg: u32, mut maybe_announced_channel_arg: bool) -> RouteHop { RouteHop { inner: ObjOps::heap_alloc(nativeRouteHop { pubkey: pubkey_arg.into_rust(), node_features: *unsafe { Box::from_raw(node_features_arg.take_inner()) }, @@ -573,6 +577,7 @@ pub extern "C" fn RouteHop_new(mut pubkey_arg: crate::c_types::PublicKey, mut no channel_features: *unsafe { Box::from_raw(channel_features_arg.take_inner()) }, fee_msat: fee_msat_arg, cltv_expiry_delta: cltv_expiry_delta_arg, + maybe_announced_channel: maybe_announced_channel_arg, }), is_owned: true } } impl Clone for RouteHop { @@ -888,6 +893,8 @@ pub extern "C" fn Path_set_blinded_tail(this_ptr: &mut Path, mut val: crate::lig unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.blinded_tail = local_val; } /// Constructs a new Path given each field +/// +/// Note that blinded_tail_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] pub extern "C" fn Path_new(mut hops_arg: crate::c_types::derived::CVec_RouteHopZ, mut blinded_tail_arg: crate::lightning::routing::router::BlindedTail) -> Path { @@ -1030,36 +1037,42 @@ pub extern "C" fn Route_set_paths(this_ptr: &mut Route, mut val: crate::c_types: let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.paths = local_val; } -/// The `payment_params` parameter passed via [`RouteParameters`] to [`find_route`]. +/// The `route_params` parameter passed to [`find_route`]. /// /// This is used by `ChannelManager` to track information which may be required for retries. /// +/// Will be `None` for objects serialized with LDK versions prior to 0.0.117. +/// /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None #[no_mangle] -pub extern "C" fn Route_get_payment_params(this_ptr: &Route) -> crate::lightning::routing::router::PaymentParameters { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_params; - let mut local_inner_val = crate::lightning::routing::router::PaymentParameters { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::router::PaymentParameters<>) as *mut _ }, is_owned: false }; +pub extern "C" fn Route_get_route_params(this_ptr: &Route) -> crate::lightning::routing::router::RouteParameters { + let mut inner_val = &mut this_ptr.get_native_mut_ref().route_params; + let mut local_inner_val = crate::lightning::routing::router::RouteParameters { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::routing::router::RouteParameters<>) as *mut _ }, is_owned: false }; local_inner_val } -/// The `payment_params` parameter passed via [`RouteParameters`] to [`find_route`]. +/// The `route_params` parameter passed to [`find_route`]. /// /// This is used by `ChannelManager` to track information which may be required for retries. /// +/// Will be `None` for objects serialized with LDK versions prior to 0.0.117. +/// /// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None #[no_mangle] -pub extern "C" fn Route_set_payment_params(this_ptr: &mut Route, mut val: crate::lightning::routing::router::PaymentParameters) { +pub extern "C" fn Route_set_route_params(this_ptr: &mut Route, mut val: crate::lightning::routing::router::RouteParameters) { let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_params = local_val; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.route_params = local_val; } /// Constructs a new Route given each field +/// +/// Note that route_params_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn Route_new(mut paths_arg: crate::c_types::derived::CVec_PathZ, mut payment_params_arg: crate::lightning::routing::router::PaymentParameters) -> Route { +pub extern "C" fn Route_new(mut paths_arg: crate::c_types::derived::CVec_PathZ, mut route_params_arg: crate::lightning::routing::router::RouteParameters) -> Route { let mut local_paths_arg = Vec::new(); for mut item in paths_arg.into_rust().drain(..) { local_paths_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut local_payment_params_arg = if payment_params_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(payment_params_arg.take_inner()) } }) }; + let mut local_route_params_arg = if route_params_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(route_params_arg.take_inner()) } }) }; Route { inner: ObjOps::heap_alloc(nativeRoute { paths: local_paths_arg, - payment_params: local_payment_params_arg, + route_params: local_route_params_arg, }), is_owned: true } } impl Clone for Route { @@ -1102,8 +1115,11 @@ pub extern "C" fn Route_eq(a: &Route, b: &Route) -> bool { } /// Returns the total amount of fees paid on this [`Route`]. /// -/// This doesn't include any extra payment made to the recipient, which can happen in excess of -/// the amount passed to [`find_route`]'s `route_params.final_value_msat`. +/// For objects serialized with LDK 0.0.117 and after, this includes any extra payment made to +/// the recipient, which can happen in excess of the amount passed to [`find_route`] via +/// [`RouteParameters::final_value_msat`], if we had to reach the [`htlc_minimum_msat`] limits. +/// +/// [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message #[must_use] #[no_mangle] pub extern "C" fn Route_get_total_fees(this_arg: &crate::lightning::routing::router::Route) -> u64 { @@ -1111,8 +1127,12 @@ pub extern "C" fn Route_get_total_fees(this_arg: &crate::lightning::routing::rou ret } -/// Returns the total amount paid on this [`Route`], excluding the fees. Might be more than -/// requested if we had to reach htlc_minimum_msat. +/// Returns the total amount paid on this [`Route`], excluding the fees. +/// +/// Might be more than requested as part of the given [`RouteParameters::final_value_msat`] if +/// we had to reach the [`htlc_minimum_msat`] limits. +/// +/// [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message #[must_use] #[no_mangle] pub extern "C" fn Route_get_total_amount(this_arg: &crate::lightning::routing::router::Route) -> u64 { @@ -1211,13 +1231,38 @@ pub extern "C" fn RouteParameters_get_final_value_msat(this_ptr: &RouteParameter pub extern "C" fn RouteParameters_set_final_value_msat(this_ptr: &mut RouteParameters, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.final_value_msat = val; } +/// The maximum total fees, in millisatoshi, that may accrue during route finding. +/// +/// This limit also applies to the total fees that may arise while retrying failed payment +/// paths. +/// +/// Note that values below a few sats may result in some paths being spuriously ignored. +#[no_mangle] +pub extern "C" fn RouteParameters_get_max_total_routing_fee_msat(this_ptr: &RouteParameters) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().max_total_routing_fee_msat; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) }; + local_inner_val +} +/// The maximum total fees, in millisatoshi, that may accrue during route finding. +/// +/// This limit also applies to the total fees that may arise while retrying failed payment +/// paths. +/// +/// Note that values below a few sats may result in some paths being spuriously ignored. +#[no_mangle] +pub extern "C" fn RouteParameters_set_max_total_routing_fee_msat(this_ptr: &mut RouteParameters, mut val: crate::c_types::derived::COption_u64Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_total_routing_fee_msat = local_val; +} /// Constructs a new RouteParameters given each field #[must_use] #[no_mangle] -pub extern "C" fn RouteParameters_new(mut payment_params_arg: crate::lightning::routing::router::PaymentParameters, mut final_value_msat_arg: u64) -> RouteParameters { +pub extern "C" fn RouteParameters_new(mut payment_params_arg: crate::lightning::routing::router::PaymentParameters, mut final_value_msat_arg: u64, mut max_total_routing_fee_msat_arg: crate::c_types::derived::COption_u64Z) -> RouteParameters { + let mut local_max_total_routing_fee_msat_arg = if max_total_routing_fee_msat_arg.is_some() { Some( { max_total_routing_fee_msat_arg.take() }) } else { None }; RouteParameters { inner: ObjOps::heap_alloc(nativeRouteParameters { payment_params: *unsafe { Box::from_raw(payment_params_arg.take_inner()) }, final_value_msat: final_value_msat_arg, + max_total_routing_fee_msat: local_max_total_routing_fee_msat_arg, }), is_owned: true } } impl Clone for RouteParameters { @@ -1239,6 +1284,16 @@ pub(crate) extern "C" fn RouteParameters_clone_void(this_ptr: *const c_void) -> pub extern "C" fn RouteParameters_clone(orig: &RouteParameters) -> RouteParameters { orig.clone() } +/// Generates a non-cryptographic 64-bit hash of the RouteParameters. +#[no_mangle] +pub extern "C" fn RouteParameters_hash(o: &RouteParameters) -> u64 { + if o.inner.is_null() { return 0; } + // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core + #[allow(deprecated)] + let mut hasher = core::hash::SipHasher::new(); + core::hash::Hash::hash(o.get_native_ref(), &mut hasher); + core::hash::Hasher::finish(&hasher) +} /// Checks if two RouteParameterss contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. /// Two objects with NULL inner values will be considered "equal" here. @@ -1248,6 +1303,16 @@ pub extern "C" fn RouteParameters_eq(a: &RouteParameters, b: &RouteParameters) - if a.inner.is_null() || b.inner.is_null() { return false; } if a.get_native_ref() == b.get_native_ref() { true } else { false } } +/// Constructs [`RouteParameters`] from the given [`PaymentParameters`] and a payment amount. +/// +/// [`Self::max_total_routing_fee_msat`] defaults to 1% of the payment amount + 50 sats +#[must_use] +#[no_mangle] +pub extern "C" fn RouteParameters_from_payment_params_and_value(mut payment_params: crate::lightning::routing::router::PaymentParameters, mut final_value_msat: u64) -> crate::lightning::routing::router::RouteParameters { + let mut ret = lightning::routing::router::RouteParameters::from_payment_params_and_value(*unsafe { Box::from_raw(payment_params.take_inner()) }, final_value_msat); + crate::lightning::routing::router::RouteParameters { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + #[no_mangle] /// Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read pub extern "C" fn RouteParameters_write(obj: &crate::lightning::routing::router::RouteParameters) -> crate::c_types::derived::CVec_u8Z { @@ -1536,6 +1601,15 @@ pub extern "C" fn PaymentParameters_from_bolt12_invoice(invoice: &crate::lightni crate::lightning::routing::router::PaymentParameters { inner: ObjOps::heap_alloc(ret), is_owned: true } } +/// Creates parameters for paying to a blinded payee from the provided blinded route hints. +#[must_use] +#[no_mangle] +pub extern "C" fn PaymentParameters_blinded(mut blinded_route_hints: crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) -> crate::lightning::routing::router::PaymentParameters { + let mut local_blinded_route_hints = Vec::new(); for mut item in blinded_route_hints.into_rust().drain(..) { local_blinded_route_hints.push( { let (mut orig_blinded_route_hints_0_0, mut orig_blinded_route_hints_0_1) = item.to_rust(); let mut local_blinded_route_hints_0 = (*unsafe { Box::from_raw(orig_blinded_route_hints_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_blinded_route_hints_0_1.take_inner()) }); local_blinded_route_hints_0 }); }; + let mut ret = lightning::routing::router::PaymentParameters::blinded(local_blinded_route_hints); + crate::lightning::routing::router::PaymentParameters { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + /// The recipient of a payment, differing based on whether they've hidden their identity with route /// blinding. #[derive(Clone)] @@ -2068,9 +2142,9 @@ pub extern "C" fn RouteHintHop_read(ser: crate::c_types::u8slice) -> crate::c_ty /// /// Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None #[no_mangle] -pub extern "C" fn find_route(mut our_node_pubkey: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, network_graph: &crate::lightning::routing::gossip::NetworkGraph, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut logger: crate::lightning::util::logger::Logger, scorer: &crate::lightning::routing::scoring::Score, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters, random_seed_bytes: *const [u8; 32]) -> crate::c_types::derived::CResult_RouteLightningErrorZ { +pub extern "C" fn find_route(mut our_node_pubkey: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, network_graph: &crate::lightning::routing::gossip::NetworkGraph, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut logger: crate::lightning::util::logger::Logger, scorer: &crate::lightning::routing::scoring::ScoreLookUp, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters, random_seed_bytes: *const [u8; 32]) -> crate::c_types::derived::CResult_RouteLightningErrorZ { let mut local_first_hops_base = if first_hops == core::ptr::null_mut() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { item.get_native_ref() }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]); - let mut ret = lightning::routing::router::find_route::(&our_node_pubkey.into_rust(), route_params.get_native_ref(), network_graph.get_native_ref(), local_first_hops, logger, scorer, score_params.get_native_ref(), unsafe { &*random_seed_bytes}); + let mut ret = lightning::routing::router::find_route::(&our_node_pubkey.into_rust(), route_params.get_native_ref(), network_graph.get_native_ref(), local_first_hops, logger, scorer, score_params.get_native_ref(), unsafe { &*random_seed_bytes}); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).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 } diff --git a/lightning-c-bindings/src/lightning/routing/scoring.rs b/lightning-c-bindings/src/lightning/routing/scoring.rs index f76cf9d1..8060fbf2 100644 --- a/lightning-c-bindings/src/lightning/routing/scoring.rs +++ b/lightning-c-bindings/src/lightning/routing/scoring.rs @@ -9,7 +9,7 @@ //! Utilities for scoring payment channels. //! //! [`ProbabilisticScorer`] may be given to [`find_route`] to score payment channels during path -//! finding when a custom [`Score`] implementation is not needed. +//! finding when a custom [`ScoreLookUp`] implementation is not needed. //! //! # Example //! @@ -56,6 +56,7 @@ //! [`find_route`]: crate::routing::router::find_route use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -65,9 +66,11 @@ use alloc::{vec::Vec, boxed::Box}; /// An interface used to score payment channels for path finding. /// -///\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel. +/// `ScoreLookUp` is used to determine the penalty for a given channel. +/// +/// Scoring is in terms of fees willing to be paid in order to avoid routing through a channel. #[repr(C)] -pub struct Score { +pub struct ScoreLookUp { /// An opaque pointer which is passed to your function implementations as an argument. /// This has no meaning in the LDK, and can be NULL or any other value. pub this_arg: *mut c_void, @@ -80,6 +83,57 @@ pub struct Score { /// [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount. /// Thus, implementations should be overflow-safe. pub channel_penalty_msat: extern "C" fn (this_arg: *const c_void, short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64, + /// Frees any resources associated with this object given its this_arg pointer. + /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + pub free: Option, +} +unsafe impl Send for ScoreLookUp {} +unsafe impl Sync for ScoreLookUp {} +pub(crate) fn ScoreLookUp_clone_fields(orig: &ScoreLookUp) -> ScoreLookUp { + ScoreLookUp { + this_arg: orig.this_arg, + channel_penalty_msat: Clone::clone(&orig.channel_penalty_msat), + free: Clone::clone(&orig.free), + } +} + +use lightning::routing::scoring::ScoreLookUp as rustScoreLookUp; +impl rustScoreLookUp for ScoreLookUp { + fn channel_penalty_msat(&self, mut short_channel_id: u64, mut source: &lightning::routing::gossip::NodeId, mut target: &lightning::routing::gossip::NodeId, mut usage: lightning::routing::scoring::ChannelUsage, mut score_params: &lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 { + let mut ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, &crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((source as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }, &crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((target as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }, crate::lightning::routing::scoring::ChannelUsage { inner: ObjOps::heap_alloc(usage), is_owned: true }, &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((score_params as *const lightning::routing::scoring::ProbabilisticScoringFeeParameters<>) as *mut _) }, is_owned: false }); + ret + } +} + +// We're essentially a pointer already, or at least a set of pointers, so allow us to be used +// directly as a Deref trait in higher-level structs: +impl core::ops::Deref for ScoreLookUp { + type Target = Self; + fn deref(&self) -> &Self { + self + } +} +impl core::ops::DerefMut for ScoreLookUp { + fn deref_mut(&mut self) -> &mut Self { + self + } +} +/// Calls the free function if one is set +#[no_mangle] +pub extern "C" fn ScoreLookUp_free(this_ptr: ScoreLookUp) { } +impl Drop for ScoreLookUp { + fn drop(&mut self) { + if let Some(f) = self.free { + f(self.this_arg); + } + } +} +/// `ScoreUpdate` is used to update the scorer's internal state after a payment attempt. +#[repr(C)] +pub struct ScoreUpdate { + /// An opaque pointer which is passed to your function implementations as an argument. + /// This has no meaning in the LDK, and can be NULL or any other value. + pub this_arg: *mut c_void, /// Handles updating channel penalties after failing to route through a channel. pub payment_path_failed: extern "C" fn (this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, short_channel_id: u64), /// Handles updating channel penalties after successfully routing along a path. @@ -88,54 +142,125 @@ pub struct Score { pub probe_failed: extern "C" fn (this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, short_channel_id: u64), /// Handles updating channel penalties after a probe over the given path succeeded. pub probe_successful: extern "C" fn (this_arg: *mut c_void, path: &crate::lightning::routing::router::Path), - /// Serialize the object into a byte array - pub write: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z, /// Frees any resources associated with this object given its this_arg pointer. /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, } -unsafe impl Send for Score {} -unsafe impl Sync for Score {} -#[no_mangle] -pub(crate) extern "C" fn Score_clone_fields(orig: &Score) -> Score { - Score { +unsafe impl Send for ScoreUpdate {} +unsafe impl Sync for ScoreUpdate {} +pub(crate) fn ScoreUpdate_clone_fields(orig: &ScoreUpdate) -> ScoreUpdate { + ScoreUpdate { this_arg: orig.this_arg, - channel_penalty_msat: Clone::clone(&orig.channel_penalty_msat), payment_path_failed: Clone::clone(&orig.payment_path_failed), payment_path_successful: Clone::clone(&orig.payment_path_successful), probe_failed: Clone::clone(&orig.probe_failed), probe_successful: Clone::clone(&orig.probe_successful), - write: Clone::clone(&orig.write), free: Clone::clone(&orig.free), } } -impl lightning::util::ser::Writeable for Score { - fn write(&self, w: &mut W) -> Result<(), crate::c_types::io::Error> { - let vec = (self.write)(self.this_arg); - w.write_all(vec.as_slice()) + +use lightning::routing::scoring::ScoreUpdate as rustScoreUpdate; +impl rustScoreUpdate for ScoreUpdate { + fn payment_path_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64) { + (self.payment_path_failed)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id) + } + fn payment_path_successful(&mut self, mut path: &lightning::routing::router::Path) { + (self.payment_path_successful)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }) + } + fn probe_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64) { + (self.probe_failed)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id) + } + fn probe_successful(&mut self, mut path: &lightning::routing::router::Path) { + (self.probe_successful)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }) } } -use lightning::routing::scoring::Score as rustScore; -impl rustScore for Score { +// We're essentially a pointer already, or at least a set of pointers, so allow us to be used +// directly as a Deref trait in higher-level structs: +impl core::ops::Deref for ScoreUpdate { + type Target = Self; + fn deref(&self) -> &Self { + self + } +} +impl core::ops::DerefMut for ScoreUpdate { + fn deref_mut(&mut self) -> &mut Self { + self + } +} +/// Calls the free function if one is set +#[no_mangle] +pub extern "C" fn ScoreUpdate_free(this_ptr: ScoreUpdate) { } +impl Drop for ScoreUpdate { + fn drop(&mut self) { + if let Some(f) = self.free { + f(self.this_arg); + } + } +} +/// A trait which can both lookup and update routing channel penalty scores. +/// +/// This is used in places where both bounds are required and implemented for all types which +/// implement [`ScoreLookUp`] and [`ScoreUpdate`]. +/// +/// Bindings users may need to manually implement this for their custom scoring implementations. +#[repr(C)] +pub struct Score { + /// An opaque pointer which is passed to your function implementations as an argument. + /// This has no meaning in the LDK, and can be NULL or any other value. + pub this_arg: *mut c_void, + /// Implementation of ScoreLookUp for this object. + pub ScoreLookUp: crate::lightning::routing::scoring::ScoreLookUp, + /// Implementation of ScoreUpdate for this object. + pub ScoreUpdate: crate::lightning::routing::scoring::ScoreUpdate, + /// Serialize the object into a byte array + pub write: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z, + /// Frees any resources associated with this object given its this_arg pointer. + /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + pub free: Option, +} +unsafe impl Send for Score {} +unsafe impl Sync for Score {} +pub(crate) fn Score_clone_fields(orig: &Score) -> Score { + Score { + this_arg: orig.this_arg, + ScoreLookUp: crate::lightning::routing::scoring::ScoreLookUp_clone_fields(&orig.ScoreLookUp), + ScoreUpdate: crate::lightning::routing::scoring::ScoreUpdate_clone_fields(&orig.ScoreUpdate), + write: Clone::clone(&orig.write), + free: Clone::clone(&orig.free), + } +} +impl lightning::routing::scoring::ScoreLookUp for Score { fn channel_penalty_msat(&self, mut short_channel_id: u64, mut source: &lightning::routing::gossip::NodeId, mut target: &lightning::routing::gossip::NodeId, mut usage: lightning::routing::scoring::ChannelUsage, mut score_params: &lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 { - let mut ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, &crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((source as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }, &crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((target as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }, crate::lightning::routing::scoring::ChannelUsage { inner: ObjOps::heap_alloc(usage), is_owned: true }, &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((score_params as *const lightning::routing::scoring::ProbabilisticScoringFeeParameters<>) as *mut _) }, is_owned: false }); + let mut ret = (self.ScoreLookUp.channel_penalty_msat)(self.ScoreLookUp.this_arg, short_channel_id, &crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((source as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }, &crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((target as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }, crate::lightning::routing::scoring::ChannelUsage { inner: ObjOps::heap_alloc(usage), is_owned: true }, &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((score_params as *const lightning::routing::scoring::ProbabilisticScoringFeeParameters<>) as *mut _) }, is_owned: false }); ret } +} +impl lightning::routing::scoring::ScoreUpdate for Score { fn payment_path_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64) { - (self.payment_path_failed)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id) + (self.ScoreUpdate.payment_path_failed)(self.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id) } fn payment_path_successful(&mut self, mut path: &lightning::routing::router::Path) { - (self.payment_path_successful)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }) + (self.ScoreUpdate.payment_path_successful)(self.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }) } fn probe_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64) { - (self.probe_failed)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id) + (self.ScoreUpdate.probe_failed)(self.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id) } fn probe_successful(&mut self, mut path: &lightning::routing::router::Path) { - (self.probe_successful)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }) + (self.ScoreUpdate.probe_successful)(self.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }) + } +} +impl lightning::util::ser::Writeable for Score { + fn write(&self, w: &mut W) -> Result<(), crate::c_types::io::Error> { + let vec = (self.write)(self.this_arg); + w.write_all(vec.as_slice()) } } +use lightning::routing::scoring::Score as rustScore; +impl rustScore for Score { +} + // We're essentially a pointer already, or at least a set of pointers, so allow us to be used // directly as a Deref trait in higher-level structs: impl core::ops::Deref for Score { @@ -144,6 +269,11 @@ impl core::ops::Deref for Score { self } } +impl core::ops::DerefMut for Score { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn Score_free(this_ptr: Score) { } @@ -156,10 +286,10 @@ impl Drop for Score { } /// A scorer that is accessed under a lock. /// -/// Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while -/// having shared ownership of a scorer but without requiring internal locking in [`Score`] +/// Needed so that calls to [`ScoreLookUp::channel_penalty_msat`] in [`find_route`] can be made while +/// having shared ownership of a scorer but without requiring internal locking in [`ScoreUpdate`] /// implementations. Internal locking would be detrimental to route finding performance and could -/// result in [`Score::channel_penalty_msat`] returning a different value for the same channel. +/// result in [`ScoreLookUp::channel_penalty_msat`] returning a different value for the same channel. /// /// [`find_route`]: crate::routing::router::find_route #[repr(C)] @@ -167,28 +297,37 @@ pub struct LockableScore { /// An opaque pointer which is passed to your function implementations as an argument. /// This has no meaning in the LDK, and can be NULL or any other value. pub this_arg: *mut c_void, - /// Returns the locked scorer. - pub lock: extern "C" fn (this_arg: *const c_void) -> crate::lightning::routing::scoring::Score, + /// Returns read locked scorer. + pub read_lock: extern "C" fn (this_arg: *const c_void) -> crate::lightning::routing::scoring::ScoreLookUp, + /// Returns write locked scorer. + pub write_lock: extern "C" fn (this_arg: *const c_void) -> crate::lightning::routing::scoring::ScoreUpdate, /// Frees any resources associated with this object given its this_arg pointer. /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, } unsafe impl Send for LockableScore {} unsafe impl Sync for LockableScore {} -#[no_mangle] -pub(crate) extern "C" fn LockableScore_clone_fields(orig: &LockableScore) -> LockableScore { +pub(crate) fn LockableScore_clone_fields(orig: &LockableScore) -> LockableScore { LockableScore { this_arg: orig.this_arg, - lock: Clone::clone(&orig.lock), + read_lock: Clone::clone(&orig.read_lock), + write_lock: Clone::clone(&orig.write_lock), free: Clone::clone(&orig.free), } } use lightning::routing::scoring::LockableScore as rustLockableScore; impl<'a> rustLockableScore<'a> for LockableScore { - type Locked = crate::lightning::routing::scoring::Score; - fn lock(&'a self) -> crate::lightning::routing::scoring::Score { - let mut ret = (self.lock)(self.this_arg); + type ScoreUpdate = crate::lightning::routing::scoring::ScoreUpdate; + type ScoreLookUp = crate::lightning::routing::scoring::ScoreLookUp; + type WriteLocked = crate::lightning::routing::scoring::ScoreUpdate; + type ReadLocked = crate::lightning::routing::scoring::ScoreLookUp; + fn read_lock(&'a self) -> crate::lightning::routing::scoring::ScoreLookUp { + let mut ret = (self.read_lock)(self.this_arg); + ret + } + fn write_lock(&'a self) -> crate::lightning::routing::scoring::ScoreUpdate { + let mut ret = (self.write_lock)(self.this_arg); ret } } @@ -201,6 +340,11 @@ impl core::ops::Deref for LockableScore { self } } +impl core::ops::DerefMut for LockableScore { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn LockableScore_free(this_ptr: LockableScore) { } @@ -230,8 +374,7 @@ pub struct WriteableScore { } unsafe impl Send for WriteableScore {} unsafe impl Sync for WriteableScore {} -#[no_mangle] -pub(crate) extern "C" fn WriteableScore_clone_fields(orig: &WriteableScore) -> WriteableScore { +pub(crate) fn WriteableScore_clone_fields(orig: &WriteableScore) -> WriteableScore { WriteableScore { this_arg: orig.this_arg, LockableScore: crate::lightning::routing::scoring::LockableScore_clone_fields(&orig.LockableScore), @@ -240,9 +383,16 @@ pub(crate) extern "C" fn WriteableScore_clone_fields(orig: &WriteableScore) -> W } } impl<'a> lightning::routing::scoring::LockableScore<'a> for WriteableScore { - type Locked = crate::lightning::routing::scoring::Score; - fn lock(&'a self) -> crate::lightning::routing::scoring::Score { - let mut ret = (self.LockableScore.lock)(self.LockableScore.this_arg); + type ScoreUpdate = crate::lightning::routing::scoring::ScoreUpdate; + type ScoreLookUp = crate::lightning::routing::scoring::ScoreLookUp; + type WriteLocked = crate::lightning::routing::scoring::ScoreUpdate; + type ReadLocked = crate::lightning::routing::scoring::ScoreLookUp; + fn read_lock(&'a self) -> crate::lightning::routing::scoring::ScoreLookUp { + let mut ret = (self.LockableScore.read_lock)(self.LockableScore.this_arg); + ret + } + fn write_lock(&'a self) -> crate::lightning::routing::scoring::ScoreUpdate { + let mut ret = (self.LockableScore.write_lock)(self.LockableScore.this_arg); ret } } @@ -265,6 +415,11 @@ impl core::ops::Deref for WriteableScore { self } } +impl core::ops::DerefMut for WriteableScore { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn WriteableScore_free(this_ptr: WriteableScore) { } @@ -343,13 +498,19 @@ pub extern "C" fn MultiThreadedLockableScore_as_LockableScore(this_arg: &MultiTh crate::lightning::routing::scoring::LockableScore { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - lock: MultiThreadedLockableScore_LockableScore_lock, + read_lock: MultiThreadedLockableScore_LockableScore_read_lock, + write_lock: MultiThreadedLockableScore_LockableScore_write_lock, } } #[must_use] -extern "C" fn MultiThreadedLockableScore_LockableScore_lock(this_arg: *const c_void) -> crate::lightning::routing::scoring::Score { - let mut ret = >::lock(unsafe { &mut *(this_arg as *mut nativeMultiThreadedLockableScore) }, ); +extern "C" fn MultiThreadedLockableScore_LockableScore_read_lock(this_arg: *const c_void) -> crate::lightning::routing::scoring::ScoreLookUp { + let mut ret = >::read_lock(unsafe { &mut *(this_arg as *mut nativeMultiThreadedLockableScore) }, ); + Into::into(ret) +} +#[must_use] +extern "C" fn MultiThreadedLockableScore_LockableScore_write_lock(this_arg: *const c_void) -> crate::lightning::routing::scoring::ScoreUpdate { + let mut ret = >::write_lock(unsafe { &mut *(this_arg as *mut nativeMultiThreadedLockableScore) }, ); Into::into(ret) } @@ -382,7 +543,8 @@ pub extern "C" fn MultiThreadedLockableScore_as_WriteableScore(this_arg: &MultiT LockableScore: crate::lightning::routing::scoring::LockableScore { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - lock: MultiThreadedLockableScore_LockableScore_lock, + read_lock: MultiThreadedLockableScore_LockableScore_read_lock, + write_lock: MultiThreadedLockableScore_LockableScore_write_lock, }, write: MultiThreadedLockableScore_write_void, } @@ -398,18 +560,18 @@ pub extern "C" fn MultiThreadedLockableScore_new(mut score: crate::lightning::ro } -use lightning::routing::scoring::MultiThreadedScoreLock as nativeMultiThreadedScoreLockImport; -pub(crate) type nativeMultiThreadedScoreLock = nativeMultiThreadedScoreLockImport<'static, crate::lightning::routing::scoring::Score>; +use lightning::routing::scoring::MultiThreadedScoreLockRead as nativeMultiThreadedScoreLockReadImport; +pub(crate) type nativeMultiThreadedScoreLockRead = nativeMultiThreadedScoreLockReadImport<'static, crate::lightning::routing::scoring::Score>; /// A locked `MultiThreadedLockableScore`. #[must_use] #[repr(C)] -pub struct MultiThreadedScoreLock { +pub struct MultiThreadedScoreLockRead { /// A pointer to the opaque Rust object. /// Nearly everywhere, inner must be non-null, however in places where /// the Rust equivalent takes an Option, it may be set to null to indicate None. - pub inner: *mut nativeMultiThreadedScoreLock, + pub inner: *mut nativeMultiThreadedScoreLockRead, /// Indicates that this is the only struct which contains the same pointer. /// Rust functions which take ownership of an object provided via an argument require @@ -417,95 +579,166 @@ pub struct MultiThreadedScoreLock { pub is_owned: bool, } -impl Drop for MultiThreadedScoreLock { +impl Drop for MultiThreadedScoreLockRead { fn drop(&mut self) { - if self.is_owned && !<*mut nativeMultiThreadedScoreLock>::is_null(self.inner) { + if self.is_owned && !<*mut nativeMultiThreadedScoreLockRead>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the MultiThreadedScoreLock, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the MultiThreadedScoreLockRead, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn MultiThreadedScoreLock_free(this_obj: MultiThreadedScoreLock) { } +pub extern "C" fn MultiThreadedScoreLockRead_free(this_obj: MultiThreadedScoreLockRead) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn MultiThreadedScoreLock_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeMultiThreadedScoreLock) }; +pub(crate) extern "C" fn MultiThreadedScoreLockRead_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeMultiThreadedScoreLockRead) }; } #[allow(unused)] -impl MultiThreadedScoreLock { - pub(crate) fn get_native_ref(&self) -> &'static nativeMultiThreadedScoreLock { +impl MultiThreadedScoreLockRead { + pub(crate) fn get_native_ref(&self) -> &'static nativeMultiThreadedScoreLockRead { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeMultiThreadedScoreLock { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeMultiThreadedScoreLockRead { unsafe { &mut *ObjOps::untweak_ptr(self.inner) } } /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy - pub(crate) fn take_inner(mut self) -> *mut nativeMultiThreadedScoreLock { + pub(crate) fn take_inner(mut self) -> *mut nativeMultiThreadedScoreLockRead { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); ret } } -#[no_mangle] -/// Serialize the MultiThreadedScoreLock object into a byte array which can be read by MultiThreadedScoreLock_read -pub extern "C" fn MultiThreadedScoreLock_write(obj: &crate::lightning::routing::scoring::MultiThreadedScoreLock) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) + +use lightning::routing::scoring::MultiThreadedScoreLockWrite as nativeMultiThreadedScoreLockWriteImport; +pub(crate) type nativeMultiThreadedScoreLockWrite = nativeMultiThreadedScoreLockWriteImport<'static, crate::lightning::routing::scoring::Score>; + +/// A locked `MultiThreadedLockableScore`. +#[must_use] +#[repr(C)] +pub struct MultiThreadedScoreLockWrite { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, inner must be non-null, however in places where + /// the Rust equivalent takes an Option, it may be set to null to indicate None. + pub inner: *mut nativeMultiThreadedScoreLockWrite, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, } + +impl Drop for MultiThreadedScoreLockWrite { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeMultiThreadedScoreLockWrite>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the MultiThreadedScoreLockWrite, if is_owned is set and inner is non-NULL. #[no_mangle] -pub(crate) extern "C" fn MultiThreadedScoreLock_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeMultiThreadedScoreLock) }) +pub extern "C" fn MultiThreadedScoreLockWrite_free(this_obj: MultiThreadedScoreLockWrite) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn MultiThreadedScoreLockWrite_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeMultiThreadedScoreLockWrite) }; +} +#[allow(unused)] +impl MultiThreadedScoreLockWrite { + pub(crate) fn get_native_ref(&self) -> &'static nativeMultiThreadedScoreLockWrite { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeMultiThreadedScoreLockWrite { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeMultiThreadedScoreLockWrite { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } } -impl From for crate::lightning::routing::scoring::Score { - fn from(obj: nativeMultiThreadedScoreLock) -> Self { - let mut rust_obj = MultiThreadedScoreLock { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = MultiThreadedScoreLock_as_Score(&rust_obj); +impl From for crate::lightning::routing::scoring::ScoreLookUp { + fn from(obj: nativeMultiThreadedScoreLockRead) -> Self { + let mut rust_obj = MultiThreadedScoreLockRead { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&rust_obj); // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn rust_obj.inner = core::ptr::null_mut(); - ret.free = Some(MultiThreadedScoreLock_free_void); + ret.free = Some(MultiThreadedScoreLockRead_free_void); ret } } -/// Constructs a new Score which calls the relevant methods on this_arg. -/// This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is +/// Constructs a new ScoreLookUp which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is #[no_mangle] -pub extern "C" fn MultiThreadedScoreLock_as_Score(this_arg: &MultiThreadedScoreLock) -> crate::lightning::routing::scoring::Score { - crate::lightning::routing::scoring::Score { +pub extern "C" fn MultiThreadedScoreLockRead_as_ScoreLookUp(this_arg: &MultiThreadedScoreLockRead) -> crate::lightning::routing::scoring::ScoreLookUp { + crate::lightning::routing::scoring::ScoreLookUp { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - channel_penalty_msat: MultiThreadedScoreLock_Score_channel_penalty_msat, - payment_path_failed: MultiThreadedScoreLock_Score_payment_path_failed, - payment_path_successful: MultiThreadedScoreLock_Score_payment_path_successful, - probe_failed: MultiThreadedScoreLock_Score_probe_failed, - probe_successful: MultiThreadedScoreLock_Score_probe_successful, - write: MultiThreadedScoreLock_write_void, + channel_penalty_msat: MultiThreadedScoreLockRead_ScoreLookUp_channel_penalty_msat, } } #[must_use] -extern "C" fn MultiThreadedScoreLock_Score_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 { - let mut ret = >::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLock) }, short_channel_id, source.get_native_ref(), target.get_native_ref(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref()); +extern "C" fn MultiThreadedScoreLockRead_ScoreLookUp_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 { + let mut ret = >::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockRead) }, short_channel_id, source.get_native_ref(), target.get_native_ref(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref()); ret } -extern "C" fn MultiThreadedScoreLock_Score_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { - >::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLock) }, path.get_native_ref(), short_channel_id) + +#[no_mangle] +/// Serialize the MultiThreadedScoreLockWrite object into a byte array which can be read by MultiThreadedScoreLockWrite_read +pub extern "C" fn MultiThreadedScoreLockWrite_write(obj: &crate::lightning::routing::scoring::MultiThreadedScoreLockWrite) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } -extern "C" fn MultiThreadedScoreLock_Score_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { - >::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLock) }, path.get_native_ref()) +#[no_mangle] +pub(crate) extern "C" fn MultiThreadedScoreLockWrite_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeMultiThreadedScoreLockWrite) }) } -extern "C" fn MultiThreadedScoreLock_Score_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { - >::probe_failed(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLock) }, path.get_native_ref(), short_channel_id) +impl From for crate::lightning::routing::scoring::ScoreUpdate { + fn from(obj: nativeMultiThreadedScoreLockWrite) -> Self { + let mut rust_obj = MultiThreadedScoreLockWrite { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn + rust_obj.inner = core::ptr::null_mut(); + ret.free = Some(MultiThreadedScoreLockWrite_free_void); + ret + } } -extern "C" fn MultiThreadedScoreLock_Score_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { - >::probe_successful(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLock) }, path.get_native_ref()) +/// Constructs a new ScoreUpdate which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is +#[no_mangle] +pub extern "C" fn MultiThreadedScoreLockWrite_as_ScoreUpdate(this_arg: &MultiThreadedScoreLockWrite) -> crate::lightning::routing::scoring::ScoreUpdate { + crate::lightning::routing::scoring::ScoreUpdate { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + payment_path_failed: MultiThreadedScoreLockWrite_ScoreUpdate_payment_path_failed, + payment_path_successful: MultiThreadedScoreLockWrite_ScoreUpdate_payment_path_successful, + probe_failed: MultiThreadedScoreLockWrite_ScoreUpdate_probe_failed, + probe_successful: MultiThreadedScoreLockWrite_ScoreUpdate_probe_successful, + } +} + +extern "C" fn MultiThreadedScoreLockWrite_ScoreUpdate_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { + >::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockWrite) }, path.get_native_ref(), short_channel_id) +} +extern "C" fn MultiThreadedScoreLockWrite_ScoreUpdate_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { + >::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockWrite) }, path.get_native_ref()) +} +extern "C" fn MultiThreadedScoreLockWrite_ScoreUpdate_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { + >::probe_failed(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockWrite) }, path.get_native_ref(), short_channel_id) +} +extern "C" fn MultiThreadedScoreLockWrite_ScoreUpdate_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { + >::probe_successful(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockWrite) }, path.get_native_ref()) } use lightning::routing::scoring::ChannelUsage as nativeChannelUsageImport; pub(crate) type nativeChannelUsage = nativeChannelUsageImport; -/// Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`]. +/// Proposed use of a channel passed as a parameter to [`ScoreLookUp::channel_penalty_msat`]. #[must_use] #[repr(C)] pub struct ChannelUsage { @@ -620,7 +853,7 @@ pub extern "C" fn ChannelUsage_clone(orig: &ChannelUsage) -> ChannelUsage { use lightning::routing::scoring::FixedPenaltyScorer as nativeFixedPenaltyScorerImport; pub(crate) type nativeFixedPenaltyScorer = nativeFixedPenaltyScorerImport; -/// [`Score`] implementation that uses a fixed penalty. +/// [`ScoreLookUp`] implementation that uses a fixed penalty. #[must_use] #[repr(C)] pub struct FixedPenaltyScorer { @@ -694,48 +927,68 @@ pub extern "C" fn FixedPenaltyScorer_with_penalty(mut penalty_msat: u64) -> crat crate::lightning::routing::scoring::FixedPenaltyScorer { inner: ObjOps::heap_alloc(ret), is_owned: true } } -impl From for crate::lightning::routing::scoring::Score { +impl From for crate::lightning::routing::scoring::ScoreLookUp { fn from(obj: nativeFixedPenaltyScorer) -> Self { let mut rust_obj = FixedPenaltyScorer { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = FixedPenaltyScorer_as_Score(&rust_obj); + let mut ret = FixedPenaltyScorer_as_ScoreLookUp(&rust_obj); // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn rust_obj.inner = core::ptr::null_mut(); ret.free = Some(FixedPenaltyScorer_free_void); ret } } -/// Constructs a new Score which calls the relevant methods on this_arg. -/// This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is +/// Constructs a new ScoreLookUp which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is #[no_mangle] -pub extern "C" fn FixedPenaltyScorer_as_Score(this_arg: &FixedPenaltyScorer) -> crate::lightning::routing::scoring::Score { - crate::lightning::routing::scoring::Score { +pub extern "C" fn FixedPenaltyScorer_as_ScoreLookUp(this_arg: &FixedPenaltyScorer) -> crate::lightning::routing::scoring::ScoreLookUp { + crate::lightning::routing::scoring::ScoreLookUp { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - channel_penalty_msat: FixedPenaltyScorer_Score_channel_penalty_msat, - payment_path_failed: FixedPenaltyScorer_Score_payment_path_failed, - payment_path_successful: FixedPenaltyScorer_Score_payment_path_successful, - probe_failed: FixedPenaltyScorer_Score_probe_failed, - probe_successful: FixedPenaltyScorer_Score_probe_successful, - write: FixedPenaltyScorer_write_void, + channel_penalty_msat: FixedPenaltyScorer_ScoreLookUp_channel_penalty_msat, } } #[must_use] -extern "C" fn FixedPenaltyScorer_Score_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 { - let mut ret = >::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, short_channel_id, source.get_native_ref(), target.get_native_ref(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref()); +extern "C" fn FixedPenaltyScorer_ScoreLookUp_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 { + let mut ret = >::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, short_channel_id, source.get_native_ref(), target.get_native_ref(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref()); ret } -extern "C" fn FixedPenaltyScorer_Score_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { - >::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref(), short_channel_id) + +impl From for crate::lightning::routing::scoring::ScoreUpdate { + fn from(obj: nativeFixedPenaltyScorer) -> Self { + let mut rust_obj = FixedPenaltyScorer { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = FixedPenaltyScorer_as_ScoreUpdate(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn + rust_obj.inner = core::ptr::null_mut(); + ret.free = Some(FixedPenaltyScorer_free_void); + ret + } } -extern "C" fn FixedPenaltyScorer_Score_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { - >::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref()) +/// Constructs a new ScoreUpdate which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is +#[no_mangle] +pub extern "C" fn FixedPenaltyScorer_as_ScoreUpdate(this_arg: &FixedPenaltyScorer) -> crate::lightning::routing::scoring::ScoreUpdate { + crate::lightning::routing::scoring::ScoreUpdate { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + payment_path_failed: FixedPenaltyScorer_ScoreUpdate_payment_path_failed, + payment_path_successful: FixedPenaltyScorer_ScoreUpdate_payment_path_successful, + probe_failed: FixedPenaltyScorer_ScoreUpdate_probe_failed, + probe_successful: FixedPenaltyScorer_ScoreUpdate_probe_successful, + } } -extern "C" fn FixedPenaltyScorer_Score_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { - >::probe_failed(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref(), short_channel_id) + +extern "C" fn FixedPenaltyScorer_ScoreUpdate_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { + >::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref(), short_channel_id) } -extern "C" fn FixedPenaltyScorer_Score_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { - >::probe_successful(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref()) +extern "C" fn FixedPenaltyScorer_ScoreUpdate_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { + >::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref()) +} +extern "C" fn FixedPenaltyScorer_ScoreUpdate_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { + >::probe_failed(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref(), short_channel_id) +} +extern "C" fn FixedPenaltyScorer_ScoreUpdate_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { + >::probe_successful(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref()) } #[no_mangle] @@ -759,7 +1012,7 @@ pub extern "C" fn FixedPenaltyScorer_read(ser: crate::c_types::u8slice, arg: u64 use lightning::routing::scoring::ProbabilisticScorer as nativeProbabilisticScorerImport; pub(crate) type nativeProbabilisticScorer = nativeProbabilisticScorerImport<&'static lightning::routing::gossip::NetworkGraph, crate::lightning::util::logger::Logger>; -/// [`Score`] implementation using channel success probability distributions. +/// [`ScoreLookUp`] implementation using channel success probability distributions. /// /// Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel, /// we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC. @@ -769,7 +1022,7 @@ pub(crate) type nativeProbabilisticScorer = nativeProbabilisticScorerImport<&'st /// These bounds are then used to determine a success probability using the formula from /// *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt /// and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`). -/// +///6762, 1070 /// This probability is combined with the [`liquidity_penalty_multiplier_msat`] and /// [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in /// milli-satoshis. The penalties, when added across all hops, have the property of being linear in @@ -913,12 +1166,13 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_base_penalty_msat(this_p pub extern "C" fn ProbabilisticScoringFeeParameters_set_base_penalty_msat(this_ptr: &mut ProbabilisticScoringFeeParameters, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.base_penalty_msat = val; } -/// A multiplier used with the payment amount to calculate a fixed penalty applied to each -/// channel, in excess of the [`base_penalty_msat`]. +/// A multiplier used with the total amount flowing over a channel to calculate a fixed penalty +/// applied to each channel, in excess of the [`base_penalty_msat`]. /// /// The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., /// fees plus penalty) for large payments. The penalty is computed as the product of this -/// multiplier and `2^30`ths of the payment amount. +/// multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment +/// amount plus the amount of any other HTLCs flowing we sent over the same channel). /// /// ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` /// @@ -930,12 +1184,13 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_base_penalty_amount_mult let mut inner_val = &mut this_ptr.get_native_mut_ref().base_penalty_amount_multiplier_msat; *inner_val } -/// A multiplier used with the payment amount to calculate a fixed penalty applied to each -/// channel, in excess of the [`base_penalty_msat`]. +/// A multiplier used with the total amount flowing over a channel to calculate a fixed penalty +/// applied to each channel, in excess of the [`base_penalty_msat`]. /// /// The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., /// fees plus penalty) for large payments. The penalty is computed as the product of this -/// multiplier and `2^30`ths of the payment amount. +/// multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment +/// amount plus the amount of any other HTLCs flowing we sent over the same channel). /// /// ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` /// @@ -987,14 +1242,14 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_liquidity_penalty_multip pub extern "C" fn ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(this_ptr: &mut ProbabilisticScoringFeeParameters, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.liquidity_penalty_multiplier_msat = val; } -/// A multiplier used in conjunction with a payment amount and the negative `log10` of the -/// channel's success probability for the payment, as determined by our latest estimates of the -/// channel's liquidity, to determine the amount penalty. +/// A multiplier used in conjunction with the total amount flowing over a channel and the +/// negative `log10` of the channel's success probability for the payment, as determined by our +/// latest estimates of the channel's liquidity, to determine the amount penalty. /// /// The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., /// fees plus penalty) for large payments. The penalty is computed as the product of this -/// multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the -/// success probability. +/// multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative +/// `log10` of the success probability. /// /// `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` /// @@ -1010,14 +1265,14 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount let mut inner_val = &mut this_ptr.get_native_mut_ref().liquidity_penalty_amount_multiplier_msat; *inner_val } -/// A multiplier used in conjunction with a payment amount and the negative `log10` of the -/// channel's success probability for the payment, as determined by our latest estimates of the -/// channel's liquidity, to determine the amount penalty. +/// A multiplier used in conjunction with the total amount flowing over a channel and the +/// negative `log10` of the channel's success probability for the payment, as determined by our +/// latest estimates of the channel's liquidity, to determine the amount penalty. /// /// The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., /// fees plus penalty) for large payments. The penalty is computed as the product of this -/// multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the -/// success probability. +/// multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative +/// `log10` of the success probability. /// /// `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` /// @@ -1069,13 +1324,15 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_historical_liquidity_pen pub extern "C" fn ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(this_ptr: &mut ProbabilisticScoringFeeParameters, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.historical_liquidity_penalty_multiplier_msat = val; } -/// A multiplier used in conjunction with the payment amount and the negative `log10` of the -/// channel's success probability for the payment, as determined based on the history of our -/// estimates of the channel's available liquidity, to determine a penalty. +/// A multiplier used in conjunction with the total amount flowing over a channel and the +/// negative `log10` of the channel's success probability for the payment, as determined based +/// on the history of our estimates of the channel's available liquidity, to determine a +/// penalty. /// /// The purpose of the amount penalty is to avoid having fees dominate the channel cost for -/// large payments. The penalty is computed as the product of this multiplier and the `2^20`ths -/// of the payment amount, weighted by the negative `log10` of the success probability. +/// large payments. The penalty is computed as the product of this multiplier and `2^20`ths +/// of the amount flowing over this channel, weighted by the negative `log10` of the success +/// probability. /// /// This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead /// of using only our latest estimate for the current liquidity available in the channel, it @@ -1092,13 +1349,15 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_historical_liquidity_pen let mut inner_val = &mut this_ptr.get_native_mut_ref().historical_liquidity_penalty_amount_multiplier_msat; *inner_val } -/// A multiplier used in conjunction with the payment amount and the negative `log10` of the -/// channel's success probability for the payment, as determined based on the history of our -/// estimates of the channel's available liquidity, to determine a penalty. +/// A multiplier used in conjunction with the total amount flowing over a channel and the +/// negative `log10` of the channel's success probability for the payment, as determined based +/// on the history of our estimates of the channel's available liquidity, to determine a +/// penalty. /// /// The purpose of the amount penalty is to avoid having fees dominate the channel cost for -/// large payments. The penalty is computed as the product of this multiplier and the `2^20`ths -/// of the payment amount, weighted by the negative `log10` of the success probability. +/// large payments. The penalty is computed as the product of this multiplier and `2^20`ths +/// of the amount flowing over this channel, weighted by the negative `log10` of the success +/// probability. /// /// This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead /// of using only our latest estimate for the current liquidity available in the channel, it @@ -1115,7 +1374,7 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_set_historical_liquidity_pen unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.historical_liquidity_penalty_amount_multiplier_msat = val; } /// This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the -/// channel's capacity, (ie. htlc_maximum_msat ≥ 0.5 * channel_capacity) which makes us +/// channel's capacity, (ie. htlc_maximum_msat >= 0.5 * channel_capacity) which makes us /// prefer nodes with a smaller `htlc_maximum_msat`. We treat such nodes preferentially /// as this makes balance discovery attacks harder to execute, thereby creating an incentive /// to restrict `htlc_maximum_msat` and improve privacy. @@ -1127,7 +1386,7 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msa *inner_val } /// This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the -/// channel's capacity, (ie. htlc_maximum_msat ≥ 0.5 * channel_capacity) which makes us +/// channel's capacity, (ie. htlc_maximum_msat >= 0.5 * channel_capacity) which makes us /// prefer nodes with a smaller `htlc_maximum_msat`. We treat such nodes preferentially /// as this makes balance discovery attacks harder to execute, thereby creating an incentive /// to restrict `htlc_maximum_msat` and improve privacy. @@ -1137,8 +1396,9 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msa pub extern "C" fn ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(this_ptr: &mut ProbabilisticScoringFeeParameters, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.anti_probing_penalty_msat = val; } -/// This penalty is applied when the amount we're attempting to send over a channel exceeds our -/// current estimate of the channel's available liquidity. +/// This penalty is applied when the total amount flowing over a channel exceeds our current +/// estimate of the channel's available liquidity. The total amount is the amount of the +/// current HTLC plus any HTLCs which we've sent over the same channel. /// /// Note that in this case all other penalties, including the /// [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based @@ -1159,8 +1419,9 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_considered_impossible_pe let mut inner_val = &mut this_ptr.get_native_mut_ref().considered_impossible_penalty_msat; *inner_val } -/// This penalty is applied when the amount we're attempting to send over a channel exceeds our -/// current estimate of the channel's available liquidity. +/// This penalty is applied when the total amount flowing over a channel exceeds our current +/// estimate of the channel's available liquidity. The total amount is the amount of the +/// current HTLC plus any HTLCs which we've sent over the same channel. /// /// Note that in this case all other penalties, including the /// [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based @@ -1180,6 +1441,55 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_considered_impossible_pe pub extern "C" fn ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(this_ptr: &mut ProbabilisticScoringFeeParameters, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.considered_impossible_penalty_msat = val; } +/// In order to calculate most of the scores above, we must first convert a lower and upper +/// bound on the available liquidity in a channel into the probability that we think a payment +/// will succeed. That probability is derived from a Probability Density Function for where we +/// think the liquidity in a channel likely lies, given such bounds. +/// +/// If this flag is set, that PDF is simply a constant - we assume that the actual available +/// liquidity in a channel is just as likely to be at any point between our lower and upper +/// bounds. +/// +/// If this flag is *not* set, that PDF is `(x - 0.5*capacity) ^ 2`. That is, we use an +/// exponential curve which expects the liquidity of a channel to lie \"at the edges\". This +/// matches experimental results - most routing nodes do not aggressively rebalance their +/// channels and flows in the network are often unbalanced, leaving liquidity usually +/// unavailable. +/// +/// Thus, for the \"best\" routes, leave this flag `false`. However, the flag does imply a number +/// of floating-point multiplications in the hottest routing code, which may lead to routing +/// performance degradation on some machines. +/// +/// Default value: false +#[no_mangle] +pub extern "C" fn ProbabilisticScoringFeeParameters_get_linear_success_probability(this_ptr: &ProbabilisticScoringFeeParameters) -> bool { + let mut inner_val = &mut this_ptr.get_native_mut_ref().linear_success_probability; + *inner_val +} +/// In order to calculate most of the scores above, we must first convert a lower and upper +/// bound on the available liquidity in a channel into the probability that we think a payment +/// will succeed. That probability is derived from a Probability Density Function for where we +/// think the liquidity in a channel likely lies, given such bounds. +/// +/// If this flag is set, that PDF is simply a constant - we assume that the actual available +/// liquidity in a channel is just as likely to be at any point between our lower and upper +/// bounds. +/// +/// If this flag is *not* set, that PDF is `(x - 0.5*capacity) ^ 2`. That is, we use an +/// exponential curve which expects the liquidity of a channel to lie \"at the edges\". This +/// matches experimental results - most routing nodes do not aggressively rebalance their +/// channels and flows in the network are often unbalanced, leaving liquidity usually +/// unavailable. +/// +/// Thus, for the \"best\" routes, leave this flag `false`. However, the flag does imply a number +/// of floating-point multiplications in the hottest routing code, which may lead to routing +/// performance degradation on some machines. +/// +/// Default value: false +#[no_mangle] +pub extern "C" fn ProbabilisticScoringFeeParameters_set_linear_success_probability(this_ptr: &mut ProbabilisticScoringFeeParameters, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.linear_success_probability = val; +} impl Clone for ProbabilisticScoringFeeParameters { fn clone(&self) -> Self { Self { @@ -1442,79 +1752,167 @@ pub extern "C" fn ProbabilisticScorer_estimated_channel_liquidity_range(this_arg /// Query the historical estimated minimum and maximum liquidity available for sending a /// payment over the channel with `scid` towards the given `target` node. /// -/// Returns two sets of 8 buckets. The first set describes the octiles for lower-bound -/// liquidity estimates, the second set describes the octiles for upper-bound liquidity -/// estimates. Each bucket describes the relative frequency at which we've seen a liquidity -/// bound in the octile relative to the channel's total capacity, on an arbitrary scale. -/// Because the values are slowly decayed, more recent data points are weighted more heavily -/// than older datapoints. +/// Returns two sets of 32 buckets. The first set describes the lower-bound liquidity history, +/// the second set describes the upper-bound liquidity history. Each bucket describes the +/// relative frequency at which we've seen a liquidity bound in the bucket's range relative to +/// the channel's total capacity, on an arbitrary scale. Because the values are slowly decayed, +/// more recent data points are weighted more heavily than older datapoints. /// -/// When scoring, the estimated probability that an upper-/lower-bound lies in a given octile -/// relative to the channel's total capacity is calculated by dividing that bucket's value with -/// the total of all buckets for the given bound. +/// Note that the range of each bucket varies by its location to provide more granular results +/// at the edges of a channel's capacity, where it is more likely to sit. /// -/// For example, a value of `[0, 0, 0, 0, 0, 0, 32]` indicates that we believe the probability -/// of a bound being in the top octile to be 100%, and have never (recently) seen it in any -/// other octiles. A value of `[31, 0, 0, 0, 0, 0, 0, 32]` indicates we've seen the bound being -/// both in the top and bottom octile, and roughly with similar (recent) frequency. +/// When scoring, the estimated probability that an upper-/lower-bound lies in a given bucket +/// is calculated by dividing that bucket's value with the total value of all buckets. +/// +/// For example, using a lower bucket count for illustrative purposes, a value of +/// `[0, 0, 0, ..., 0, 32]` indicates that we believe the probability of a bound being very +/// close to the channel's capacity to be 100%, and have never (recently) seen it in any other +/// bucket. A value of `[31, 0, 0, ..., 0, 0, 32]` indicates we've seen the bound being both +/// in the top and bottom bucket, and roughly with similar (recent) frequency. /// /// Because the datapoints are decayed slowly over time, values will eventually return to -/// `Some(([0; 8], [0; 8]))`. +/// `Some(([1; 32], [1; 32]))` and then to `None` once no datapoints remain. +/// +/// In order to fetch a single success probability from the buckets provided here, as used in +/// the scoring model, see [`Self::historical_estimated_payment_success_probability`]. #[must_use] #[no_mangle] -pub extern "C" fn ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(this_arg: &crate::lightning::routing::scoring::ProbabilisticScorer, mut scid: u64, target: &crate::lightning::routing::gossip::NodeId) -> crate::c_types::derived::COption_C2Tuple_EightU16sEightU16sZZ { +pub extern "C" fn ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(this_arg: &crate::lightning::routing::scoring::ProbabilisticScorer, mut scid: u64, target: &crate::lightning::routing::gossip::NodeId) -> crate::c_types::derived::COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.historical_estimated_channel_liquidity_probabilities(scid, target.get_native_ref()); - let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_EightU16sEightU16sZZ::None } else { crate::c_types::derived::COption_C2Tuple_EightU16sEightU16sZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::c_types::EightU16s { data: orig_ret_0_0 }, crate::c_types::EightU16s { data: orig_ret_0_1 }).into(); local_ret_0 }) }; + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None } else { crate::c_types::derived::COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::c_types::ThirtyTwoU16s { data: orig_ret_0_0 }, crate::c_types::ThirtyTwoU16s { data: orig_ret_0_1 }).into(); local_ret_0 }) }; local_ret } -impl From for crate::lightning::routing::scoring::Score { +/// Query the probability of payment success sending the given `amount_msat` over the channel +/// with `scid` towards the given `target` node, based on the historical estimated liquidity +/// bounds. +/// +/// These are the same bounds as returned by +/// [`Self::historical_estimated_channel_liquidity_probabilities`] (but not those returned by +/// [`Self::estimated_channel_liquidity_range`]). +#[must_use] +#[no_mangle] +pub extern "C" fn ProbabilisticScorer_historical_estimated_payment_success_probability(this_arg: &crate::lightning::routing::scoring::ProbabilisticScorer, mut scid: u64, target: &crate::lightning::routing::gossip::NodeId, mut amount_msat: u64, params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> crate::c_types::derived::COption_f64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.historical_estimated_payment_success_probability(scid, target.get_native_ref(), amount_msat, params.get_native_ref()); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_f64Z::None } else { crate::c_types::derived::COption_f64Z::Some( { ret.unwrap() }) }; + local_ret +} + +impl From for crate::lightning::routing::scoring::ScoreLookUp { fn from(obj: nativeProbabilisticScorer) -> Self { let mut rust_obj = ProbabilisticScorer { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = ProbabilisticScorer_as_Score(&rust_obj); + let mut ret = ProbabilisticScorer_as_ScoreLookUp(&rust_obj); // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn rust_obj.inner = core::ptr::null_mut(); ret.free = Some(ProbabilisticScorer_free_void); ret } } -/// Constructs a new Score which calls the relevant methods on this_arg. -/// This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is +/// Constructs a new ScoreLookUp which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is #[no_mangle] -pub extern "C" fn ProbabilisticScorer_as_Score(this_arg: &ProbabilisticScorer) -> crate::lightning::routing::scoring::Score { - crate::lightning::routing::scoring::Score { +pub extern "C" fn ProbabilisticScorer_as_ScoreLookUp(this_arg: &ProbabilisticScorer) -> crate::lightning::routing::scoring::ScoreLookUp { + crate::lightning::routing::scoring::ScoreLookUp { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - channel_penalty_msat: ProbabilisticScorer_Score_channel_penalty_msat, - payment_path_failed: ProbabilisticScorer_Score_payment_path_failed, - payment_path_successful: ProbabilisticScorer_Score_payment_path_successful, - probe_failed: ProbabilisticScorer_Score_probe_failed, - probe_successful: ProbabilisticScorer_Score_probe_successful, - write: ProbabilisticScorer_write_void, + channel_penalty_msat: ProbabilisticScorer_ScoreLookUp_channel_penalty_msat, } } #[must_use] -extern "C" fn ProbabilisticScorer_Score_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 { - let mut ret = >::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, short_channel_id, source.get_native_ref(), target.get_native_ref(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref()); +extern "C" fn ProbabilisticScorer_ScoreLookUp_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 { + let mut ret = >::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, short_channel_id, source.get_native_ref(), target.get_native_ref(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref()); ret } -extern "C" fn ProbabilisticScorer_Score_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { - >::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref(), short_channel_id) + +impl From for crate::lightning::routing::scoring::ScoreUpdate { + fn from(obj: nativeProbabilisticScorer) -> Self { + let mut rust_obj = ProbabilisticScorer { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = ProbabilisticScorer_as_ScoreUpdate(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn + rust_obj.inner = core::ptr::null_mut(); + ret.free = Some(ProbabilisticScorer_free_void); + ret + } +} +/// Constructs a new ScoreUpdate which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is +#[no_mangle] +pub extern "C" fn ProbabilisticScorer_as_ScoreUpdate(this_arg: &ProbabilisticScorer) -> crate::lightning::routing::scoring::ScoreUpdate { + crate::lightning::routing::scoring::ScoreUpdate { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + payment_path_failed: ProbabilisticScorer_ScoreUpdate_payment_path_failed, + payment_path_successful: ProbabilisticScorer_ScoreUpdate_payment_path_successful, + probe_failed: ProbabilisticScorer_ScoreUpdate_probe_failed, + probe_successful: ProbabilisticScorer_ScoreUpdate_probe_successful, + } +} + +extern "C" fn ProbabilisticScorer_ScoreUpdate_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { + >::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref(), short_channel_id) +} +extern "C" fn ProbabilisticScorer_ScoreUpdate_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { + >::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref()) } -extern "C" fn ProbabilisticScorer_Score_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { - >::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref()) +extern "C" fn ProbabilisticScorer_ScoreUpdate_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { + >::probe_failed(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref(), short_channel_id) } -extern "C" fn ProbabilisticScorer_Score_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) { - >::probe_failed(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref(), short_channel_id) +extern "C" fn ProbabilisticScorer_ScoreUpdate_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { + >::probe_successful(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref()) } -extern "C" fn ProbabilisticScorer_Score_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) { - >::probe_successful(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref()) + +impl From for crate::lightning::routing::scoring::Score { + fn from(obj: nativeProbabilisticScorer) -> Self { + let mut rust_obj = ProbabilisticScorer { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = ProbabilisticScorer_as_Score(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn + rust_obj.inner = core::ptr::null_mut(); + ret.free = Some(ProbabilisticScorer_free_void); + ret + } +} +/// Constructs a new Score which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is +#[no_mangle] +pub extern "C" fn ProbabilisticScorer_as_Score(this_arg: &ProbabilisticScorer) -> crate::lightning::routing::scoring::Score { + crate::lightning::routing::scoring::Score { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + ScoreLookUp: crate::lightning::routing::scoring::ScoreLookUp { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + channel_penalty_msat: ProbabilisticScorer_ScoreLookUp_channel_penalty_msat, + }, + ScoreUpdate: crate::lightning::routing::scoring::ScoreUpdate { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + payment_path_failed: ProbabilisticScorer_ScoreUpdate_payment_path_failed, + payment_path_successful: ProbabilisticScorer_ScoreUpdate_payment_path_successful, + probe_failed: ProbabilisticScorer_ScoreUpdate_probe_failed, + probe_successful: ProbabilisticScorer_ScoreUpdate_probe_successful, + }, + write: ProbabilisticScorer_write_void, + } } + mod approx { use alloc::str::FromStr; +use alloc::string::String; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +} +mod bucketed_history { + +use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/routing/utxo.rs b/lightning-c-bindings/src/lightning/routing/utxo.rs index 7f741e28..187badd8 100644 --- a/lightning-c-bindings/src/lightning/routing/utxo.rs +++ b/lightning-c-bindings/src/lightning/routing/utxo.rs @@ -13,6 +13,7 @@ //! order to announce a channel. This module handles that checking. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -206,8 +207,7 @@ pub struct UtxoLookup { } unsafe impl Send for UtxoLookup {} unsafe impl Sync for UtxoLookup {} -#[no_mangle] -pub(crate) extern "C" fn UtxoLookup_clone_fields(orig: &UtxoLookup) -> UtxoLookup { +pub(crate) fn UtxoLookup_clone_fields(orig: &UtxoLookup) -> UtxoLookup { UtxoLookup { this_arg: orig.this_arg, get_utxo: Clone::clone(&orig.get_utxo), @@ -231,6 +231,11 @@ impl core::ops::Deref for UtxoLookup { self } } +impl core::ops::DerefMut for UtxoLookup { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn UtxoLookup_free(this_ptr: UtxoLookup) { } diff --git a/lightning-c-bindings/src/lightning/sign.rs b/lightning-c-bindings/src/lightning/sign.rs index 0ddfb51d..33d73166 100644 --- a/lightning-c-bindings/src/lightning/sign.rs +++ b/lightning-c-bindings/src/lightning/sign.rs @@ -12,6 +12,7 @@ //! compatible with Bitcoin Core output descriptors. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -19,6 +20,18 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; +mod type_resolver { + +use alloc::str::FromStr; +use alloc::string::String; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +} use lightning::sign::DelayedPaymentOutputDescriptor as nativeDelayedPaymentOutputDescriptorImport; pub(crate) type nativeDelayedPaymentOutputDescriptor = nativeDelayedPaymentOutputDescriptorImport; @@ -188,6 +201,16 @@ pub(crate) extern "C" fn DelayedPaymentOutputDescriptor_clone_void(this_ptr: *co pub extern "C" fn DelayedPaymentOutputDescriptor_clone(orig: &DelayedPaymentOutputDescriptor) -> DelayedPaymentOutputDescriptor { orig.clone() } +/// Generates a non-cryptographic 64-bit hash of the DelayedPaymentOutputDescriptor. +#[no_mangle] +pub extern "C" fn DelayedPaymentOutputDescriptor_hash(o: &DelayedPaymentOutputDescriptor) -> u64 { + if o.inner.is_null() { return 0; } + // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core + #[allow(deprecated)] + let mut hasher = core::hash::SipHasher::new(); + core::hash::Hash::hash(o.get_native_ref(), &mut hasher); + core::hash::Hasher::finish(&hasher) +} /// Checks if two DelayedPaymentOutputDescriptors contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. /// Two objects with NULL inner values will be considered "equal" here. @@ -312,15 +335,42 @@ pub extern "C" fn StaticPaymentOutputDescriptor_get_channel_value_satoshis(this_ pub extern "C" fn StaticPaymentOutputDescriptor_set_channel_value_satoshis(this_ptr: &mut StaticPaymentOutputDescriptor, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_value_satoshis = val; } +/// The necessary channel parameters that need to be provided to the re-derived signer through +/// [`ChannelSigner::provide_channel_parameters`]. +/// +/// Added as optional, but always `Some` if the descriptor was produced in v0.0.117 or later. +/// +/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn StaticPaymentOutputDescriptor_get_channel_transaction_parameters(this_ptr: &StaticPaymentOutputDescriptor) -> crate::lightning::ln::chan_utils::ChannelTransactionParameters { + let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_transaction_parameters; + let mut local_inner_val = crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _ }, is_owned: false }; + local_inner_val +} +/// The necessary channel parameters that need to be provided to the re-derived signer through +/// [`ChannelSigner::provide_channel_parameters`]. +/// +/// Added as optional, but always `Some` if the descriptor was produced in v0.0.117 or later. +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn StaticPaymentOutputDescriptor_set_channel_transaction_parameters(this_ptr: &mut StaticPaymentOutputDescriptor, mut val: crate::lightning::ln::chan_utils::ChannelTransactionParameters) { + let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_transaction_parameters = local_val; +} /// Constructs a new StaticPaymentOutputDescriptor given each field +/// +/// Note that channel_transaction_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn StaticPaymentOutputDescriptor_new(mut outpoint_arg: crate::lightning::chain::transaction::OutPoint, mut output_arg: crate::c_types::TxOut, mut channel_keys_id_arg: crate::c_types::ThirtyTwoBytes, mut channel_value_satoshis_arg: u64) -> StaticPaymentOutputDescriptor { +pub extern "C" fn StaticPaymentOutputDescriptor_new(mut outpoint_arg: crate::lightning::chain::transaction::OutPoint, mut output_arg: crate::c_types::TxOut, mut channel_keys_id_arg: crate::c_types::ThirtyTwoBytes, mut channel_value_satoshis_arg: u64, mut channel_transaction_parameters_arg: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> StaticPaymentOutputDescriptor { + let mut local_channel_transaction_parameters_arg = if channel_transaction_parameters_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_transaction_parameters_arg.take_inner()) } }) }; StaticPaymentOutputDescriptor { inner: ObjOps::heap_alloc(nativeStaticPaymentOutputDescriptor { outpoint: *unsafe { Box::from_raw(outpoint_arg.take_inner()) }, output: output_arg.into_rust(), channel_keys_id: channel_keys_id_arg.data, channel_value_satoshis: channel_value_satoshis_arg, + channel_transaction_parameters: local_channel_transaction_parameters_arg, }), is_owned: true } } impl Clone for StaticPaymentOutputDescriptor { @@ -342,6 +392,16 @@ pub(crate) extern "C" fn StaticPaymentOutputDescriptor_clone_void(this_ptr: *con pub extern "C" fn StaticPaymentOutputDescriptor_clone(orig: &StaticPaymentOutputDescriptor) -> StaticPaymentOutputDescriptor { orig.clone() } +/// Generates a non-cryptographic 64-bit hash of the StaticPaymentOutputDescriptor. +#[no_mangle] +pub extern "C" fn StaticPaymentOutputDescriptor_hash(o: &StaticPaymentOutputDescriptor) -> u64 { + if o.inner.is_null() { return 0; } + // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core + #[allow(deprecated)] + let mut hasher = core::hash::SipHasher::new(); + core::hash::Hash::hash(o.get_native_ref(), &mut hasher); + core::hash::Hasher::finish(&hasher) +} /// Checks if two StaticPaymentOutputDescriptors contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. /// Two objects with NULL inner values will be considered "equal" here. @@ -351,6 +411,28 @@ pub extern "C" fn StaticPaymentOutputDescriptor_eq(a: &StaticPaymentOutputDescri if a.inner.is_null() || b.inner.is_null() { return false; } if a.get_native_ref() == b.get_native_ref() { true } else { false } } +/// Returns the `witness_script` of the spendable output. +/// +/// Note that this will only return `Some` for [`StaticPaymentOutputDescriptor`]s that +/// originated from an anchor outputs channel, as they take the form of a P2WSH script. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticPaymentOutputDescriptor_witness_script(this_arg: &crate::lightning::sign::StaticPaymentOutputDescriptor) -> crate::c_types::derived::COption_CVec_u8ZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.witness_script(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some( { ret.unwrap().into_bytes().into() }) }; + local_ret +} + +/// The maximum length a well-formed witness spending one of these should have. +/// Note: If you have the grind_signatures feature enabled, this will be at least 1 byte +/// shorter. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticPaymentOutputDescriptor_max_witness_length(this_arg: &crate::lightning::sign::StaticPaymentOutputDescriptor) -> usize { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.max_witness_length(); + ret +} + #[no_mangle] /// Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read pub extern "C" fn StaticPaymentOutputDescriptor_write(obj: &crate::lightning::sign::StaticPaymentOutputDescriptor) -> crate::c_types::derived::CVec_u8Z { @@ -434,15 +516,23 @@ pub enum SpendableOutputDescriptor { /// [`chan_utils::get_revokeable_redeemscript`]. DelayedPaymentOutput( crate::lightning::sign::DelayedPaymentOutputDescriptor), - /// An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key - /// which corresponds to the `payment_point` in [`ChannelSigner::pubkeys`]). The witness - /// in the spending input is, thus, simply: + /// An output spendable exclusively by our payment key (i.e., the private key that corresponds + /// to the `payment_point` in [`ChannelSigner::pubkeys`]). The output type depends on the + /// channel type negotiated. + /// + /// On an anchor outputs channel, the witness in the spending input is: + /// ```bitcoin + /// + /// ``` + /// + /// Otherwise, it is: /// ```bitcoin /// /// ``` /// /// These are generally the result of our counterparty having broadcast the current state, - /// allowing us to claim the non-HTLC-encumbered outputs immediately. + /// allowing us to claim the non-HTLC-encumbered outputs immediately, or after one confirmation + /// in the case of anchor outputs channels. StaticPaymentOutput( crate::lightning::sign::StaticPaymentOutputDescriptor), } @@ -569,6 +659,15 @@ pub extern "C" fn SpendableOutputDescriptor_delayed_payment_output(a: crate::lig pub extern "C" fn SpendableOutputDescriptor_static_payment_output(a: crate::lightning::sign::StaticPaymentOutputDescriptor) -> SpendableOutputDescriptor { SpendableOutputDescriptor::StaticPaymentOutput(a, ) } +/// Generates a non-cryptographic 64-bit hash of the SpendableOutputDescriptor. +#[no_mangle] +pub extern "C" fn SpendableOutputDescriptor_hash(o: &SpendableOutputDescriptor) -> u64 { + // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core + #[allow(deprecated)] + let mut hasher = core::hash::SipHasher::new(); + core::hash::Hash::hash(&o.to_native(), &mut hasher); + core::hash::Hasher::finish(&hasher) +} /// Checks if two SpendableOutputDescriptors contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. #[no_mangle] @@ -605,7 +704,7 @@ pub extern "C" fn SpendableOutputDescriptor_read(ser: crate::c_types::u8slice) - /// We do not enforce that outputs meet the dust limit or that any output scripts are standard. #[must_use] #[no_mangle] -pub extern "C" fn SpendableOutputDescriptor_create_spendable_outputs_psbt(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, mut locktime: crate::c_types::derived::COption_PackedLockTimeZ) -> crate::c_types::derived::CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { +pub extern "C" fn SpendableOutputDescriptor_create_spendable_outputs_psbt(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, mut locktime: crate::c_types::derived::COption_u32Z) -> crate::c_types::derived::CResult_C2Tuple_CVec_u8ZusizeZNoneZ { 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 local_locktime = { /*locktime*/ let locktime_opt = locktime; if locktime_opt.is_none() { None } else { Some({ { ::bitcoin::PackedLockTime({ locktime_opt.take() }) }})} }; @@ -647,7 +746,7 @@ pub struct ChannelSigner { /// /// Note that all the relevant preimages will be provided, but there may also be additional /// irrelevant or duplicate preimages. - pub validate_holder_commitment: extern "C" fn (this_arg: *const c_void, holder_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction, preimages: crate::c_types::derived::CVec_PaymentPreimageZ) -> crate::c_types::derived::CResult_NoneNoneZ, + pub validate_holder_commitment: extern "C" fn (this_arg: *const c_void, holder_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction, preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> crate::c_types::derived::CResult_NoneNoneZ, /// Returns the holder's channel public keys and basepoints. pub pubkeys: core::cell::UnsafeCell, /// Fill in the pubkeys field as a reference to it will be given to Rust after this returns @@ -674,8 +773,7 @@ pub struct ChannelSigner { } unsafe impl Send for ChannelSigner {} unsafe impl Sync for ChannelSigner {} -#[no_mangle] -pub(crate) extern "C" fn ChannelSigner_clone_fields(orig: &ChannelSigner) -> ChannelSigner { +pub(crate) fn ChannelSigner_clone_fields(orig: &ChannelSigner) -> ChannelSigner { ChannelSigner { this_arg: orig.this_arg, get_per_commitment_point: Clone::clone(&orig.get_per_commitment_point), @@ -728,6 +826,11 @@ impl core::ops::Deref for ChannelSigner { self } } +impl core::ops::DerefMut for ChannelSigner { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn ChannelSigner_free(this_ptr: ChannelSigner) { } @@ -763,7 +866,7 @@ pub struct EcdsaChannelSigner { /// /// Note that all the relevant preimages will be provided, but there may also be additional /// irrelevant or duplicate preimages. - pub sign_counterparty_commitment: extern "C" fn (this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::CommitmentTransaction, preimages: crate::c_types::derived::CVec_PaymentPreimageZ) -> crate::c_types::derived::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, + pub sign_counterparty_commitment: extern "C" fn (this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::CommitmentTransaction, preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> crate::c_types::derived::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, /// Validate the counterparty's revocation. /// /// This is required in order for the signer to make sure that the state has moved @@ -784,7 +887,7 @@ pub struct EcdsaChannelSigner { /// An external signer implementation should check that the commitment has not been revoked. /// /// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - pub sign_holder_commitment_and_htlcs: extern "C" fn (this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, + pub sign_holder_commitment_and_htlcs: extern "C" fn (this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, /// Create a signature for the given input in a transaction spending an HTLC transaction output /// or a commitment transaction `to_local` output when our counterparty broadcasts an old state. /// @@ -799,7 +902,7 @@ pub struct EcdsaChannelSigner { /// revoked the state which they eventually broadcast. It's not a _holder_ secret key and does /// not allow the spending of any funds by itself (you need our holder `revocation_secret` to do /// so). - pub sign_justice_revoked_output: extern "C" fn (this_arg: *const c_void, justice_tx: crate::c_types::Transaction, input: usize, amount: u64, per_commitment_key: *const [u8; 32]) -> crate::c_types::derived::CResult_SignatureNoneZ, + pub sign_justice_revoked_output: extern "C" fn (this_arg: *const c_void, justice_tx: crate::c_types::Transaction, input: usize, amount: u64, per_commitment_key: *const [u8; 32]) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Create a signature for the given input in a transaction spending a commitment transaction /// HTLC output when our counterparty broadcasts an old state. /// @@ -818,7 +921,7 @@ pub struct EcdsaChannelSigner { /// /// `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script /// (which is committed to in the BIP 143 signatures). - pub sign_justice_revoked_htlc: extern "C" fn (this_arg: *const c_void, justice_tx: crate::c_types::Transaction, input: usize, amount: u64, per_commitment_key: *const [u8; 32], htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_SignatureNoneZ, + pub sign_justice_revoked_htlc: extern "C" fn (this_arg: *const c_void, justice_tx: crate::c_types::Transaction, input: usize, amount: u64, per_commitment_key: *const [u8; 32], htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Computes the signature for a commitment transaction's HTLC output used as an input within /// `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned /// must be be computed using [`EcdsaSighashType::All`]. Note that this should only be used to @@ -826,7 +929,7 @@ pub struct EcdsaChannelSigner { /// inputs/outputs have been added to the transaction. /// /// [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All - pub sign_holder_htlc_transaction: extern "C" fn (this_arg: *const c_void, htlc_tx: crate::c_types::Transaction, input: usize, htlc_descriptor: &crate::lightning::events::bump_transaction::HTLCDescriptor) -> crate::c_types::derived::CResult_SignatureNoneZ, + pub sign_holder_htlc_transaction: extern "C" fn (this_arg: *const c_void, htlc_tx: crate::c_types::Transaction, input: usize, htlc_descriptor: &crate::lightning::events::bump_transaction::HTLCDescriptor) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment /// transaction, either offered or received. /// @@ -844,15 +947,15 @@ pub struct EcdsaChannelSigner { /// detected onchain. It has been generated by our counterparty and is used to derive /// channel state keys, which are then included in the witness script and committed to in the /// BIP 143 signature. - pub sign_counterparty_htlc_transaction: extern "C" fn (this_arg: *const c_void, htlc_tx: crate::c_types::Transaction, input: usize, amount: u64, per_commitment_point: crate::c_types::PublicKey, htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_SignatureNoneZ, + pub sign_counterparty_htlc_transaction: extern "C" fn (this_arg: *const c_void, htlc_tx: crate::c_types::Transaction, input: usize, amount: u64, per_commitment_point: crate::c_types::PublicKey, htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Create a signature for a (proposed) closing transaction. /// /// Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have /// chosen to forgo their output as dust. - pub sign_closing_transaction: extern "C" fn (this_arg: *const c_void, closing_tx: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::derived::CResult_SignatureNoneZ, + pub sign_closing_transaction: extern "C" fn (this_arg: *const c_void, closing_tx: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Computes the signature for a commitment transaction's anchor output used as an /// input within `anchor_tx`, which spends the commitment transaction, at index `input`. - pub sign_holder_anchor_input: extern "C" fn (this_arg: *const c_void, anchor_tx: crate::c_types::Transaction, input: usize) -> crate::c_types::derived::CResult_SignatureNoneZ, + pub sign_holder_anchor_input: extern "C" fn (this_arg: *const c_void, anchor_tx: crate::c_types::Transaction, input: usize) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Signs a channel announcement message with our funding key proving it comes from one of the /// channel participants. /// @@ -862,7 +965,7 @@ pub struct EcdsaChannelSigner { /// Note that if this fails or is rejected, the channel will not be publicly announced and /// our counterparty may (though likely will not) close the channel on us for violating the /// protocol. - pub sign_channel_announcement_with_funding_key: extern "C" fn (this_arg: *const c_void, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> crate::c_types::derived::CResult_SignatureNoneZ, + pub sign_channel_announcement_with_funding_key: extern "C" fn (this_arg: *const c_void, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Implementation of ChannelSigner for this object. pub ChannelSigner: crate::lightning::sign::ChannelSigner, /// Frees any resources associated with this object given its this_arg pointer. @@ -871,8 +974,7 @@ pub struct EcdsaChannelSigner { } unsafe impl Send for EcdsaChannelSigner {} unsafe impl Sync for EcdsaChannelSigner {} -#[no_mangle] -pub(crate) extern "C" fn EcdsaChannelSigner_clone_fields(orig: &EcdsaChannelSigner) -> EcdsaChannelSigner { +pub(crate) fn EcdsaChannelSigner_clone_fields(orig: &EcdsaChannelSigner) -> EcdsaChannelSigner { EcdsaChannelSigner { this_arg: orig.this_arg, sign_counterparty_commitment: Clone::clone(&orig.sign_counterparty_commitment), @@ -982,6 +1084,11 @@ impl core::ops::Deref for EcdsaChannelSigner { self } } +impl core::ops::DerefMut for EcdsaChannelSigner { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn EcdsaChannelSigner_free(this_ptr: EcdsaChannelSigner) { } @@ -1008,18 +1115,22 @@ pub struct WriteableEcdsaChannelSigner { pub EcdsaChannelSigner: crate::lightning::sign::EcdsaChannelSigner, /// Serialize the object into a byte array pub write: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z, + /// Called, if set, after this WriteableEcdsaChannelSigner has been cloned into a duplicate object. + /// The new WriteableEcdsaChannelSigner is provided, and should be mutated as needed to perform a + /// deep copy of the object pointed to by this_arg or avoid any double-freeing. + pub cloned: Option, /// Frees any resources associated with this object given its this_arg pointer. /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, } unsafe impl Send for WriteableEcdsaChannelSigner {} unsafe impl Sync for WriteableEcdsaChannelSigner {} -#[no_mangle] -pub(crate) extern "C" fn WriteableEcdsaChannelSigner_clone_fields(orig: &WriteableEcdsaChannelSigner) -> WriteableEcdsaChannelSigner { +pub(crate) fn WriteableEcdsaChannelSigner_clone_fields(orig: &WriteableEcdsaChannelSigner) -> WriteableEcdsaChannelSigner { WriteableEcdsaChannelSigner { this_arg: orig.this_arg, EcdsaChannelSigner: crate::lightning::sign::EcdsaChannelSigner_clone_fields(&orig.EcdsaChannelSigner), write: Clone::clone(&orig.write), + cloned: Clone::clone(&orig.cloned), free: Clone::clone(&orig.free), } } @@ -1111,6 +1222,18 @@ impl lightning::util::ser::Writeable for WriteableEcdsaChannelSigner { w.write_all(vec.as_slice()) } } +#[no_mangle] +/// Creates a copy of a WriteableEcdsaChannelSigner +pub extern "C" fn WriteableEcdsaChannelSigner_clone(orig: &WriteableEcdsaChannelSigner) -> WriteableEcdsaChannelSigner { + let mut res = WriteableEcdsaChannelSigner_clone_fields(orig); + if let Some(f) = orig.cloned { (f)(&mut res) }; + res +} +impl Clone for WriteableEcdsaChannelSigner { + fn clone(&self) -> Self { + WriteableEcdsaChannelSigner_clone(self) + } +} use lightning::sign::WriteableEcdsaChannelSigner as rustWriteableEcdsaChannelSigner; impl rustWriteableEcdsaChannelSigner for WriteableEcdsaChannelSigner { @@ -1124,6 +1247,11 @@ impl core::ops::Deref for WriteableEcdsaChannelSigner { self } } +impl core::ops::DerefMut for WriteableEcdsaChannelSigner { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn WriteableEcdsaChannelSigner_free(this_ptr: WriteableEcdsaChannelSigner) { } @@ -1211,8 +1339,7 @@ pub struct EntropySource { } unsafe impl Send for EntropySource {} unsafe impl Sync for EntropySource {} -#[no_mangle] -pub(crate) extern "C" fn EntropySource_clone_fields(orig: &EntropySource) -> EntropySource { +pub(crate) fn EntropySource_clone_fields(orig: &EntropySource) -> EntropySource { EntropySource { this_arg: orig.this_arg, get_secure_random_bytes: Clone::clone(&orig.get_secure_random_bytes), @@ -1236,6 +1363,11 @@ impl core::ops::Deref for EntropySource { self } } +impl core::ops::DerefMut for EntropySource { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn EntropySource_free(this_ptr: EntropySource) { } @@ -1277,7 +1409,7 @@ pub struct NodeSigner { /// should be resolved to allow LDK to resume forwarding HTLCs. /// /// Errors if the [`Recipient`] variant is not supported by the implementation. - pub ecdh: extern "C" fn (this_arg: *const c_void, recipient: crate::lightning::sign::Recipient, other_key: crate::c_types::PublicKey, tweak: crate::c_types::derived::COption_ScalarZ) -> crate::c_types::derived::CResult_SharedSecretNoneZ, + pub ecdh: extern "C" fn (this_arg: *const c_void, recipient: crate::lightning::sign::Recipient, other_key: crate::c_types::PublicKey, tweak: crate::c_types::derived::COption_BigEndianScalarZ) -> crate::c_types::derived::CResult_ThirtyTwoBytesNoneZ, /// Sign an invoice. /// /// By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of @@ -1290,27 +1422,52 @@ pub struct NodeSigner { /// /// Errors if the [`Recipient`] variant is not supported by the implementation. pub sign_invoice: extern "C" fn (this_arg: *const c_void, hrp_bytes: crate::c_types::u8slice, invoice_data: crate::c_types::derived::CVec_U5Z, recipient: crate::lightning::sign::Recipient) -> crate::c_types::derived::CResult_RecoverableSignatureNoneZ, + /// Signs the [`TaggedHash`] of a BOLT 12 invoice request. + /// + /// May be called by a function passed to [`UnsignedInvoiceRequest::sign`] where + /// `invoice_request` is the callee. + /// + /// Implementors may check that the `invoice_request` is expected rather than blindly signing + /// the tagged hash. An `Ok` result should sign `invoice_request.tagged_hash().as_digest()` with + /// the node's signing key or an ephemeral key to preserve privacy, whichever is associated with + /// [`UnsignedInvoiceRequest::payer_id`]. + /// + /// [`TaggedHash`]: crate::offers::merkle::TaggedHash + pub sign_bolt12_invoice_request: extern "C" fn (this_arg: *const c_void, invoice_request: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CResult_SchnorrSignatureNoneZ, + /// Signs the [`TaggedHash`] of a BOLT 12 invoice. + /// + /// May be called by a function passed to [`UnsignedBolt12Invoice::sign`] where `invoice` is the + /// callee. + /// + /// Implementors may check that the `invoice` is expected rather than blindly signing the tagged + /// hash. An `Ok` result should sign `invoice.tagged_hash().as_digest()` with the node's signing + /// key or an ephemeral key to preserve privacy, whichever is associated with + /// [`UnsignedBolt12Invoice::signing_pubkey`]. + /// + /// [`TaggedHash`]: crate::offers::merkle::TaggedHash + pub sign_bolt12_invoice: extern "C" fn (this_arg: *const c_void, invoice: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::CResult_SchnorrSignatureNoneZ, /// Sign a gossip message. /// /// Note that if this fails, LDK may panic and the message will not be broadcast to the network /// or a possible channel counterparty. If LDK panics, the error should be resolved to allow the /// message to be broadcast, as otherwise it may prevent one from receiving funds over the /// corresponding channel. - pub sign_gossip_message: extern "C" fn (this_arg: *const c_void, msg: crate::lightning::ln::msgs::UnsignedGossipMessage) -> crate::c_types::derived::CResult_SignatureNoneZ, + pub sign_gossip_message: extern "C" fn (this_arg: *const c_void, msg: crate::lightning::ln::msgs::UnsignedGossipMessage) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Frees any resources associated with this object given its this_arg pointer. /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, } unsafe impl Send for NodeSigner {} unsafe impl Sync for NodeSigner {} -#[no_mangle] -pub(crate) extern "C" fn NodeSigner_clone_fields(orig: &NodeSigner) -> NodeSigner { +pub(crate) fn NodeSigner_clone_fields(orig: &NodeSigner) -> NodeSigner { NodeSigner { this_arg: orig.this_arg, get_inbound_payment_key_material: Clone::clone(&orig.get_inbound_payment_key_material), get_node_id: Clone::clone(&orig.get_node_id), ecdh: Clone::clone(&orig.ecdh), sign_invoice: Clone::clone(&orig.sign_invoice), + sign_bolt12_invoice_request: Clone::clone(&orig.sign_bolt12_invoice_request), + sign_bolt12_invoice: Clone::clone(&orig.sign_bolt12_invoice), sign_gossip_message: Clone::clone(&orig.sign_gossip_message), free: Clone::clone(&orig.free), } @@ -1328,7 +1485,7 @@ impl rustNodeSigner for NodeSigner { local_ret } fn ecdh(&self, mut recipient: lightning::sign::Recipient, mut other_key: &bitcoin::secp256k1::PublicKey, mut tweak: Option<&bitcoin::secp256k1::Scalar>) -> Result { - let mut local_tweak = if tweak.is_none() { crate::c_types::derived::COption_ScalarZ::None } else { crate::c_types::derived::COption_ScalarZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::BigEndianScalar::from_rust(&(*tweak.as_ref().unwrap()).clone()) }) }; + let mut local_tweak = if tweak.is_none() { crate::c_types::derived::COption_BigEndianScalarZ::None } else { crate::c_types::derived::COption_BigEndianScalarZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::BigEndianScalar::from_rust(&(*tweak.as_ref().unwrap()).clone()) }) }; let mut ret = (self.ecdh)(self.this_arg, crate::lightning::sign::Recipient::native_into(recipient), crate::c_types::PublicKey::from_rust(&other_key), local_tweak); let mut local_ret = match ret.result_ok { true => Ok( { ::bitcoin::secp256k1::ecdh::SharedSecret::from_bytes((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).data) }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret @@ -1340,6 +1497,16 @@ impl rustNodeSigner for NodeSigner { let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } + fn sign_bolt12_invoice_request(&self, mut invoice_request: &lightning::offers::invoice_request::UnsignedInvoiceRequest) -> Result { + let mut ret = (self.sign_bolt12_invoice_request)(self.this_arg, &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest { inner: unsafe { ObjOps::nonnull_ptr_to_inner((invoice_request as *const lightning::offers::invoice_request::UnsignedInvoiceRequest<>) as *mut _) }, is_owned: false }); + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } + fn sign_bolt12_invoice(&self, mut invoice: &lightning::offers::invoice::UnsignedBolt12Invoice) -> Result { + let mut ret = (self.sign_bolt12_invoice)(self.this_arg, &crate::lightning::offers::invoice::UnsignedBolt12Invoice { inner: unsafe { ObjOps::nonnull_ptr_to_inner((invoice as *const lightning::offers::invoice::UnsignedBolt12Invoice<>) as *mut _) }, is_owned: false }); + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } fn sign_gossip_message(&self, mut msg: lightning::ln::msgs::UnsignedGossipMessage) -> Result { let mut ret = (self.sign_gossip_message)(self.this_arg, crate::lightning::ln::msgs::UnsignedGossipMessage::native_into(msg)); let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; @@ -1355,6 +1522,11 @@ impl core::ops::Deref for NodeSigner { self } } +impl core::ops::DerefMut for NodeSigner { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn NodeSigner_free(this_ptr: NodeSigner) { } @@ -1405,7 +1577,7 @@ pub struct SignerProvider { /// /// This method should return a different value each time it is called, to avoid linking /// on-chain funds across channels as controlled to the same user. - pub get_destination_script: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CResult_ScriptNoneZ, + pub get_destination_script: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CResult_CVec_u8ZNoneZ, /// Get a script pubkey which we will send funds to when closing a channel. /// /// If this function returns an error, this will result in a channel failing to open or close. @@ -1421,8 +1593,7 @@ pub struct SignerProvider { } unsafe impl Send for SignerProvider {} unsafe impl Sync for SignerProvider {} -#[no_mangle] -pub(crate) extern "C" fn SignerProvider_clone_fields(orig: &SignerProvider) -> SignerProvider { +pub(crate) fn SignerProvider_clone_fields(orig: &SignerProvider) -> SignerProvider { SignerProvider { this_arg: orig.this_arg, generate_channel_keys_id: Clone::clone(&orig.generate_channel_keys_id), @@ -1471,6 +1642,11 @@ impl core::ops::Deref for SignerProvider { self } } +impl core::ops::DerefMut for SignerProvider { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn SignerProvider_free(this_ptr: SignerProvider) { } @@ -1632,78 +1808,100 @@ pub extern "C" fn InMemorySigner_new(mut funding_key: crate::c_types::SecretKey, /// Returns the counterparty's pubkeys. /// -/// Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. +/// Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. +/// In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. +/// +/// 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 InMemorySigner_counterparty_pubkeys(this_arg: &crate::lightning::sign::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 } + let mut local_ret = crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::ln::chan_utils::ChannelPublicKeys<>) as *mut _ }, is_owned: false }; + local_ret } /// Returns the `contest_delay` value specified by our counterparty and applied on holder-broadcastable /// transactions, i.e., the amount of time that we have to wait to recover our funds if we /// broadcast a transaction. /// -/// Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. +/// Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. +/// In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. #[must_use] #[no_mangle] -pub extern "C" fn InMemorySigner_counterparty_selected_contest_delay(this_arg: &crate::lightning::sign::InMemorySigner) -> u16 { +pub extern "C" fn InMemorySigner_counterparty_selected_contest_delay(this_arg: &crate::lightning::sign::InMemorySigner) -> crate::c_types::derived::COption_u16Z { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.counterparty_selected_contest_delay(); - ret + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u16Z::None } else { crate::c_types::derived::COption_u16Z::Some( { ret.unwrap() }) }; + local_ret } /// Returns the `contest_delay` value specified by us and applied on transactions broadcastable /// by our counterparty, i.e., the amount of time that they have to wait to recover their funds /// if they broadcast a transaction. /// -/// Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. +/// Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. +/// In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. #[must_use] #[no_mangle] -pub extern "C" fn InMemorySigner_holder_selected_contest_delay(this_arg: &crate::lightning::sign::InMemorySigner) -> u16 { +pub extern "C" fn InMemorySigner_holder_selected_contest_delay(this_arg: &crate::lightning::sign::InMemorySigner) -> crate::c_types::derived::COption_u16Z { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.holder_selected_contest_delay(); - ret + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u16Z::None } else { crate::c_types::derived::COption_u16Z::Some( { ret.unwrap() }) }; + local_ret } /// Returns whether the holder is the initiator. /// -/// Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. +/// Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. +/// In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. #[must_use] #[no_mangle] -pub extern "C" fn InMemorySigner_is_outbound(this_arg: &crate::lightning::sign::InMemorySigner) -> bool { +pub extern "C" fn InMemorySigner_is_outbound(this_arg: &crate::lightning::sign::InMemorySigner) -> crate::c_types::derived::COption_boolZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_outbound(); - ret + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_boolZ::None } else { crate::c_types::derived::COption_boolZ::Some( { ret.unwrap() }) }; + local_ret } /// Funding outpoint /// -/// Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. +/// Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. +/// In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. +/// +/// 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 InMemorySigner_funding_outpoint(this_arg: &crate::lightning::sign::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 } + let mut local_ret = crate::lightning::chain::transaction::OutPoint { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::chain::transaction::OutPoint<>) as *mut _ }, is_owned: false }; + local_ret } /// Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or /// building transactions. /// -/// Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. +/// Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. +/// In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. +/// +/// 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 InMemorySigner_get_channel_parameters(this_arg: &crate::lightning::sign::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 } + let mut local_ret = crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _ }, is_owned: false }; + local_ret } /// Returns the channel type features of the channel parameters. Should be helpful for /// determining a channel's category, i. e. legacy/anchors/taproot/etc. /// -/// Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. +/// Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. +/// In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. +/// +/// 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 InMemorySigner_channel_type_features(this_arg: &crate::lightning::sign::InMemorySigner) -> crate::lightning::ln::features::ChannelTypeFeatures { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_type_features(); - crate::lightning::ln::features::ChannelTypeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::ChannelTypeFeatures<>) as *mut _) }, is_owned: false } + let mut local_ret = crate::lightning::ln::features::ChannelTypeFeatures { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::ln::features::ChannelTypeFeatures<>) as *mut _ }, is_owned: false }; + local_ret } /// Sign the single input of `spend_tx` at index `input_idx`, which spends the output described @@ -1806,7 +2004,7 @@ extern "C" fn InMemorySigner_ChannelSigner_release_commitment_secret(this_arg: * crate::c_types::ThirtyTwoBytes { data: ret } } #[must_use] -extern "C" fn InMemorySigner_ChannelSigner_validate_holder_commitment(this_arg: *const c_void, holder_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction, mut preimages: crate::c_types::derived::CVec_PaymentPreimageZ) -> crate::c_types::derived::CResult_NoneNoneZ { +extern "C" fn InMemorySigner_ChannelSigner_validate_holder_commitment(this_arg: *const c_void, holder_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction, mut preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> crate::c_types::derived::CResult_NoneNoneZ { let mut local_preimages = Vec::new(); for mut item in preimages.into_rust().drain(..) { local_preimages.push( { ::lightning::ln::PaymentPreimage(item.data) }); }; let mut ret = >::validate_holder_commitment(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, holder_tx.get_native_ref(), local_preimages); 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() }; @@ -1876,10 +2074,10 @@ pub extern "C" fn InMemorySigner_as_EcdsaChannelSigner(this_arg: &InMemorySigner } #[must_use] -extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_counterparty_commitment(this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::CommitmentTransaction, mut preimages: crate::c_types::derived::CVec_PaymentPreimageZ) -> crate::c_types::derived::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { +extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_counterparty_commitment(this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::CommitmentTransaction, mut preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> crate::c_types::derived::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { let mut local_preimages = Vec::new(); for mut item in preimages.into_rust().drain(..) { local_preimages.push( { ::lightning::ln::PaymentPreimage(item.data) }); }; let mut ret = >::sign_counterparty_commitment(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, commitment_tx.get_native_ref(), local_preimages, secp256k1::global::SECP256K1); - 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_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { crate::c_types::Signature::from_rust(&item) }); }; let mut local_ret_0 = (crate::c_types::Signature::from_rust(&orig_ret_0_0), local_orig_ret_0_1.into()).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + 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_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { crate::c_types::ECDSASignature::from_rust(&item) }); }; let mut local_ret_0 = (crate::c_types::ECDSASignature::from_rust(&orig_ret_0_0), local_orig_ret_0_1.into()).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } #[must_use] @@ -1889,51 +2087,51 @@ extern "C" fn InMemorySigner_EcdsaChannelSigner_validate_counterparty_revocation local_ret } #[must_use] -extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_holder_commitment_and_htlcs(this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { +extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_holder_commitment_and_htlcs(this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { let mut ret = >::sign_holder_commitment_and_htlcs(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, commitment_tx.get_native_ref(), secp256k1::global::SECP256K1); - 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_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { crate::c_types::Signature::from_rust(&item) }); }; let mut local_ret_0 = (crate::c_types::Signature::from_rust(&orig_ret_0_0), local_orig_ret_0_1.into()).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + 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_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { crate::c_types::ECDSASignature::from_rust(&item) }); }; let mut local_ret_0 = (crate::c_types::ECDSASignature::from_rust(&orig_ret_0_0), local_orig_ret_0_1.into()).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } #[must_use] -extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_justice_revoked_output(this_arg: *const c_void, mut justice_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, per_commitment_key: *const [u8; 32]) -> crate::c_types::derived::CResult_SignatureNoneZ { +extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_justice_revoked_output(this_arg: *const c_void, mut justice_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, per_commitment_key: *const [u8; 32]) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { let mut ret = >::sign_justice_revoked_output(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &justice_tx.into_bitcoin(), input, amount, &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *per_commitment_key}[..]).unwrap(), secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ECDSASignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } #[must_use] -extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_justice_revoked_htlc(this_arg: *const c_void, mut justice_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, per_commitment_key: *const [u8; 32], htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_SignatureNoneZ { +extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_justice_revoked_htlc(this_arg: *const c_void, mut justice_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, per_commitment_key: *const [u8; 32], htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { let mut ret = >::sign_justice_revoked_htlc(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &justice_tx.into_bitcoin(), input, amount, &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *per_commitment_key}[..]).unwrap(), htlc.get_native_ref(), secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ECDSASignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } #[must_use] -extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_holder_htlc_transaction(this_arg: *const c_void, mut htlc_tx: crate::c_types::Transaction, mut input: usize, htlc_descriptor: &crate::lightning::events::bump_transaction::HTLCDescriptor) -> crate::c_types::derived::CResult_SignatureNoneZ { +extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_holder_htlc_transaction(this_arg: *const c_void, mut htlc_tx: crate::c_types::Transaction, mut input: usize, htlc_descriptor: &crate::lightning::events::bump_transaction::HTLCDescriptor) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { let mut ret = >::sign_holder_htlc_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &htlc_tx.into_bitcoin(), input, htlc_descriptor.get_native_ref(), secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ECDSASignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } #[must_use] -extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_counterparty_htlc_transaction(this_arg: *const c_void, mut htlc_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: crate::c_types::PublicKey, htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_SignatureNoneZ { +extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_counterparty_htlc_transaction(this_arg: *const c_void, mut htlc_tx: crate::c_types::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: crate::c_types::PublicKey, htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { let mut ret = >::sign_counterparty_htlc_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &htlc_tx.into_bitcoin(), input, amount, &per_commitment_point.into_rust(), htlc.get_native_ref(), secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ECDSASignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } #[must_use] -extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_closing_transaction(this_arg: *const c_void, closing_tx: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::derived::CResult_SignatureNoneZ { +extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_closing_transaction(this_arg: *const c_void, closing_tx: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { let mut ret = >::sign_closing_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, closing_tx.get_native_ref(), secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ECDSASignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } #[must_use] -extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_holder_anchor_input(this_arg: *const c_void, mut anchor_tx: crate::c_types::Transaction, mut input: usize) -> crate::c_types::derived::CResult_SignatureNoneZ { +extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_holder_anchor_input(this_arg: *const c_void, mut anchor_tx: crate::c_types::Transaction, mut input: usize) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { let mut ret = >::sign_holder_anchor_input(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &anchor_tx.into_bitcoin(), input, secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ECDSASignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } #[must_use] -extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_channel_announcement_with_funding_key(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> crate::c_types::derived::CResult_SignatureNoneZ { +extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_channel_announcement_with_funding_key(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { let mut ret = >::sign_channel_announcement_with_funding_key(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, msg.get_native_ref(), secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ECDSASignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } @@ -1981,9 +2179,16 @@ pub extern "C" fn InMemorySigner_as_WriteableEcdsaChannelSigner(this_arg: &InMem }, }, write: InMemorySigner_write_void, + cloned: Some(WriteableEcdsaChannelSigner_InMemorySigner_cloned), } } +extern "C" fn WriteableEcdsaChannelSigner_InMemorySigner_cloned(new_obj: &mut crate::lightning::sign::WriteableEcdsaChannelSigner) { + new_obj.this_arg = InMemorySigner_clone_void(new_obj.this_arg); + new_obj.free = Some(InMemorySigner_free_void); + new_obj.EcdsaChannelSigner.this_arg = new_obj.this_arg; + new_obj.EcdsaChannelSigner.free = None; +} #[no_mangle] /// Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read @@ -2115,7 +2320,7 @@ pub extern "C" fn KeysManager_derive_channel_keys(this_arg: &crate::lightning::s /// this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`]. #[must_use] #[no_mangle] -pub extern "C" fn KeysManager_sign_spendable_outputs_psbt(this_arg: &crate::lightning::sign::KeysManager, mut descriptors: crate::c_types::derived::CVec_SpendableOutputDescriptorZ, mut psbt: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_PartiallySignedTransactionNoneZ { +pub extern "C" fn KeysManager_sign_spendable_outputs_psbt(this_arg: &crate::lightning::sign::KeysManager, mut descriptors: crate::c_types::derived::CVec_SpendableOutputDescriptorZ, mut psbt: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_CVec_u8ZNoneZ { let mut local_descriptors = Vec::new(); for mut item in descriptors.into_rust().drain(..) { local_descriptors.push( { item.into_native() }); }; let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sign_spendable_outputs_psbt(&local_descriptors.iter().collect::>()[..], ::bitcoin::consensus::encode::deserialize(psbt.as_slice()).expect("Invalid PSBT format"), secp256k1::global::SECP256K1); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { ::bitcoin::consensus::encode::serialize(&o).into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; @@ -2141,7 +2346,7 @@ pub extern "C" fn KeysManager_sign_spendable_outputs_psbt(this_arg: &crate::ligh /// 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: &crate::lightning::sign::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, mut locktime: crate::c_types::derived::COption_PackedLockTimeZ) -> crate::c_types::derived::CResult_TransactionNoneZ { +pub extern "C" fn KeysManager_spend_spendable_outputs(this_arg: &crate::lightning::sign::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, mut locktime: crate::c_types::derived::COption_u32Z) -> 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 local_locktime = { /*locktime*/ let locktime_opt = locktime; if locktime_opt.is_none() { None } else { Some({ { ::bitcoin::PackedLockTime({ locktime_opt.take() }) }})} }; @@ -2198,6 +2403,8 @@ pub extern "C" fn KeysManager_as_NodeSigner(this_arg: &KeysManager) -> crate::li get_node_id: KeysManager_NodeSigner_get_node_id, ecdh: KeysManager_NodeSigner_ecdh, sign_invoice: KeysManager_NodeSigner_sign_invoice, + sign_bolt12_invoice_request: KeysManager_NodeSigner_sign_bolt12_invoice_request, + sign_bolt12_invoice: KeysManager_NodeSigner_sign_bolt12_invoice, sign_gossip_message: KeysManager_NodeSigner_sign_gossip_message, } } @@ -2214,7 +2421,7 @@ extern "C" fn KeysManager_NodeSigner_get_node_id(this_arg: *const c_void, mut re local_ret } #[must_use] -extern "C" fn KeysManager_NodeSigner_ecdh(this_arg: *const c_void, mut recipient: crate::lightning::sign::Recipient, mut other_key: crate::c_types::PublicKey, mut tweak: crate::c_types::derived::COption_ScalarZ) -> crate::c_types::derived::CResult_SharedSecretNoneZ { +extern "C" fn KeysManager_NodeSigner_ecdh(this_arg: *const c_void, mut recipient: crate::lightning::sign::Recipient, mut other_key: crate::c_types::PublicKey, mut tweak: crate::c_types::derived::COption_BigEndianScalarZ) -> crate::c_types::derived::CResult_ThirtyTwoBytesNoneZ { let mut local_tweak_base = { /*tweak*/ let tweak_opt = tweak; if tweak_opt.is_none() { None } else { Some({ { { tweak_opt.take() }.into_rust() }})} }; let mut local_tweak = local_tweak_base.as_ref(); let mut ret = >::ecdh(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, recipient.into_native(), &other_key.into_rust(), local_tweak); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.secret_bytes() } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; @@ -2228,9 +2435,21 @@ extern "C" fn KeysManager_NodeSigner_sign_invoice(this_arg: *const c_void, mut h local_ret } #[must_use] -extern "C" fn KeysManager_NodeSigner_sign_gossip_message(this_arg: *const c_void, mut msg: crate::lightning::ln::msgs::UnsignedGossipMessage) -> crate::c_types::derived::CResult_SignatureNoneZ { +extern "C" fn KeysManager_NodeSigner_sign_bolt12_invoice_request(this_arg: *const c_void, invoice_request: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CResult_SchnorrSignatureNoneZ { + let mut ret = >::sign_bolt12_invoice_request(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, invoice_request.get_native_ref()); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::SchnorrSignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} +#[must_use] +extern "C" fn KeysManager_NodeSigner_sign_bolt12_invoice(this_arg: *const c_void, invoice: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::CResult_SchnorrSignatureNoneZ { + let mut ret = >::sign_bolt12_invoice(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, invoice.get_native_ref()); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::SchnorrSignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} +#[must_use] +extern "C" fn KeysManager_NodeSigner_sign_gossip_message(this_arg: *const c_void, mut msg: crate::lightning::ln::msgs::UnsignedGossipMessage) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { let mut ret = >::sign_gossip_message(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, msg.into_native()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ECDSASignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } @@ -2276,7 +2495,7 @@ extern "C" fn KeysManager_SignerProvider_read_chan_signer(this_arg: *const c_voi local_ret } #[must_use] -extern "C" fn KeysManager_SignerProvider_get_destination_script(this_arg: *const c_void) -> crate::c_types::derived::CResult_ScriptNoneZ { +extern "C" fn KeysManager_SignerProvider_get_destination_script(this_arg: *const c_void) -> crate::c_types::derived::CResult_CVec_u8ZNoneZ { let mut ret = >::get_destination_script(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, ); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o.into_bytes().into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret @@ -2401,6 +2620,8 @@ pub extern "C" fn PhantomKeysManager_as_NodeSigner(this_arg: &PhantomKeysManager get_node_id: PhantomKeysManager_NodeSigner_get_node_id, ecdh: PhantomKeysManager_NodeSigner_ecdh, sign_invoice: PhantomKeysManager_NodeSigner_sign_invoice, + sign_bolt12_invoice_request: PhantomKeysManager_NodeSigner_sign_bolt12_invoice_request, + sign_bolt12_invoice: PhantomKeysManager_NodeSigner_sign_bolt12_invoice, sign_gossip_message: PhantomKeysManager_NodeSigner_sign_gossip_message, } } @@ -2417,7 +2638,7 @@ extern "C" fn PhantomKeysManager_NodeSigner_get_node_id(this_arg: *const c_void, local_ret } #[must_use] -extern "C" fn PhantomKeysManager_NodeSigner_ecdh(this_arg: *const c_void, mut recipient: crate::lightning::sign::Recipient, mut other_key: crate::c_types::PublicKey, mut tweak: crate::c_types::derived::COption_ScalarZ) -> crate::c_types::derived::CResult_SharedSecretNoneZ { +extern "C" fn PhantomKeysManager_NodeSigner_ecdh(this_arg: *const c_void, mut recipient: crate::lightning::sign::Recipient, mut other_key: crate::c_types::PublicKey, mut tweak: crate::c_types::derived::COption_BigEndianScalarZ) -> crate::c_types::derived::CResult_ThirtyTwoBytesNoneZ { let mut local_tweak_base = { /*tweak*/ let tweak_opt = tweak; if tweak_opt.is_none() { None } else { Some({ { { tweak_opt.take() }.into_rust() }})} }; let mut local_tweak = local_tweak_base.as_ref(); let mut ret = >::ecdh(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, recipient.into_native(), &other_key.into_rust(), local_tweak); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.secret_bytes() } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; @@ -2431,9 +2652,21 @@ extern "C" fn PhantomKeysManager_NodeSigner_sign_invoice(this_arg: *const c_void local_ret } #[must_use] -extern "C" fn PhantomKeysManager_NodeSigner_sign_gossip_message(this_arg: *const c_void, mut msg: crate::lightning::ln::msgs::UnsignedGossipMessage) -> crate::c_types::derived::CResult_SignatureNoneZ { +extern "C" fn PhantomKeysManager_NodeSigner_sign_bolt12_invoice_request(this_arg: *const c_void, invoice_request: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CResult_SchnorrSignatureNoneZ { + let mut ret = >::sign_bolt12_invoice_request(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, invoice_request.get_native_ref()); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::SchnorrSignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} +#[must_use] +extern "C" fn PhantomKeysManager_NodeSigner_sign_bolt12_invoice(this_arg: *const c_void, invoice: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::CResult_SchnorrSignatureNoneZ { + let mut ret = >::sign_bolt12_invoice(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, invoice.get_native_ref()); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::SchnorrSignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} +#[must_use] +extern "C" fn PhantomKeysManager_NodeSigner_sign_gossip_message(this_arg: *const c_void, mut msg: crate::lightning::ln::msgs::UnsignedGossipMessage) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { let mut ret = >::sign_gossip_message(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, msg.into_native()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::Signature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ECDSASignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } @@ -2479,7 +2712,7 @@ extern "C" fn PhantomKeysManager_SignerProvider_read_chan_signer(this_arg: *cons local_ret } #[must_use] -extern "C" fn PhantomKeysManager_SignerProvider_get_destination_script(this_arg: *const c_void) -> crate::c_types::derived::CResult_ScriptNoneZ { +extern "C" fn PhantomKeysManager_SignerProvider_get_destination_script(this_arg: *const c_void) -> crate::c_types::derived::CResult_CVec_u8ZNoneZ { let mut ret = >::get_destination_script(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, ); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o.into_bytes().into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret @@ -2512,7 +2745,7 @@ pub extern "C" fn PhantomKeysManager_new(seed: *const [u8; 32], mut starting_tim /// See [`KeysManager::spend_spendable_outputs`] for documentation on this method. #[must_use] #[no_mangle] -pub extern "C" fn PhantomKeysManager_spend_spendable_outputs(this_arg: &crate::lightning::sign::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, mut locktime: crate::c_types::derived::COption_PackedLockTimeZ) -> crate::c_types::derived::CResult_TransactionNoneZ { +pub extern "C" fn PhantomKeysManager_spend_spendable_outputs(this_arg: &crate::lightning::sign::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, mut locktime: crate::c_types::derived::COption_u32Z) -> 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 local_locktime = { /*locktime*/ let locktime_opt = locktime; if locktime_opt.is_none() { None } else { Some({ { ::bitcoin::PackedLockTime({ locktime_opt.take() }) }})} }; diff --git a/lightning-c-bindings/src/lightning/util/config.rs b/lightning-c-bindings/src/lightning/util/config.rs index e451b42b..c4eb473c 100644 --- a/lightning-c-bindings/src/lightning/util/config.rs +++ b/lightning-c-bindings/src/lightning/util/config.rs @@ -10,6 +10,7 @@ //! applies for you. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/util/errors.rs b/lightning-c-bindings/src/lightning/util/errors.rs index 7ca78917..43755de8 100644 --- a/lightning-c-bindings/src/lightning/util/errors.rs +++ b/lightning-c-bindings/src/lightning/util/errors.rs @@ -9,6 +9,7 @@ //! Error types live here. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/util/indexed_map.rs b/lightning-c-bindings/src/lightning/util/indexed_map.rs index 06fc03ab..e22f9f5d 100644 --- a/lightning-c-bindings/src/lightning/util/indexed_map.rs +++ b/lightning-c-bindings/src/lightning/util/indexed_map.rs @@ -9,6 +9,7 @@ //! This module has a map which can be iterated in a deterministic order. See the [`IndexedMap`]. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/util/invoice.rs b/lightning-c-bindings/src/lightning/util/invoice.rs index 4b328091..5d785283 100644 --- a/lightning-c-bindings/src/lightning/util/invoice.rs +++ b/lightning-c-bindings/src/lightning/util/invoice.rs @@ -9,6 +9,7 @@ //! Low level invoice utilities. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/util/logger.rs b/lightning-c-bindings/src/lightning/util/logger.rs index 651255bb..452da100 100644 --- a/lightning-c-bindings/src/lightning/util/logger.rs +++ b/lightning-c-bindings/src/lightning/util/logger.rs @@ -14,6 +14,7 @@ //! Each module may have its own Logger or share one. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -280,8 +281,7 @@ pub struct Logger { } unsafe impl Send for Logger {} unsafe impl Sync for Logger {} -#[no_mangle] -pub(crate) extern "C" fn Logger_clone_fields(orig: &Logger) -> Logger { +pub(crate) fn Logger_clone_fields(orig: &Logger) -> Logger { Logger { this_arg: orig.this_arg, log: Clone::clone(&orig.log), @@ -304,6 +304,11 @@ impl core::ops::Deref for Logger { self } } +impl core::ops::DerefMut for Logger { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn Logger_free(this_ptr: Logger) { } diff --git a/lightning-c-bindings/src/lightning/util/message_signing.rs b/lightning-c-bindings/src/lightning/util/message_signing.rs index 387f9984..8e4dfc60 100644 --- a/lightning-c-bindings/src/lightning/util/message_signing.rs +++ b/lightning-c-bindings/src/lightning/util/message_signing.rs @@ -23,6 +23,7 @@ //! use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -34,7 +35,7 @@ use alloc::{vec::Vec, boxed::Box}; /// A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller. /// Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted. #[no_mangle] -pub extern "C" fn sign(mut msg: crate::c_types::u8slice, sk: *const [u8; 32]) -> crate::c_types::derived::CResult_StringErrorZ { +pub extern "C" fn sign(mut msg: crate::c_types::u8slice, sk: *const [u8; 32]) -> crate::c_types::derived::CResult_StrSecp256k1ErrorZ { let mut ret = lightning::util::message_signing::sign(msg.to_slice(), &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *sk}[..]).unwrap()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() }; local_ret @@ -42,7 +43,7 @@ pub extern "C" fn sign(mut msg: crate::c_types::u8slice, sk: *const [u8; 32]) -> /// Recovers the PublicKey of the signer of the message given the message and the signature. #[no_mangle] -pub extern "C" fn recover_pk(mut msg: crate::c_types::u8slice, mut sig: crate::c_types::Str) -> crate::c_types::derived::CResult_PublicKeyErrorZ { +pub extern "C" fn recover_pk(mut msg: crate::c_types::u8slice, mut sig: crate::c_types::Str) -> crate::c_types::derived::CResult_PublicKeySecp256k1ErrorZ { let mut ret = lightning::util::message_signing::recover_pk(msg.to_slice(), sig.into_str()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::PublicKey::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() }; local_ret diff --git a/lightning-c-bindings/src/lightning/util/mod.rs b/lightning-c-bindings/src/lightning/util/mod.rs index 47f5c1dd..a8163b69 100644 --- a/lightning-c-bindings/src/lightning/util/mod.rs +++ b/lightning-c-bindings/src/lightning/util/mod.rs @@ -9,6 +9,7 @@ //! Some utility modules live here. See individual sub-modules for more info. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -30,6 +31,7 @@ pub mod config; mod fuzz_wrappers { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -38,9 +40,10 @@ use crate::c_types::*; use alloc::{vec::Vec, boxed::Box}; } -mod atomic_counter { +mod base32 { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -49,9 +52,10 @@ use crate::c_types::*; use alloc::{vec::Vec, boxed::Box}; } -mod byte_utils { +mod atomic_counter { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -60,9 +64,10 @@ use crate::c_types::*; use alloc::{vec::Vec, boxed::Box}; } -mod chacha20 { +mod byte_utils { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -70,9 +75,11 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -mod real_chacha { +} +mod chacha20 { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -80,11 +87,10 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -} -} -mod zbase32 { +mod real_chacha { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -92,10 +98,12 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; +} } mod poly1305 { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -107,6 +115,7 @@ use alloc::{vec::Vec, boxed::Box}; mod chacha20poly1305rfc { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -117,6 +126,7 @@ use alloc::{vec::Vec, boxed::Box}; mod real_chachapoly { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -129,6 +139,7 @@ use alloc::{vec::Vec, boxed::Box}; mod transaction_utils { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -140,6 +151,7 @@ use alloc::{vec::Vec, boxed::Box}; mod scid_utils { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -150,6 +162,7 @@ use alloc::{vec::Vec, boxed::Box}; mod fake_scid { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -162,6 +175,7 @@ use alloc::{vec::Vec, boxed::Box}; mod time { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -173,6 +187,7 @@ use alloc::{vec::Vec, boxed::Box}; mod macro_logger { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -184,6 +199,7 @@ use alloc::{vec::Vec, boxed::Box}; mod crypto { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/util/persist.rs b/lightning-c-bindings/src/lightning/util/persist.rs index 0c77f8d0..953ffe8e 100644 --- a/lightning-c-bindings/src/lightning/util/persist.rs +++ b/lightning-c-bindings/src/lightning/util/persist.rs @@ -6,11 +6,12 @@ // license as that which applies to the original source files from which this // source was automatically generated. -//! This module contains a simple key-value store trait KVStorePersister that +//! This module contains a simple key-value store trait [`KVStore`] that //! allows one to implement the persistence for [`ChannelManager`], [`NetworkGraph`], //! and [`ChannelMonitor`] all in one place. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -18,6 +19,136 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; +/// The maximum number of characters namespaces and keys may have. + +#[no_mangle] +pub static KVSTORE_NAMESPACE_KEY_MAX_LEN: usize = lightning::util::persist::KVSTORE_NAMESPACE_KEY_MAX_LEN; +/// Provides an interface that allows storage and retrieval of persisted values that are associated +/// with given keys. +/// +/// In order to avoid collisions the key space is segmented based on the given `primary_namespace`s +/// and `secondary_namespace`s. Implementations of this trait are free to handle them in different +/// ways, as long as per-namespace key uniqueness is asserted. +/// +/// Keys and namespaces are required to be valid ASCII strings in the range of +/// [`KVSTORE_NAMESPACE_KEY_ALPHABET`] and no longer than [`KVSTORE_NAMESPACE_KEY_MAX_LEN`]. Empty +/// primary namespaces and secondary namespaces (`\"\"`) are assumed to be a valid, however, if +/// `primary_namespace` is empty, `secondary_namespace` is required to be empty, too. This means +/// that concerns should always be separated by primary namespace first, before secondary +/// namespaces are used. While the number of primary namespaces will be relatively small and is +/// determined at compile time, there may be many secondary namespaces per primary namespace. Note +/// that per-namespace uniqueness needs to also hold for keys *and* namespaces in any given +/// namespace, i.e., conflicts between keys and equally named +/// primary namespaces/secondary namespaces must be avoided. +/// +/// **Note:** Users migrating custom persistence backends from the pre-v0.0.117 `KVStorePersister` +/// interface can use a concatenation of `[{primary_namespace}/[{secondary_namespace}/]]{key}` to +/// recover a `key` compatible with the data model previously assumed by `KVStorePersister::persist`. +#[repr(C)] +pub struct KVStore { + /// An opaque pointer which is passed to your function implementations as an argument. + /// This has no meaning in the LDK, and can be NULL or any other value. + pub this_arg: *mut c_void, + /// Returns the data stored for the given `primary_namespace`, `secondary_namespace`, and + /// `key`. + /// + /// Returns an [`ErrorKind::NotFound`] if the given `key` could not be found in the given + /// `primary_namespace` and `secondary_namespace`. + /// + /// [`ErrorKind::NotFound`]: io::ErrorKind::NotFound + pub read: extern "C" fn (this_arg: *const c_void, primary_namespace: crate::c_types::Str, secondary_namespace: crate::c_types::Str, key: crate::c_types::Str) -> crate::c_types::derived::CResult_CVec_u8ZIOErrorZ, + /// Persists the given data under the given `key`. + /// + /// Will create the given `primary_namespace` and `secondary_namespace` if not already present + /// in the store. + pub write: extern "C" fn (this_arg: *const c_void, primary_namespace: crate::c_types::Str, secondary_namespace: crate::c_types::Str, key: crate::c_types::Str, buf: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NoneIOErrorZ, + /// Removes any data that had previously been persisted under the given `key`. + /// + /// If the `lazy` flag is set to `true`, the backend implementation might choose to lazily + /// remove the given `key` at some point in time after the method returns, e.g., as part of an + /// eventual batch deletion of multiple keys. As a consequence, subsequent calls to + /// [`KVStore::list`] might include the removed key until the changes are actually persisted. + /// + /// Note that while setting the `lazy` flag reduces the I/O burden of multiple subsequent + /// `remove` calls, it also influences the atomicity guarantees as lazy `remove`s could + /// potentially get lost on crash after the method returns. Therefore, this flag should only be + /// set for `remove` operations that can be safely replayed at a later time. + /// + /// Returns successfully if no data will be stored for the given `primary_namespace`, + /// `secondary_namespace`, and `key`, independently of whether it was present before its + /// invokation or not. + pub remove: extern "C" fn (this_arg: *const c_void, primary_namespace: crate::c_types::Str, secondary_namespace: crate::c_types::Str, key: crate::c_types::Str, lazy: bool) -> crate::c_types::derived::CResult_NoneIOErrorZ, + /// Returns a list of keys that are stored under the given `secondary_namespace` in + /// `primary_namespace`. + /// + /// Returns the keys in arbitrary order, so users requiring a particular order need to sort the + /// returned keys. Returns an empty list if `primary_namespace` or `secondary_namespace` is unknown. + pub list: extern "C" fn (this_arg: *const c_void, primary_namespace: crate::c_types::Str, secondary_namespace: crate::c_types::Str) -> crate::c_types::derived::CResult_CVec_StrZIOErrorZ, + /// Frees any resources associated with this object given its this_arg pointer. + /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + pub free: Option, +} +unsafe impl Send for KVStore {} +unsafe impl Sync for KVStore {} +pub(crate) fn KVStore_clone_fields(orig: &KVStore) -> KVStore { + KVStore { + this_arg: orig.this_arg, + read: Clone::clone(&orig.read), + write: Clone::clone(&orig.write), + remove: Clone::clone(&orig.remove), + list: Clone::clone(&orig.list), + free: Clone::clone(&orig.free), + } +} + +use lightning::util::persist::KVStore as rustKVStore; +impl rustKVStore for KVStore { + fn read(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str) -> Result, lightning::io::Error> { + let mut ret = (self.read)(self.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into()); + let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = Vec::new(); for mut item in (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust().drain(..) { local_ret_0.push( { item }); }; local_ret_0 }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })}; + local_ret + } + fn write(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str, mut buf: &[u8]) -> Result<(), lightning::io::Error> { + let mut local_buf = crate::c_types::u8slice::from_slice(buf); + let mut ret = (self.write)(self.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), local_buf); + let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })}; + local_ret + } + fn remove(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str, mut lazy: bool) -> Result<(), lightning::io::Error> { + let mut ret = (self.remove)(self.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), lazy); + let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })}; + local_ret + } + fn list(&self, mut primary_namespace: &str, mut secondary_namespace: &str) -> Result, lightning::io::Error> { + let mut ret = (self.list)(self.this_arg, primary_namespace.into(), secondary_namespace.into()); + let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = Vec::new(); for mut item in (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust().drain(..) { local_ret_0.push( { item.into_string() }); }; local_ret_0 }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })}; + local_ret + } +} + +// We're essentially a pointer already, or at least a set of pointers, so allow us to be used +// directly as a Deref trait in higher-level structs: +impl core::ops::Deref for KVStore { + type Target = Self; + fn deref(&self) -> &Self { + self + } +} +impl core::ops::DerefMut for KVStore { + fn deref_mut(&mut self) -> &mut Self { + self + } +} +/// Calls the free function if one is set +#[no_mangle] +pub extern "C" fn KVStore_free(this_ptr: KVStore) { } +impl Drop for KVStore { + fn drop(&mut self) { + if let Some(f) = self.free { + f(self.this_arg); + } + } +} /// Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk. #[repr(C)] pub struct Persister { @@ -25,19 +156,18 @@ pub struct Persister { /// This has no meaning in the LDK, and can be NULL or any other value. pub this_arg: *mut c_void, /// Persist the given ['ChannelManager'] to disk, returning an error if persistence failed. - pub persist_manager: extern "C" fn (this_arg: *const c_void, channel_manager: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CResult_NoneErrorZ, + pub persist_manager: extern "C" fn (this_arg: *const c_void, channel_manager: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CResult_NoneIOErrorZ, /// Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed. - pub persist_graph: extern "C" fn (this_arg: *const c_void, network_graph: &crate::lightning::routing::gossip::NetworkGraph) -> crate::c_types::derived::CResult_NoneErrorZ, + pub persist_graph: extern "C" fn (this_arg: *const c_void, network_graph: &crate::lightning::routing::gossip::NetworkGraph) -> crate::c_types::derived::CResult_NoneIOErrorZ, /// Persist the given [`WriteableScore`] to disk, returning an error if persistence failed. - pub persist_scorer: extern "C" fn (this_arg: *const c_void, scorer: &crate::lightning::routing::scoring::WriteableScore) -> crate::c_types::derived::CResult_NoneErrorZ, + pub persist_scorer: extern "C" fn (this_arg: *const c_void, scorer: &crate::lightning::routing::scoring::WriteableScore) -> crate::c_types::derived::CResult_NoneIOErrorZ, /// Frees any resources associated with this object given its this_arg pointer. /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, } unsafe impl Send for Persister {} unsafe impl Sync for Persister {} -#[no_mangle] -pub(crate) extern "C" fn Persister_clone_fields(orig: &Persister) -> Persister { +pub(crate) fn Persister_clone_fields(orig: &Persister) -> Persister { Persister { this_arg: orig.this_arg, persist_manager: Clone::clone(&orig.persist_manager), @@ -74,6 +204,11 @@ impl core::ops::Deref for Persister { self } } +impl core::ops::DerefMut for Persister { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn Persister_free(this_ptr: Persister) { } @@ -84,3 +219,252 @@ impl Drop for Persister { } } } +/// Read previously persisted [`ChannelMonitor`]s from the store. +#[no_mangle] +pub extern "C" fn read_channel_monitors(mut kv_store: crate::lightning::util::persist::KVStore, mut entropy_source: crate::lightning::sign::EntropySource, mut signer_provider: crate::lightning::sign::SignerProvider) -> crate::c_types::derived::CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + let mut ret = lightning::util::persist::read_channel_monitors::(kv_store, entropy_source, signer_provider); + 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 +} + + +use lightning::util::persist::MonitorUpdatingPersister as nativeMonitorUpdatingPersisterImport; +pub(crate) type nativeMonitorUpdatingPersister = nativeMonitorUpdatingPersisterImport; + +/// Implements [`Persist`] in a way that writes and reads both [`ChannelMonitor`]s and +/// [`ChannelMonitorUpdate`]s. +/// +/// # Overview +/// +/// The main benefit this provides over the [`KVStore`]'s [`Persist`] implementation is decreased +/// I/O bandwidth and storage churn, at the expense of more IOPS (including listing, reading, and +/// deleting) and complexity. This is because it writes channel monitor differential updates, +/// whereas the other (default) implementation rewrites the entire monitor on each update. For +/// routing nodes, updates can happen many times per second to a channel, and monitors can be tens +/// of megabytes (or more). Updates can be as small as a few hundred bytes. +/// +/// Note that monitors written with `MonitorUpdatingPersister` are _not_ backward-compatible with +/// the default [`KVStore`]'s [`Persist`] implementation. They have a prepended byte sequence, +/// [`MONITOR_UPDATING_PERSISTER_PREPEND_SENTINEL`], applied to prevent deserialization with other +/// persisters. This is because monitors written by this struct _may_ have unapplied updates. In +/// order to downgrade, you must ensure that all updates are applied to the monitor, and remove the +/// sentinel bytes. +/// +/// # Storing monitors +/// +/// Monitors are stored by implementing the [`Persist`] trait, which has two functions: +/// +/// - [`Persist::persist_new_channel`], which persists whole [`ChannelMonitor`]s. +/// - [`Persist::update_persisted_channel`], which persists only a [`ChannelMonitorUpdate`] +/// +/// Whole [`ChannelMonitor`]s are stored in the [`CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE`], +/// using the familiar encoding of an [`OutPoint`] (for example, `[SOME-64-CHAR-HEX-STRING]_1`). +/// +/// Each [`ChannelMonitorUpdate`] is stored in a dynamic secondary namespace, as follows: +/// +/// - primary namespace: [`CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE`] +/// - secondary namespace: [the monitor's encoded outpoint name] +/// +/// Under that secondary namespace, each update is stored with a number string, like `21`, which +/// represents its `update_id` value. +/// +/// For example, consider this channel, named for its transaction ID and index, or [`OutPoint`]: +/// +/// - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef` +/// - Index: `1` +/// +/// Full channel monitors would be stored at a single key: +/// +/// `[CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1` +/// +/// Updates would be stored as follows (with `/` delimiting primary_namespace/secondary_namespace/key): +/// +/// ```text +/// [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/1 +/// [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/2 +/// [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/3 +/// ``` +/// ... and so on. +/// +/// # Reading channel state from storage +/// +/// Channel state can be reconstructed by calling +/// [`MonitorUpdatingPersister::read_all_channel_monitors_with_updates`]. Alternatively, users can +/// list channel monitors themselves and load channels individually using +/// [`MonitorUpdatingPersister::read_channel_monitor_with_updates`]. +/// +/// ## EXTREMELY IMPORTANT +/// +/// It is extremely important that your [`KVStore::read`] implementation uses the +/// [`io::ErrorKind::NotFound`] variant correctly: that is, when a file is not found, and _only_ in +/// that circumstance (not when there is really a permissions error, for example). This is because +/// neither channel monitor reading function lists updates. Instead, either reads the monitor, and +/// using its stored `update_id`, synthesizes update storage keys, and tries them in sequence until +/// one is not found. All _other_ errors will be bubbled up in the function's [`Result`]. +/// +/// # Pruning stale channel updates +/// +/// Stale updates are pruned when a full monitor is written. The old monitor is first read, and if +/// that succeeds, updates in the range between the old and new monitors are deleted. The `lazy` +/// flag is used on the [`KVStore::remove`] method, so there are no guarantees that the deletions +/// will complete. However, stale updates are not a problem for data integrity, since updates are +/// only read that are higher than the stored [`ChannelMonitor`]'s `update_id`. +/// +/// If you have many stale updates stored (such as after a crash with pending lazy deletes), and +/// would like to get rid of them, consider using the +/// [`MonitorUpdatingPersister::cleanup_stale_updates`] function. +#[must_use] +#[repr(C)] +pub struct MonitorUpdatingPersister { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, inner must be non-null, however in places where + /// the Rust equivalent takes an Option, it may be set to null to indicate None. + pub inner: *mut nativeMonitorUpdatingPersister, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for MonitorUpdatingPersister { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeMonitorUpdatingPersister>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the MonitorUpdatingPersister, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn MonitorUpdatingPersister_free(this_obj: MonitorUpdatingPersister) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn MonitorUpdatingPersister_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeMonitorUpdatingPersister) }; +} +#[allow(unused)] +impl MonitorUpdatingPersister { + pub(crate) fn get_native_ref(&self) -> &'static nativeMonitorUpdatingPersister { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeMonitorUpdatingPersister { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeMonitorUpdatingPersister { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// Constructs a new [`MonitorUpdatingPersister`]. +/// +/// The `maximum_pending_updates` parameter controls how many updates may be stored before a +/// [`MonitorUpdatingPersister`] consolidates updates by writing a full monitor. Note that +/// consolidation will frequently occur with fewer updates than what you set here; this number +/// is merely the maximum that may be stored. When setting this value, consider that for higher +/// values of `maximum_pending_updates`: +/// +/// - [`MonitorUpdatingPersister`] will tend to write more [`ChannelMonitorUpdate`]s than +/// [`ChannelMonitor`]s, approaching one [`ChannelMonitor`] write for every +/// `maximum_pending_updates` [`ChannelMonitorUpdate`]s. +/// - [`MonitorUpdatingPersister`] will issue deletes differently. Lazy deletes will come in +/// \"waves\" for each [`ChannelMonitor`] write. A larger `maximum_pending_updates` means bigger, +/// less frequent \"waves.\" +/// - [`MonitorUpdatingPersister`] will potentially have more listing to do if you need to run +/// [`MonitorUpdatingPersister::cleanup_stale_updates`]. +#[must_use] +#[no_mangle] +pub extern "C" fn MonitorUpdatingPersister_new(mut kv_store: crate::lightning::util::persist::KVStore, mut logger: crate::lightning::util::logger::Logger, mut maximum_pending_updates: u64, mut entropy_source: crate::lightning::sign::EntropySource, mut signer_provider: crate::lightning::sign::SignerProvider) -> crate::lightning::util::persist::MonitorUpdatingPersister { + let mut ret = lightning::util::persist::MonitorUpdatingPersister::new(kv_store, logger, maximum_pending_updates, entropy_source, signer_provider); + crate::lightning::util::persist::MonitorUpdatingPersister { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Reads all stored channel monitors, along with any stored updates for them. +/// +/// It is extremely important that your [`KVStore::read`] implementation uses the +/// [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the +/// documentation for [`MonitorUpdatingPersister`]. +#[must_use] +#[no_mangle] +pub extern "C" fn MonitorUpdatingPersister_read_all_channel_monitors_with_updates(this_arg: &crate::lightning::util::persist::MonitorUpdatingPersister, broadcaster: &crate::lightning::chain::chaininterface::BroadcasterInterface, fee_estimator: &crate::lightning::chain::chaininterface::FeeEstimator) -> crate::c_types::derived::CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.read_all_channel_monitors_with_updates(broadcaster, fee_estimator); + 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 +} + +/// Read a single channel monitor, along with any stored updates for it. +/// +/// It is extremely important that your [`KVStore::read`] implementation uses the +/// [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the +/// documentation for [`MonitorUpdatingPersister`]. +/// +/// For `monitor_key`, channel storage keys be the channel's transaction ID and index, or +/// [`OutPoint`], with an underscore `_` between them. For example, given: +/// +/// - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef` +/// - Index: `1` +/// +/// The correct `monitor_key` would be: +/// `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1` +/// +/// Loading a large number of monitors will be faster if done in parallel. You can use this +/// function to accomplish this. Take care to limit the number of parallel readers. +#[must_use] +#[no_mangle] +pub extern "C" fn MonitorUpdatingPersister_read_channel_monitor_with_updates(this_arg: &crate::lightning::util::persist::MonitorUpdatingPersister, broadcaster: &crate::lightning::chain::chaininterface::BroadcasterInterface, fee_estimator: &crate::lightning::chain::chaininterface::FeeEstimator, mut monitor_key: crate::c_types::Str) -> crate::c_types::derived::CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.read_channel_monitor_with_updates(broadcaster, fee_estimator, monitor_key.into_string()); + 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.into_inner() }, crate::lightning::chain::channelmonitor::ChannelMonitor { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::IOError::from_rust(e) }).into() }; + local_ret +} + +/// Cleans up stale updates for all monitors. +/// +/// This function works by first listing all monitors, and then for each of them, listing all +/// updates. The updates that have an `update_id` less than or equal to than the stored monitor +/// are deleted. The deletion can either be lazy or non-lazy based on the `lazy` flag; this will +/// be passed to [`KVStore::remove`]. +#[must_use] +#[no_mangle] +pub extern "C" fn MonitorUpdatingPersister_cleanup_stale_updates(this_arg: &crate::lightning::util::persist::MonitorUpdatingPersister, mut lazy: bool) -> crate::c_types::derived::CResult_NoneIOErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.cleanup_stale_updates(lazy); + 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 +} + +impl From for crate::lightning::chain::chainmonitor::Persist { + fn from(obj: nativeMonitorUpdatingPersister) -> Self { + let mut rust_obj = MonitorUpdatingPersister { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = MonitorUpdatingPersister_as_Persist(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn + rust_obj.inner = core::ptr::null_mut(); + ret.free = Some(MonitorUpdatingPersister_free_void); + ret + } +} +/// Constructs a new Persist which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is +#[no_mangle] +pub extern "C" fn MonitorUpdatingPersister_as_Persist(this_arg: &MonitorUpdatingPersister) -> crate::lightning::chain::chainmonitor::Persist { + crate::lightning::chain::chainmonitor::Persist { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + persist_new_channel: MonitorUpdatingPersister_Persist_persist_new_channel, + update_persisted_channel: MonitorUpdatingPersister_Persist_update_persisted_channel, + } +} + +#[must_use] +extern "C" fn MonitorUpdatingPersister_Persist_persist_new_channel(this_arg: *const c_void, mut channel_id: crate::lightning::chain::transaction::OutPoint, data: &crate::lightning::chain::channelmonitor::ChannelMonitor, mut update_id: crate::lightning::chain::chainmonitor::MonitorUpdateId) -> crate::lightning::chain::ChannelMonitorUpdateStatus { + let mut ret = >::persist_new_channel(unsafe { &mut *(this_arg as *mut nativeMonitorUpdatingPersister) }, *unsafe { Box::from_raw(channel_id.take_inner()) }, data.get_native_ref(), *unsafe { Box::from_raw(update_id.take_inner()) }); + crate::lightning::chain::ChannelMonitorUpdateStatus::native_into(ret) +} +#[must_use] +extern "C" fn MonitorUpdatingPersister_Persist_update_persisted_channel(this_arg: *const c_void, mut channel_id: crate::lightning::chain::transaction::OutPoint, mut update: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, data: &crate::lightning::chain::channelmonitor::ChannelMonitor, mut update_id: crate::lightning::chain::chainmonitor::MonitorUpdateId) -> crate::lightning::chain::ChannelMonitorUpdateStatus { + let mut local_update = if update.inner.is_null() { None } else { Some( { update.get_native_ref() }) }; + let mut ret = >::update_persisted_channel(unsafe { &mut *(this_arg as *mut nativeMonitorUpdatingPersister) }, *unsafe { Box::from_raw(channel_id.take_inner()) }, local_update, data.get_native_ref(), *unsafe { Box::from_raw(update_id.take_inner()) }); + crate::lightning::chain::ChannelMonitorUpdateStatus::native_into(ret) +} + diff --git a/lightning-c-bindings/src/lightning/util/ser.rs b/lightning-c-bindings/src/lightning/util/ser.rs index 193a22c6..663a172f 100644 --- a/lightning-c-bindings/src/lightning/util/ser.rs +++ b/lightning-c-bindings/src/lightning/util/ser.rs @@ -13,6 +13,7 @@ //! [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/util/ser_macros.rs b/lightning-c-bindings/src/lightning/util/ser_macros.rs index 19318041..b479ee1d 100644 --- a/lightning-c-bindings/src/lightning/util/ser_macros.rs +++ b/lightning-c-bindings/src/lightning/util/ser_macros.rs @@ -13,6 +13,7 @@ //! [`Writeable`]: crate::util::ser::Writeable use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/util/string.rs b/lightning-c-bindings/src/lightning/util/string.rs index 2e4e4953..5b720c23 100644 --- a/lightning-c-bindings/src/lightning/util/string.rs +++ b/lightning-c-bindings/src/lightning/util/string.rs @@ -9,6 +9,7 @@ //! Utilities for strings. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning/util/wakers.rs b/lightning-c-bindings/src/lightning/util/wakers.rs index 59a096ae..9ff48bda 100644 --- a/lightning-c-bindings/src/lightning/util/wakers.rs +++ b/lightning-c-bindings/src/lightning/util/wakers.rs @@ -13,6 +13,7 @@ //! [`ChannelManager`]: crate::ln::channelmanager::ChannelManager use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -41,8 +42,7 @@ pub struct FutureCallback { } unsafe impl Send for FutureCallback {} unsafe impl Sync for FutureCallback {} -#[no_mangle] -pub(crate) extern "C" fn FutureCallback_clone_fields(orig: &FutureCallback) -> FutureCallback { +pub(crate) fn FutureCallback_clone_fields(orig: &FutureCallback) -> FutureCallback { FutureCallback { this_arg: orig.this_arg, call: Clone::clone(&orig.call), @@ -65,6 +65,11 @@ impl core::ops::Deref for FutureCallback { self } } +impl core::ops::DerefMut for FutureCallback { + fn deref_mut(&mut self) -> &mut Self { + self + } +} /// Calls the free function if one is set #[no_mangle] pub extern "C" fn FutureCallback_free(this_ptr: FutureCallback) { } diff --git a/lightning-c-bindings/src/lightning_background_processor.rs b/lightning-c-bindings/src/lightning_background_processor.rs index d226dfaf..9d0dfe04 100644 --- a/lightning-c-bindings/src/lightning_background_processor.rs +++ b/lightning-c-bindings/src/lightning_background_processor.rs @@ -11,6 +11,7 @@ //! [`BackgroundProcessor`] for more details on the nitty-gritty. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -227,7 +228,7 @@ pub extern "C" fn BackgroundProcessor_start(mut persister: crate::lightning::uti /// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager #[must_use] #[no_mangle] -pub extern "C" fn BackgroundProcessor_join(mut this_arg: crate::lightning_background_processor::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_NoneIOErrorZ { 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 @@ -244,7 +245,7 @@ pub extern "C" fn BackgroundProcessor_join(mut this_arg: crate::lightning_backgr /// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager #[must_use] #[no_mangle] -pub extern "C" fn BackgroundProcessor_stop(mut this_arg: crate::lightning_background_processor::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_NoneIOErrorZ { 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/constants.rs b/lightning-c-bindings/src/lightning_invoice/constants.rs index 7a327220..bf0c3338 100644 --- a/lightning-c-bindings/src/lightning_invoice/constants.rs +++ b/lightning-c-bindings/src/lightning_invoice/constants.rs @@ -9,6 +9,7 @@ /// Tag constants as specified in BOLT11 use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning_invoice/mod.rs b/lightning-c-bindings/src/lightning_invoice/mod.rs index 4e8da728..34025a2f 100644 --- a/lightning-c-bindings/src/lightning_invoice/mod.rs +++ b/lightning-c-bindings/src/lightning_invoice/mod.rs @@ -18,6 +18,7 @@ //! [`Bolt11Invoice::from_str`]: crate::Bolt11Invoice#impl-FromStr use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -28,20 +29,10 @@ use alloc::{vec::Vec, boxed::Box}; pub mod payment; pub mod utils; pub mod constants; -mod time_utils { - -use alloc::str::FromStr; -use core::ffi::c_void; -use core::convert::Infallible; -use bitcoin::hashes::Hash; -use crate::c_types::*; -#[cfg(feature="no-std")] -use alloc::{vec::Vec, boxed::Box}; - -} mod de { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -52,6 +43,7 @@ use alloc::{vec::Vec, boxed::Box}; mod hrp_sm { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -122,6 +114,7 @@ pub extern "C" fn ParseOrSemanticError_to_str(o: &crate::lightning_invoice::Pars mod ser { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -153,6 +146,7 @@ pub extern "C" fn SiPrefix_to_str(o: &crate::lightning_invoice::SiPrefix) -> Str mod tb { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -164,6 +158,7 @@ use alloc::{vec::Vec, boxed::Box}; mod prelude { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -175,6 +170,7 @@ use alloc::{vec::Vec, boxed::Box}; mod sync { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -2179,7 +2175,7 @@ pub extern "C" fn SignedRawBolt11Invoice_signature(this_arg: &crate::lightning_i /// Recovers the public key used for signing the invoice from the recoverable signature. #[must_use] #[no_mangle] -pub extern "C" fn SignedRawBolt11Invoice_recover_payee_pub_key(this_arg: &crate::lightning_invoice::SignedRawBolt11Invoice) -> crate::c_types::derived::CResult_PayeePubKeyErrorZ { +pub extern "C" fn SignedRawBolt11Invoice_recover_payee_pub_key(this_arg: &crate::lightning_invoice::SignedRawBolt11Invoice) -> crate::c_types::derived::CResult_PayeePubKeySecp256k1ErrorZ { 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 @@ -2264,9 +2260,9 @@ pub extern "C" fn RawBolt11Invoice_min_final_cltv_expiry_delta(this_arg: &crate: #[must_use] #[no_mangle] -pub extern "C" fn RawBolt11Invoice_payment_secret(this_arg: &crate::lightning_invoice::RawBolt11Invoice) -> crate::c_types::derived::COption_PaymentSecretZ { +pub extern "C" fn RawBolt11Invoice_payment_secret(this_arg: &crate::lightning_invoice::RawBolt11Invoice) -> crate::c_types::derived::COption_ThirtyTwoBytesZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_secret(); - let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_PaymentSecretZ::None } else { crate::c_types::derived::COption_PaymentSecretZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: (*ret.as_ref().unwrap()).clone().0 } }) }; + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: (*ret.as_ref().unwrap()).clone().0 } }) }; local_ret } @@ -2502,9 +2498,9 @@ pub extern "C" fn Bolt11Invoice_recover_payee_pub_key(this_arg: &crate::lightnin /// Returning None if overflow occurred. #[must_use] #[no_mangle] -pub extern "C" fn Bolt11Invoice_expires_at(this_arg: &crate::lightning_invoice::Bolt11Invoice) -> crate::c_types::derived::COption_DurationZ { +pub extern "C" fn Bolt11Invoice_expires_at(this_arg: &crate::lightning_invoice::Bolt11Invoice) -> crate::c_types::derived::COption_u64Z { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.expires_at(); - let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_DurationZ::None } else { crate::c_types::derived::COption_DurationZ::Some( { ret.unwrap().as_secs() }) }; + 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().as_secs() }) }; local_ret } @@ -2562,7 +2558,7 @@ pub extern "C" fn Bolt11Invoice_min_final_cltv_expiry_delta(this_arg: &crate::li /// Returns a list of all fallback addresses as [`Address`]es #[must_use] #[no_mangle] -pub extern "C" fn Bolt11Invoice_fallback_addresses(this_arg: &crate::lightning_invoice::Bolt11Invoice) -> crate::c_types::derived::CVec_AddressZ { +pub extern "C" fn Bolt11Invoice_fallback_addresses(this_arg: &crate::lightning_invoice::Bolt11Invoice) -> crate::c_types::derived::CVec_StrZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fallback_addresses(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { alloc::string::ToString::to_string(&item).into() }); }; local_ret.into() diff --git a/lightning-c-bindings/src/lightning_invoice/payment.rs b/lightning-c-bindings/src/lightning_invoice/payment.rs index c3baa5c3..e94f0da5 100644 --- a/lightning-c-bindings/src/lightning_invoice/payment.rs +++ b/lightning-c-bindings/src/lightning_invoice/payment.rs @@ -6,9 +6,10 @@ // license as that which applies to the original source files from which this // source was automatically generated. -//! Convenient utilities for paying Lightning invoices and sending spontaneous payments. +//! Convenient utilities for paying Lightning invoices. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -24,8 +25,8 @@ use alloc::{vec::Vec, boxed::Box}; /// /// If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`]. #[no_mangle] -pub extern "C" fn pay_invoice(invoice: &crate::lightning_invoice::Bolt11Invoice, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, channelmanager: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ { - let mut ret = lightning_invoice::payment::pay_invoice::(invoice.get_native_ref(), retry_strategy.into_native(), channelmanager.get_native_ref()); +pub extern "C" fn pay_invoice(invoice: &crate::lightning_invoice::Bolt11Invoice, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, channelmanager: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CResult_ThirtyTwoBytesPaymentErrorZ { + let mut ret = lightning_invoice::payment::pay_invoice::<_>(invoice.get_native_ref(), retry_strategy.into_native(), channelmanager.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 } @@ -42,7 +43,7 @@ pub extern "C" fn pay_invoice(invoice: &crate::lightning_invoice::Bolt11Invoice, /// See [`pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency token. #[no_mangle] pub extern "C" fn pay_invoice_with_id(invoice: &crate::lightning_invoice::Bolt11Invoice, mut payment_id: crate::c_types::ThirtyTwoBytes, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, channelmanager: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CResult_NonePaymentErrorZ { - let mut ret = lightning_invoice::payment::pay_invoice_with_id::(invoice.get_native_ref(), ::lightning::ln::channelmanager::PaymentId(payment_id.data), retry_strategy.into_native(), channelmanager.get_native_ref()); + let mut ret = lightning_invoice::payment::pay_invoice_with_id::<_>(invoice.get_native_ref(), ::lightning::ln::channelmanager::PaymentId(payment_id.data), retry_strategy.into_native(), channelmanager.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_invoice::payment::PaymentError::native_into(e) }).into() }; local_ret } @@ -57,8 +58,8 @@ pub extern "C" fn pay_invoice_with_id(invoice: &crate::lightning_invoice::Bolt11 /// If you wish to use a different payment idempotency token, see /// [`pay_zero_value_invoice_with_id`]. #[no_mangle] -pub extern "C" fn pay_zero_value_invoice(invoice: &crate::lightning_invoice::Bolt11Invoice, mut amount_msats: u64, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, channelmanager: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ { - let mut ret = lightning_invoice::payment::pay_zero_value_invoice::(invoice.get_native_ref(), amount_msats, retry_strategy.into_native(), channelmanager.get_native_ref()); +pub extern "C" fn pay_zero_value_invoice(invoice: &crate::lightning_invoice::Bolt11Invoice, mut amount_msats: u64, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, channelmanager: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CResult_ThirtyTwoBytesPaymentErrorZ { + let mut ret = lightning_invoice::payment::pay_zero_value_invoice::<_>(invoice.get_native_ref(), amount_msats, retry_strategy.into_native(), channelmanager.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 } @@ -76,11 +77,34 @@ pub extern "C" fn pay_zero_value_invoice(invoice: &crate::lightning_invoice::Bol /// idempotency token. #[no_mangle] pub extern "C" fn pay_zero_value_invoice_with_id(invoice: &crate::lightning_invoice::Bolt11Invoice, mut amount_msats: u64, mut payment_id: crate::c_types::ThirtyTwoBytes, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, channelmanager: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CResult_NonePaymentErrorZ { - let mut ret = lightning_invoice::payment::pay_zero_value_invoice_with_id::(invoice.get_native_ref(), amount_msats, ::lightning::ln::channelmanager::PaymentId(payment_id.data), retry_strategy.into_native(), channelmanager.get_native_ref()); + let mut ret = lightning_invoice::payment::pay_zero_value_invoice_with_id::<_>(invoice.get_native_ref(), amount_msats, ::lightning::ln::channelmanager::PaymentId(payment_id.data), retry_strategy.into_native(), channelmanager.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_invoice::payment::PaymentError::native_into(e) }).into() }; local_ret } +/// Sends payment probes over all paths of a route that would be used to pay the given invoice. +/// +/// See [`ChannelManager::send_preflight_probes`] for more information. +#[no_mangle] +pub extern "C" fn preflight_probe_invoice(invoice: &crate::lightning_invoice::Bolt11Invoice, channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut liquidity_limit_multiplier: crate::c_types::derived::COption_u64Z) -> crate::c_types::derived::CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { + let mut local_liquidity_limit_multiplier = if liquidity_limit_multiplier.is_some() { Some( { liquidity_limit_multiplier.take() }) } else { None }; + let mut ret = lightning_invoice::payment::preflight_probe_invoice::<_>(invoice.get_native_ref(), channelmanager.get_native_ref(), local_liquidity_limit_multiplier); + 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.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0_1.0 }).into(); local_ret_0_0 }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::payment::ProbingError::native_into(e) }).into() }; + local_ret +} + +/// Sends payment probes over all paths of a route that would be used to pay the given zero-value +/// invoice using the given amount. +/// +/// See [`ChannelManager::send_preflight_probes`] for more information. +#[no_mangle] +pub extern "C" fn preflight_probe_zero_value_invoice(invoice: &crate::lightning_invoice::Bolt11Invoice, mut amount_msat: u64, channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut liquidity_limit_multiplier: crate::c_types::derived::COption_u64Z) -> crate::c_types::derived::CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { + let mut local_liquidity_limit_multiplier = if liquidity_limit_multiplier.is_some() { Some( { liquidity_limit_multiplier.take() }) } else { None }; + let mut ret = lightning_invoice::payment::preflight_probe_zero_value_invoice::<_>(invoice.get_native_ref(), amount_msat, channelmanager.get_native_ref(), local_liquidity_limit_multiplier); + 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.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0_1.0 }).into(); local_ret_0_0 }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::payment::ProbingError::native_into(e) }).into() }; + local_ret +} + /// An error that may occur when making a payment. #[derive(Clone)] #[must_use] @@ -186,3 +210,108 @@ pub extern "C" fn PaymentError_sending(a: crate::lightning::ln::outbound_payment pub extern "C" fn PaymentError_eq(a: &PaymentError, b: &PaymentError) -> bool { if &a.to_native() == &b.to_native() { true } else { false } } +/// An error that may occur when sending a payment probe. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum ProbingError { + /// An error resulting from the provided [`Bolt11Invoice`]. + Invoice( + crate::c_types::Str), + /// An error occurring when sending a payment probe. + Sending( + crate::lightning::ln::outbound_payment::ProbeSendFailure), +} +use lightning_invoice::payment::ProbingError as ProbingErrorImport; +pub(crate) type nativeProbingError = ProbingErrorImport; + +impl ProbingError { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeProbingError { + match self { + ProbingError::Invoice (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeProbingError::Invoice ( + a_nonref.into_str(), + ) + }, + ProbingError::Sending (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeProbingError::Sending ( + a_nonref.into_native(), + ) + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeProbingError { + match self { + ProbingError::Invoice (mut a, ) => { + nativeProbingError::Invoice ( + a.into_str(), + ) + }, + ProbingError::Sending (mut a, ) => { + nativeProbingError::Sending ( + a.into_native(), + ) + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &nativeProbingError) -> Self { + match native { + nativeProbingError::Invoice (ref a, ) => { + let mut a_nonref = Clone::clone(a); + ProbingError::Invoice ( + a_nonref.into(), + ) + }, + nativeProbingError::Sending (ref a, ) => { + let mut a_nonref = Clone::clone(a); + ProbingError::Sending ( + crate::lightning::ln::outbound_payment::ProbeSendFailure::native_into(a_nonref), + ) + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeProbingError) -> Self { + match native { + nativeProbingError::Invoice (mut a, ) => { + ProbingError::Invoice ( + a.into(), + ) + }, + nativeProbingError::Sending (mut a, ) => { + ProbingError::Sending ( + crate::lightning::ln::outbound_payment::ProbeSendFailure::native_into(a), + ) + }, + } + } +} +/// Frees any resources used by the ProbingError +#[no_mangle] +pub extern "C" fn ProbingError_free(this_ptr: ProbingError) { } +/// Creates a copy of the ProbingError +#[no_mangle] +pub extern "C" fn ProbingError_clone(orig: &ProbingError) -> ProbingError { + orig.clone() +} +#[no_mangle] +/// Utility method to constructs a new Invoice-variant ProbingError +pub extern "C" fn ProbingError_invoice(a: crate::c_types::Str) -> ProbingError { + ProbingError::Invoice(a, ) +} +#[no_mangle] +/// Utility method to constructs a new Sending-variant ProbingError +pub extern "C" fn ProbingError_sending(a: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> ProbingError { + ProbingError::Sending(a, ) +} +/// Checks if two ProbingErrors contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +#[no_mangle] +pub extern "C" fn ProbingError_eq(a: &ProbingError, b: &ProbingError) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } +} diff --git a/lightning-c-bindings/src/lightning_invoice/utils.rs b/lightning-c-bindings/src/lightning_invoice/utils.rs index 0b1f0bb1..63295d6f 100644 --- a/lightning-c-bindings/src/lightning_invoice/utils.rs +++ b/lightning-c-bindings/src/lightning_invoice/utils.rs @@ -9,6 +9,7 @@ //! Convenient utilities to create an invoice. use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -57,7 +58,7 @@ use alloc::{vec::Vec, boxed::Box}; /// This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not /// available and the current time is supplied by the caller. #[no_mangle] -pub extern "C" fn create_phantom_invoice(mut amt_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::derived::COption_PaymentHashZ, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z, mut duration_since_epoch: u64) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { +pub extern "C" fn create_phantom_invoice(mut amt_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z, mut duration_since_epoch: u64) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::ln::PaymentHash({ payment_hash_opt.take() }.data) }})} }; let mut local_phantom_route_hints = Vec::new(); for mut item in phantom_route_hints.into_rust().drain(..) { local_phantom_route_hints.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; @@ -106,7 +107,7 @@ pub extern "C" fn create_phantom_invoice(mut amt_msat: crate::c_types::derived:: /// This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not /// available and the current time is supplied by the caller. #[no_mangle] -pub extern "C" fn create_phantom_invoice_with_description_hash(mut amt_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::derived::COption_PaymentHashZ, mut invoice_expiry_delta_secs: u32, mut description_hash: crate::lightning_invoice::Sha256, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z, mut duration_since_epoch: u64) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { +pub extern "C" fn create_phantom_invoice_with_description_hash(mut amt_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut invoice_expiry_delta_secs: u32, mut description_hash: crate::lightning_invoice::Sha256, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z, mut duration_since_epoch: u64) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::ln::PaymentHash({ payment_hash_opt.take() }.data) }})} }; let mut local_phantom_route_hints = Vec::new(); for mut item in phantom_route_hints.into_rust().drain(..) { local_phantom_route_hints.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; diff --git a/lightning-c-bindings/src/lightning_persister.rs b/lightning-c-bindings/src/lightning_persister.rs deleted file mode 100644 index 49ea8790..00000000 --- a/lightning-c-bindings/src/lightning_persister.rs +++ /dev/null @@ -1,117 +0,0 @@ -// This file is Copyright its original authors, visible in version control -// history and in the source files from which this was generated. -// -// This file is licensed under the license available in the LICENSE or LICENSE.md -// file in the root of this repository or, if no such file exists, the same -// license as that which applies to the original source files from which this -// source was automatically generated. - -//! Utilities that handle persisting Rust-Lightning data to disk via standard filesystem APIs. - -use alloc::str::FromStr; -use core::ffi::c_void; -use core::convert::Infallible; -use bitcoin::hashes::Hash; -use crate::c_types::*; -#[cfg(feature="no-std")] -use alloc::{vec::Vec, boxed::Box}; - -mod util { - -use alloc::str::FromStr; -use core::ffi::c_void; -use core::convert::Infallible; -use bitcoin::hashes::Hash; -use crate::c_types::*; -#[cfg(feature="no-std")] -use alloc::{vec::Vec, boxed::Box}; - -} - -use lightning_persister::FilesystemPersister as nativeFilesystemPersisterImport; -pub(crate) type nativeFilesystemPersister = nativeFilesystemPersisterImport; - -/// FilesystemPersister persists channel data on disk, where each channel's -/// data is stored in a file named after its funding outpoint. -/// -/// Warning: this module does the best it can with calls to persist data, but it -/// can only guarantee that the data is passed to the drive. It is up to the -/// drive manufacturers to do the actual persistence properly, which they often -/// don't (especially on consumer-grade hardware). Therefore, it is up to the -/// user to validate their entire storage stack, to ensure the writes are -/// persistent. -/// Corollary: especially when dealing with larger amounts of money, it is best -/// practice to have multiple channel data backups and not rely only on one -/// FilesystemPersister. -#[must_use] -#[repr(C)] -pub struct FilesystemPersister { - /// A pointer to the opaque Rust object. - - /// Nearly everywhere, inner must be non-null, however in places where - /// the Rust equivalent takes an Option, it may be set to null to indicate None. - pub inner: *mut nativeFilesystemPersister, - /// Indicates that this is the only struct which contains the same pointer. - - /// Rust functions which take ownership of an object provided via an argument require - /// this to be true and invalidate the object pointed to by inner. - pub is_owned: bool, -} - -impl Drop for FilesystemPersister { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeFilesystemPersister>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn FilesystemPersister_free(this_obj: FilesystemPersister) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn FilesystemPersister_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeFilesystemPersister) }; -} -#[allow(unused)] -impl FilesystemPersister { - pub(crate) fn get_native_ref(&self) -> &'static nativeFilesystemPersister { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeFilesystemPersister { - unsafe { &mut *ObjOps::untweak_ptr(self.inner) } - } - /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy - pub(crate) fn take_inner(mut self) -> *mut nativeFilesystemPersister { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } -} -/// Initialize a new FilesystemPersister and set the path to the individual channels' -/// files. -#[must_use] -#[no_mangle] -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()); - 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: &crate::lightning_persister::FilesystemPersister) -> crate::c_types::Str { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_data_dir(); - ret.into() -} - -/// Read `ChannelMonitor`s from disk. -#[must_use] -#[no_mangle] -pub extern "C" fn FilesystemPersister_read_channelmonitors(this_arg: &crate::lightning_persister::FilesystemPersister, mut entropy_source: crate::lightning::sign::EntropySource, signer_provider: &crate::lightning::sign::SignerProvider) -> crate::c_types::derived::CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.read_channelmonitors(entropy_source, signer_provider); - 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 -} - diff --git a/lightning-c-bindings/src/lightning_persister/fs_store.rs b/lightning-c-bindings/src/lightning_persister/fs_store.rs new file mode 100644 index 00000000..a53f6e60 --- /dev/null +++ b/lightning-c-bindings/src/lightning_persister/fs_store.rs @@ -0,0 +1,135 @@ +// This file is Copyright its original authors, visible in version control +// history and in the source files from which this was generated. +// +// This file is licensed under the license available in the LICENSE or LICENSE.md +// file in the root of this repository or, if no such file exists, the same +// license as that which applies to the original source files from which this +// source was automatically generated. + +//! Objects related to [`FilesystemStore`] live here. + +use alloc::str::FromStr; +use alloc::string::String; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + + +use lightning_persister::fs_store::FilesystemStore as nativeFilesystemStoreImport; +pub(crate) type nativeFilesystemStore = nativeFilesystemStoreImport; + +/// A [`KVStore`] implementation that writes to and reads from the file system. +#[must_use] +#[repr(C)] +pub struct FilesystemStore { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, inner must be non-null, however in places where + /// the Rust equivalent takes an Option, it may be set to null to indicate None. + pub inner: *mut nativeFilesystemStore, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for FilesystemStore { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeFilesystemStore>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the FilesystemStore, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn FilesystemStore_free(this_obj: FilesystemStore) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn FilesystemStore_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeFilesystemStore) }; +} +#[allow(unused)] +impl FilesystemStore { + pub(crate) fn get_native_ref(&self) -> &'static nativeFilesystemStore { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeFilesystemStore { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeFilesystemStore { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// Constructs a new [`FilesystemStore`]. +#[must_use] +#[no_mangle] +pub extern "C" fn FilesystemStore_new(mut data_dir: crate::c_types::Str) -> crate::lightning_persister::fs_store::FilesystemStore { + let mut ret = lightning_persister::fs_store::FilesystemStore::new(data_dir.into_pathbuf()); + crate::lightning_persister::fs_store::FilesystemStore { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Returns the data directory. +#[must_use] +#[no_mangle] +pub extern "C" fn FilesystemStore_get_data_dir(this_arg: &crate::lightning_persister::fs_store::FilesystemStore) -> crate::c_types::Str { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_data_dir(); + ret.into() +} + +impl From for crate::lightning::util::persist::KVStore { + fn from(obj: nativeFilesystemStore) -> Self { + let mut rust_obj = FilesystemStore { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = FilesystemStore_as_KVStore(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn + rust_obj.inner = core::ptr::null_mut(); + ret.free = Some(FilesystemStore_free_void); + ret + } +} +/// Constructs a new KVStore which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned KVStore must be freed before this_arg is +#[no_mangle] +pub extern "C" fn FilesystemStore_as_KVStore(this_arg: &FilesystemStore) -> crate::lightning::util::persist::KVStore { + crate::lightning::util::persist::KVStore { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + read: FilesystemStore_KVStore_read, + write: FilesystemStore_KVStore_write, + remove: FilesystemStore_KVStore_remove, + list: FilesystemStore_KVStore_list, + } +} + +#[must_use] +extern "C" fn FilesystemStore_KVStore_read(this_arg: *const c_void, mut primary_namespace: crate::c_types::Str, mut secondary_namespace: crate::c_types::Str, mut key: crate::c_types::Str) -> crate::c_types::derived::CResult_CVec_u8ZIOErrorZ { + let mut ret = >::read(unsafe { &mut *(this_arg as *mut nativeFilesystemStore) }, primary_namespace.into_str(), secondary_namespace.into_str(), key.into_str()); + 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::c_types::IOError::from_rust(e) }).into() }; + local_ret +} +#[must_use] +extern "C" fn FilesystemStore_KVStore_write(this_arg: *const c_void, mut primary_namespace: crate::c_types::Str, mut secondary_namespace: crate::c_types::Str, mut key: crate::c_types::Str, mut buf: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NoneIOErrorZ { + let mut ret = >::write(unsafe { &mut *(this_arg as *mut nativeFilesystemStore) }, primary_namespace.into_str(), secondary_namespace.into_str(), key.into_str(), buf.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::c_types::IOError::from_rust(e) }).into() }; + local_ret +} +#[must_use] +extern "C" fn FilesystemStore_KVStore_remove(this_arg: *const c_void, mut primary_namespace: crate::c_types::Str, mut secondary_namespace: crate::c_types::Str, mut key: crate::c_types::Str, mut lazy: bool) -> crate::c_types::derived::CResult_NoneIOErrorZ { + let mut ret = >::remove(unsafe { &mut *(this_arg as *mut nativeFilesystemStore) }, primary_namespace.into_str(), secondary_namespace.into_str(), key.into_str(), lazy); + 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 +} +#[must_use] +extern "C" fn FilesystemStore_KVStore_list(this_arg: *const c_void, mut primary_namespace: crate::c_types::Str, mut secondary_namespace: crate::c_types::Str) -> crate::c_types::derived::CResult_CVec_StrZIOErrorZ { + let mut ret = >::list(unsafe { &mut *(this_arg as *mut nativeFilesystemStore) }, primary_namespace.into_str(), secondary_namespace.into_str()); + 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.into() }); }; local_ret_0.into() }).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_persister/mod.rs b/lightning-c-bindings/src/lightning_persister/mod.rs new file mode 100644 index 00000000..1a0b72a2 --- /dev/null +++ b/lightning-c-bindings/src/lightning_persister/mod.rs @@ -0,0 +1,32 @@ +// This file is Copyright its original authors, visible in version control +// history and in the source files from which this was generated. +// +// This file is licensed under the license available in the LICENSE or LICENSE.md +// file in the root of this repository or, if no such file exists, the same +// license as that which applies to the original source files from which this +// source was automatically generated. + +//! Provides utilities for LDK data persistence and retrieval. + +use alloc::str::FromStr; +use alloc::string::String; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +pub mod fs_store; +mod utils { + +use alloc::str::FromStr; +use alloc::string::String; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +} diff --git a/lightning-c-bindings/src/lightning_rapid_gossip_sync/error.rs b/lightning-c-bindings/src/lightning_rapid_gossip_sync/error.rs index b7cd7340..4a768399 100644 --- a/lightning-c-bindings/src/lightning_rapid_gossip_sync/error.rs +++ b/lightning-c-bindings/src/lightning_rapid_gossip_sync/error.rs @@ -9,6 +9,7 @@ /// Error types that these functions can return use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; diff --git a/lightning-c-bindings/src/lightning_rapid_gossip_sync/mod.rs b/lightning-c-bindings/src/lightning_rapid_gossip_sync/mod.rs index b4c2d51c..6883b871 100644 --- a/lightning-c-bindings/src/lightning_rapid_gossip_sync/mod.rs +++ b/lightning-c-bindings/src/lightning_rapid_gossip_sync/mod.rs @@ -59,6 +59,7 @@ //! ``` use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; @@ -70,6 +71,7 @@ pub mod error; mod processing { use alloc::str::FromStr; +use alloc::string::String; use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash;